Skip to main content

Lesson 1 of 3 ยท About 5 minutes

Why does my model overfit?

Your model fits its training examples, but struggles on new data. Make that gap visible.

Try it

Move the degree from 1 to 12. Does a better training fit also give a lower validation error? Compare both curves.

degree 3
Training MSE: 0.037/Validation MSE: 0.044

Compare settings using validation error. These fixed datasets show how the fit changes; they do not measure bias or variance across repeated training samples.

Error vs. Model complexityTraining errorValidation errorMSE03691215Polynomial degreeModel Fit (degree 3)True functionModel fit

The validation examples were kept out of fitting. Here both sets come from the same underlying curve. A flexible model can fit training noise that does not carry over to new examples. In real data, also check for a changed data distribution or inconsistent preprocessing before blaming overfitting.