Chapter 2 · Machine learning basics
Decision trees
A decision tree asks yes/no questions about features until it reaches an answer.
Chapter 2 · Machine learning basics
A decision tree asks yes/no questions about features until it reaches an answer.
Start: one guess for every fruit. Not much use.
Green circles are ripe fruit, coral diamonds are not ripe. Each question cuts one box in two.
“Is the fruit red enough?” Pick the question that sorts ripe from unripe best. That cut splits the data into two groups.
Press Split once more. The tree always makes the cut that helps most. Switch off a feature to see what a tree with fewer questions can do.
No questions yet: the tree gives one answer for every fruit.
A simplified teaching version: thirty made-up fruits, two features, and cuts picked by the Gini measure. “New fruit” is a separate set of sixty fruits the tree never saw.
How does a tree choose its next question?
What is a leaf?
A tree keeps splitting until every training example is right. The risk is…