Decision Tree in Machine Learning
Abhishek Vijayvargia
Principal ML Engineer @ Splunk| Ex-Microsoft | 150k+ Linkedin Followers | 250 Million Views | Content Creator | Career Mentor | Copilot - LLM Researcher | IIT Kanpur
Machine Learning is Fun! So are the algorithms.
Let’s suggest magazines for different people. Consider the data we have for recommending magazine. We have recorded age, gender and location of users and the type of magazine they read.
Now by our observation from this data, we can see people whose are less than 15 like to read Kids magazine. Let’s make a node and its decision. Here a graph is presented. Each rounded node referred to decision node. Edges of the graph denote the corresponding decisions. Each rectangle node represents decision taken by following that branch of the graph.
So, we can say each person whose age less than or equal to 15 are likely to read Kids magazine. Now let’s handle the other branch where people are more than 15 years. Now our second observation, Male people like to read a Political magazine. We create the same decision node and branches for it.
That is great. Now move ahead with the people whose are greater than 15 years and Female. We still have one more information which we can utilize – Location. So, we can say people which are from the US are like to read Sports magazine otherwise they like Business magazine. Let’s form the node here.
We classified each data point correctly. So, this is called Decision Tree. There may exist multiple ways to create a decision tree. Those can also give a correct prediction as per the available data.
Consider this tree
This also classifies the data correctly.