A leaf node is a terminal region of a decision tree. Classification assigns the region’s majority class; regression assigns its expected value. section 5.6
A leaf node serves three connected purposes:
- Represents an axis-parallel region produced by recursive binary splits. section 5.6
- Summarizes the labels assigned to its contained data points through a majority vote or expected value. section 5.6
- Provides the unit whose purity is optimized while tree depth is controlled to limit overfitting. section 5.6
A leaf in a from-scratch implementation
A TreeNode stores the node’s Gini value, sample count, class counts, and class label, alongside split metadata and left and right child links. A terminal node uses the stored region statistics for prediction. section 5.6









