Overfitting & model complexity
Raise the polynomial degree and see training error fall while test error climbs.
Raise the polynomial degree and see training error fall while test error climbs.
The dots come from a hidden smooth curve plus random noise, like real measurements. The model sees only the black training points and fits a curve to them. The red rings are test points it never sees, kept back to check how well it predicts new data.
The question: how bendy should the curve be? Too stiff and it misses the pattern; too bendy and it copies the noise.
Error vs degree — tap to choose a degree
A model is fitted on training data but judged on data it has never seen. A degree-d polynomial can bend d − 1 times; too few bends and it misses the pattern (underfitting), too many and it threads every noisy training point (overfitting).
Training error can only go down as the model grows, so it is a poor guide. The test error makes a U shape: the bottom of the U is the sweet spot between too simple (high bias) and too wiggly (high variance).
Lowest test error on this sample: degree 7 (MSE 0.108). The noise alone gives an MSE of about 0.063.
A model is fitted on training data but judged on data it has never seen. A degree-d polynomial can bend d − 1 times; too few bends and it misses the pattern (underfitting), too many and it threads every noisy training point (overfitting).
Training error can only go down as the model grows, so it is a poor guide. The test error makes a U shape: the bottom of the U is the sweet spot between too simple (high bias) and too wiggly (high variance).
Things to try