Overfitting & Underfitting
A pricing model reports train_score = 1.00, a flawless run on every house it studied, so the team ships it. On a hundred houses it never saw, it misses nearly every price; the perfect number was the warning.
- ▸A model can ace 100% on its training rows and still be worthless on every new house.
- ▸Two failures point opposite ways: too simple misses the pattern everywhere, too complex aces training and blows the gap open.
- ▸A curve bent to touch every training point is usually the worst predictor there is.
A model studies a table of past house sales, size and price, and on those exact rows it predicts every price perfectly. That looks like success until you show it a house it never saw during training. Two numbers now exist: how well it scores on the rows it studied, and how well it scores on the held-back test set. When those two numbers stay close, the model found the real trend and can generalize to new houses.
When they split far apart, near-perfect on the studied rows and poor on the test set, the model memorized the exact examples instead of the trend beneath them. It chased every wiggle in the training data, the noise included, and a curve bent to touch every studied dot lands nowhere near the new ones. That blown-open distance between the two scores has a name, overfitting, and it is the single clearest sign a model learned the wrong thing.