1. Core Concepts and Terminology¶
A Decision Tree is a hierarchical non-parametric model that partitions the feature space into local regions via recursive splits.
Root Node: The initial node containing all observations.
Internal (Decision) Node: Specifies a test on an attribute; branches represent outcomes.
Leaf (Terminal) Node: Represents the final prediction (class label or continuous value).
Univariate Tree: Each internal node tests only a single input dimension ().
Binary vs. Multi-way: Binary trees split into exactly two children, while multi-way trees can split into subsets based on categorical levels.
2. Classification Trees: Impurity Measures¶
To determine the optimal split, we measure the “impurity” of labels at a node . Let be the proportion of instances belonging to class .
Entropy & Information Gain (ID3)¶
Entropy measures the uncertainty/disorder in a node:
Information Gain is the reduction in entropy achieved by partitioning using attribute :
Gain Ratio (C4.5)¶
To correct the bias of Information Gain toward attributes with many levels, the Gain Ratio normalizes the gain:
Gini Index (CART)¶
Measures the probability of misclassification:
3. Regression Trees¶
In regression, the model partitions the space to minimize prediction error, typically the Residual Sum of Squares (RSS).
Tree-Growing Algorithm¶
Initialize: Start with a root node containing all observations. Compute the mean and total error :
Best Split Search: For a threshold splitting into and , compute the new error :
Select the split that maximizes the reduction: .
Recurse: Apply the process to child nodes until stopping criteria are met.
4. Overfitting and Pruning¶
Trees are prone to overfitting, capturing noise and creating non-smooth boundaries.
Stopping Criteria (Pre-pruning)¶
Growth stops if:
All instances in a node have the same label/predictor values.
The reduction in error is below a threshold .
The resulting nodes contain fewer than observations.
Post-pruning¶
Grow a deep tree using the training set.
Iteratively remove (prune) nodes that yield the largest improvement in validation performance.
Replacement Logic: Replace a subtree with a leaf if the expected error of the subtree exceeds that of the single leaf.
5. Ensemble Methods¶
To overcome the high variance and instability of single trees, ensemble methods combine multiple diverse trees.
Bootstrap Aggregating (Bagging)¶
Step 1: Sample records with replacement (Bootstrap) to create diverse training sets.
Step 2: Fit an overgrown tree to each set.
Step 3: Aggregate predictions via majority voting (classification) or averaging (regression).
Random Forest¶
Improves Bagging by further reducing correlation between trees.
At each split, only a random subset of features is considered.
Typical : for classification; for regression.
Error Hierarchy: Random Forest < Bagging < Single Tree.
6. Model Summary¶
| Feature | Details |
|---|---|
| Advantages | Interpretability (rules), handles mixed data types, no feature scaling required, non-parametric. |
| Disadvantages | High variance (instability), prone to overfitting, piecewise-constant predictions (non-smooth). |
| Comparison | Unlike Neural Networks, which learn features and classifiers jointly (end-to-end), trees rely on direct data partitioning. |
[Image comparing a smooth regression curve to a piecewise-constant tree approximation]