Pruning is structural regularization for decision trees, trading off training fit against model complexity. Cost-complexity pruning minimizes
Rα(T)=R(T)+α∣T∣, where
R(T) is the empirical risk — for classification the weighted misclassification rate over leaves
R(T)=∑t∈leaves(T)∣D∣∣Dt∣⋅err(t), for regression the weighted MSE —
∣T∣ is the number of leaves, and
α≥0 penalizes each leaf. Pre-pruning stops growth before a split if validation error does not drop (or samples fall below a threshold); post-pruning (CART) grows the full tree first, then bottom-up considers each internal node
t: replacing subtree
Tt by a leaf
t changes the cost from
R(Tt)+α∣Tt∣ to
R(t)+α, and equality yields the critical
α=∣Tt∣−1R(t)−R(Tt) — prune whenever
α exceeds this value. CART starts from
α=0 and repeatedly prunes the node with the smallest critical
α (weakest-link pruning), producing a nested sequence
T0⊃T1⊃⋯⊃Tk, then selects the tree minimizing validation error, i.e. picks
α∗. C4.5 uses pessimistic pruning with a continuity-corrected error
Rpe(t)=∣Dt∣err(t)+2∣Tt∣.