Should you wear a jacket? A decision tree answers by following yes-or-no branches until it reaches a leaf node. A leaf has no outgoing branches: it is where the tree stops asking questions and makes its decision. Nodes that do ask questions are called decision nodes. section 9.0
A decision stump shows the simplest arrangement: one question at the root and two leaves, one for each answer. In a larger tree, a branch may lead to another question instead. The depth of a tree is the length of its longest path from the root to a leaf, counted in branches. section 9.0
When does a leaf stay a leaf?
Suppose a tree recommends an app using a person's age and phone platform. Splitting by age puts all three young users, who downloaded the same app, in one group. That group is *pure*, so its node becomes a leaf that predicts that app. The adult group still has different app labels, so it can be split by platform. After that split, the resulting groups are pure too. section 9.2
A leaf need not be pure to make a prediction. When comparing candidate splits, the prediction at each leaf can be the most common label among the samples there. Accuracy measures how often those predictions are correct; Gini index and entropy offer other ways to compare splits. Repeatedly splitting a group can turn what was a leaf into a decision node with new leaves below it. section 9.2
Figure 9.16 We can split the right leaf of the tree in figure 9.15 using platform and obtain two pure datasets. Each one of them has an accuracy of 100% and a Gini index and entropy of 0.
See how splitting the remaining mixed leaf by platform produces two pure groups, each ready to be a final leaf. section 9.2
Try drawing a jacket-decision stump with one question and two leaves. Then choose one leaf and add a second question beneath it. Which decisions now sit at the leaves, and how has the tree's depth changed? section 9.0









