Skip to content
AI & Machine Learning

Overfitting

Definition

Overfitting occurs when a model is too complex and learns the noise in the training data, resulting in poor performance on new, unseen data. This happens when a model has too many parameters and is trying to fit the data too closely.

Diagram

Underfitting, a good fit and overfittingThree charts of the same scattered points. A flat line underfits, missing the downward trend. A smooth curve fits well. A wiggly line that passes through every point overfits, learning the noise and making poor predictions for new data.Underfittoo simple: misses the patternGood fitfollows the trend, ignores noiseOverfitmemorizes every point, noise too
You can’t tell overfitting from training data alone, because it looks best there. Hold back data the model never sees during training and compare: a big gap between training and test scores means overfitting; poor scores on both mean underfitting.

Worked example