Skip to content
ML to LLMs
Labs / Foundations

Underfitting vs overfitting

Change polynomial degree, training size, and noise; watch training and validation error split apart.

Theory and worked examples: Overfitting and the bias-variance trade-off

Underfitting vs overfitting

Synthetic data from y = sin(πx) + noise. Blue dots train the model; 200 hidden validation points score it.

Training data and fitted polynomial-1-0.500.51-2-1012xy
true functiondegree-3 fittraining points
Error versus model complexity51015-101polynomial degreelog₁₀ MSE
training errorvalidation errorcurrent degree
Near the sweet spot: validation error 0.101 is close to the best (0.101 at degree 3).