Overfitting
When a model learns the noise in its training data and performs badly on new data.
A model overfits when it fits its training examples so closely that it also memorises their random noise. Training error is low, but error on new, unseen data is much higher.
Typical causes are a model that is too flexible for the amount of data (a degree-15 polynomial on 20 points, a decision tree grown to full depth) or training for too long.
Fixes: get more data, simplify the model, add regularisation (ridge, lasso, dropout, weight decay), use early stopping, or average many models (random forests). Always judge a model on a validation or test set, never on the data it was trained on.
See it in action
- Bias, variance and cross-validationWhy models fail to generalise, the error decomposition, and how cross-validation chooses complexity.
- Polynomial regression and model capacityFit curves by expanding features, and learn to pick the complexity that generalises.
- Ridge, lasso and elastic netRegularised regression: shrink weights to fight overfitting, and let lasso select features.
- Bagging and random forestsAverage many deep, decorrelated trees to keep their low bias and cancel their high variance.