Given ten points of two classes scattered along a line, where's the one cut that tells you the most?
Drag the dashed line left and right. Some spots leave both sides a genuine mix of orange and grey — barely worth the split. Somewhere in the middle, one side becomes almost entirely one class. That's the split that actually teaches you something.
A decision tree is greedy: at every node, it tries every possible threshold and keeps whichever one removes the most uncertainty. That removed uncertainty is information gain — the entropy chapter's own formula, applied to a parent and its two children:
- IG — the information gain: how much uncertainty a split removes.
- — the entropy of the node before splitting.
- , — the entropy of each child node after splitting.
- , — the number of points that land in the left and right child.
- — the total number of points at the parent node.
- The second term is the children's weighted entropy
It's the entropy of each child node, weighted by how many points landed on that side — so a child with more points counts for more of the average.
- A good split lowers that weighted average a lot
A split is good exactly when the children's weighted average entropy is much lower than the parent's entropy you started with.
Now watch both sides' entropy directly instead of just the final gain. Push the split to an edge and one side goes empty (entropy 0, nothing left to weigh) while the other still holds the full mess. The best split isn't the one that empties a side fastest — it's the one that minimizes the weighted average.
This dataset is 6 of one class, 4 of the other.
- Compute the parent's entropy
- Split at 5.5 and compute each child's entropy
The left side () is 5 points, all one class — entropy . The right side () is 5 points, 4 of one class and 1 of the other:
- Weight the children by size
- Subtract from the parent for the information gain
The largest of any threshold this dataset admits, even though the right side still isn't perfectly pure.
Drag the split until information gain reaches within 0.03 bits of the best possible split — 0.610 bits.
A tree grows by repeating this one move at every node: try every threshold, measure how much entropy it removes, keep the best. Nothing here is new math — it's the same entropy formula from before, just applied twice and subtracted.