How does a Decision Tree Work?

Decision Tree:

Decision trees always start with a root node and end on a leaf. Notice that the trees don’t converge at any point; they split their way out as the nodes are processed. The root node is “Age” and has two branches that come from it, whether the customer is younger than 55 years old or older.

Building a Decision Tree:

Decision trees are built around the basic concept of this algorithm.
i. Check the model for the base cases.
ii. Iterate through all the attributes (attr).
iii. Get the normalized information gained from splitting on attr.
iv. Let best_attr be the attribute with the highest information gain.
v. Create a decision node that splits on the best_attr attribute.
vi. Work on the sublists that are obtained by splitting on best_attr and adding
those nodes as child nodes.

That’s the basic outline of what happens when you build a decision tree. Depending on the algorithm type, like the ones previously mentioned, there might be subtle differences in the way things are done.