 students, in this module, now we will do a practical exercise that we can use your decision tree practically in our machine learning or the models of this decision tree in python or in our machine learning so now in this we will share a practical example with you and you will see how you have to do this work so again, as I said, this is a very important library to learn so first of all we have to make sure that we have a decision tree model and it is built in, as I mentioned, I just reiterate, these models are built in you simply have to select them, you have to select the library and you have to select the model and then you have a data set available as I told you one name, let me tell you again if you go to git hub, you will get a lot of libraries, you will get a sample data set you will also get a code that will give you a great jump start you will see the actual codes very soon, you can copy them, recreate them in your environment plus you have the data sets available there in this we are saying that we have three types of data sets of iris which are their plants and their attributes that is your sample, the length and width of the petal and what is your tree type it is virginica, setosa or versicolor basically you now know the attributes of the data let's recall that we have labelled over data that we have labelled over data we know that we have labelled it as simple or staple we have labelled it as nature, we have labelled it as width similarly we have labelled over data this is your first step when you have to work in the decision tree model this is exactly the second step we will use pandas, you have done pandas, you have done numpy, you have learnt s these were some examples of our assumptions we have done it when we were installing python we had done it when we were doing pandas and libraries we have already understood that these are not available in our system you can import them in different exercises, I have changed the pattern so that your basic development and understanding is stronger and you should be able to understand in different situations how you have to work, how you have to handle the situation then you have done the decision tree classifier model then you have trained it then you have downloaded the data from iris then you have told the name of the target data for prediction then you have extracted it as I said this is your code, this is the code, this is the command you have to always keep in mind which are the commands and which is your actual code if you know that this is the line of the code and this is the line of the commands then the code becomes self-explanatory so that you know what is going on in this step and all these steps are basically step by step and this is the whole commentary of what we are doing then what have you done in this now you have taken the sample data as I said we have 150 examples of data but here we are only taking 4 rows of data because we have to test it right or train the model so this whole explanation is available to you now what have I done these are the commands or we have only taken the first 4 rows or we are saying that we have taken the test data this is the train, test, train, test and this is the whole value of it according to the size and the state then what have I done I have imported the decision tree classifier from the scikit-learn library so you will see that the code is very simple English it is very close to simple English this is the code on the left when you will do all these things then it will become very easy for you that you can do this whole exercise practically after this the output and then this is your training decision tree classifier this is my output and this is my predicted values okay now we will use the train classifier model to predict the labels of the test attributes now we will go here what have I done imported it to the scikit library and then we have its output now we are saying that the accuracy on the training data this is 100% and on the test data this is a little less you will think that 5% is an error it is not but when I trained it it was fine when I tested it then my accuracy was a little less and this is all the work based on the lines of this code then you tuned the parameters after this you will see because I have changed the model then my output has changed again now this is less than 1 but my test data the result of this is that was a 5% error now this is 3% this is 0.973 it means 2.6 or 0.26 there is an error it means that the model of our data or the model of our decision tree we have improved it the steps we have taken the purpose of discussing in detail was that you can understand that you can train that data you can also improve the model then your output and the model training and testing and improvement your end result is applied in the same way and you have seen if you see here your test data was 0.94 and here this is 0.97 accuracy and test data your accuracy has increased so follow all these steps and it will really help you boost your confidence it is the same thing in a different way as we did in the last exercises I have given you a screenshot so that you can do it this way you can do it this way step by step and maybe it is better for you first follow the step by step and then do it this way then your understanding that you will get a boost