Pruning trims decision-tree branches that have become too deep or specific. Like a gardener shaping a tree, it helps the model learn general patterns instead of memorizing training examples. section 8.17
The technique addresses overfitting: a tree may achieve perfect training accuracy yet perform poorly on unseen data because it learned narrow patterns and splitting criteria. Pruning aims for the balance between underfitting and overfitting. section 8.17
A warning sign
A decision tree classifies every training example correctly, but new examples receive poor classifications. Treating the perfect training score as a red flag, pruning removes overly specific branches so broader patterns guide predictions. section 8.17
Figure 8.26 Underfitting, ideal fit, and overfitting
Compare underfitting, an ideal fit, and overfitting visually. section 8.17






