After a series of attribute tests, the tree must produce an actual output. Without terminal points that commit to a prediction, the tree would be an infinite chain of questions with no answers.
A leaf node (terminal node) is the bottommost node in a decision tree that cannot be split further. Each leaf node represents a final decision or prediction — a class label in classification tasks, or a continuous numeric value in regression tasks.
Leaf nodes are created when stopping conditions are met during tree construction:
- Pure subset: All instances in the node belong to the same class → leaf with that class label
- No remaining attributes: No more features available to split on → leaf with majority vote of remaining instances
- No instances: The node receives zero training instances → leaf with majority vote of the parent’s instances
- Max depth reached: Pre-configured depth limit is hit → leaf with majority prediction of current subset
During prediction, a leaf node is the endpoint:
- The incoming instance follows a path from root to leaf
- At the leaf, the stored prediction is returned as the tree’s output
- In classification, this is a discrete class (e.g., “Purchase” or “No Purchase”)
- In regression, this is typically the mean value of training samples that reached this leaf
The source example shows leaf nodes like “No Purchase” (when income ≤ 50K, age > 30, and previous purchases > 0).
- Terminal: No outgoing branches — the decision path ends here
- Holds prediction: Stores the class label (classification) or numeric value (regression)
- No impurity: Ideally, all instances at a leaf belong to the same class
- Majority vote fallback: When impurity remains, predicts the most common class in the subset
- Builds into: Decision Tree Structure — leaves are the terminal elements of the tree
- Built from: Decision Tree Stopping Conditions — determines when a node becomes a leaf
- Built from: Node Purity — pure subsets become leaves directly
- Builds into: Decision Tree Prediction — leaves provide the final output
- Related: Classification — leaf nodes output class labels in classification
- Related: Regression — leaf nodes output continuous values in regression
- Single-sample leaves: A leaf with one training sample is perfectly pure but almost certainly overfitted
- Empty leaves: Can occur when a branch has no training data; defaults to parent’s majority class
- Imbalanced leaf predictions: A leaf may be dominated by one class but still contain minority class errors
- Leaf depth variance: Some leaves may be 2 levels deep, others 20 — leading to inconsistent prediction confidence