Premium Resources

Decision tree Model

The same problem can be solved by using another important Machine Learning model called Decision Tree. A Decision tree has various branches and offers us the end results in Leaf Nodes. There is one more attribute called petal length in this dataset which selects it as the root node. The method for selecting petal length is known as the Gini Index wherein we see if the index is high or low. The petal length with a root node wherein the length is less or equal to 2.45, it belongs to the Setosa class. If the petal length which is greater than 2.45, it is further segregated into two different classes. Firstly, if the petal length is less or equal to 4.75, it belongs to Virginica class, if it's greater than 4.75 then it belongs to Versicolor class. This is a very simple example of Decision Tree; wherein, the leaf nodes help us in understanding the prediction. Now, for example, if we use unseen data in a Decision Tree model, it should predict to which class it belongs to. If the petal length is less than or equal to 2.45, you can easily predict that it belongs to Setosa class. This means the machine has already learnt and is giving correct predictions for a business problem. Hence, by using this concept in any business problem, it can help us to derive thousands of rows and multiple classes.