A root node is the topmost node in a decision tree. It represents the entire training dataset and asks the tree’s first yes-or-no question. From there, branches lead to further decision nodes or leaves. section 9.0
A root node plays several roles while a tree is built:
- Start with level 0 and associate the complete dataset with the node. section 9.6
- Choose the feature that splits its samples most effectively according to a metric such as accuracy, Gini index, or entropy. section 9.6
- Become a decision node when splitting is allowed, or remain a leaf with the most common label when stopping conditions prevent a split. section 9.6
A first question about the weather
For the jacket example, the root node might ask, “Is it raining?” A yes branch leads directly to wearing a jacket, while a no branch can ask about temperature. A tree with only this root question and two leaves is a decision stump. section 9.0
A learned root split
With Scikit-Learn, fitting a DecisionTreeClassifier to features x_0 and x_1 produces a root corresponding to the first boundary, x_0 = 5. The resulting tree has depth 2, three nodes, and four leaves. section 9.11
Figure 9.2 A regular decision tree with a root node, decision nodes, branches, and leaves. Note that each decision node contains a yes-or-no question. From each possible answer, one branch emanates, which can lead to another decision node or a leaf. This tree has a depth of 2, because the longest path from a leaf to the root goes through two branches.
Use the diagram to trace how the root’s yes-or-no question divides the dataset into branches and lower-level nodes. section 9.0







