Overfitting happens when a model matches its training data so closely that it struggles with new, slightly different data. A high training score alone is not proof: the warning sign is a gap between strong training performance and poor performance on unseen data. section 8.13 section 8.17
The practice-test trap
Imagine memorizing every answer on a practice test. You might score 100% there but fail when the real exam asks differently worded questions. Underfitting is like not studying at all and failing both tests. A good fit is understanding enough to handle unfamiliar questions. section 8.13
A decision tree can become too specific as it repeatedly splits training examples. Its rules may classify those examples perfectly yet fail when real-world examples differ. Pruning removes branches that are too deep or specific, encouraging more general patterns. section 8.17
Figure 8.26 Underfitting, ideal fit, and overfitting
Compare the illustrated underfit, ideal-fit, and overfit cases; the goal is not simply to eliminate every training error. section 8.17
Another check is to reserve a validation set that the model never trains on and measure its loss during training. If training loss keeps falling while validation loss rises, the model is beginning to memorize rather than generalize. Early stopping ends training when validation loss stops improving. With a patience of three, training stops after three consecutive evaluations without improvement. section 11.34























