Orange line = current degree ยท Grey dashed = true function
Polynomial Degree
degree = 4Good fit
110
Data
Errors (MSE)
Training:-
Test:-
Zones
Underfitting (degree 1-2): model too simple - misses the pattern entirely.
Good fit (degree 3-5): captures the signal, generalises to new data.
Overfitting (degree 7+): memorises training noise, fails on test set.
Key Insight
Low degree โ high bias (underfits, misses the pattern). High degree โ high variance (overfits, memorises noise). The optimal degree minimises test error - not training error.
Try: Click "New Data" several times with degree 9 - watch the curve wildly change. Then switch to degree 3 - it stays stable.
The bias-variance tradeoff is the fundamental tension in machine learning: simple models underfit (high bias, miss the pattern), complex models overfit (high variance, memorize noise). This visualization fits polynomial regression models of degree 1โ10 to noisy data, showing training error, test error, and the classic U-shaped generalization curve.
Degree 1-2: high bias - straight line misses the curve entirely
Degree 3-5: the sweet spot - captures the true function, generalizes well
Degree 7+: high variance - wiggles through every training point but fails on test data
Error curve chart shows training vs test MSE for all degrees simultaneously
Click "New Data" to see how the optimal degree is consistent across different noise realizations
Direct foundation for regularization (L1/L2), dropout, early stopping, and cross-validation
Part of the EngineersOfAI Interactive 3D - free interactive visualizations covering every major concept in machine learning and AI engineering. Hover any element for a plain-English explanation. No code required.