Bias / Variance Explorer
Polynomial degree against training and validation error, then training-set size against the gap between them. Two claims, both computed: training error only ever falls as the model gets more flexible, and validation error falls then rises. A third about data: more of it narrows the gap.
A model that memorised the training set looks perfect until it meets new data. That sentence is repeated so often it has stopped meaning anything, so here it is as a measurement: the training curve and the validation curve are on the same axes, and the distance between them is the amount of what the model learned that was noise. The shape tells you which of two different problems you have — and they have opposite fixes. A gap that closes with more data was variance; a floor that more data does not lower was bias, and no amount of collecting will move it.
How to read this page honestly
What the model is, and what it deliberately refuses to be.
- SIMULATEDOne-dimensional data, y = sin(2πx) + 0.5x + noise, 30 training points and a separate draw of 200 validation points from the same function. The fits are real least squares — normal equations solved by Gaussian elimination with partial pivoting, ridge added to the diagonal — in a Chebyshev basis so that degree 12 is numerically meaningful. A degree-12 fit that wiggles is wiggling because that is what least squares does with 30 noisy points.
- SIMPLIFIEDPolynomial degree is the cleanest knob for capacity, but real models do not have one knob. A tree's depth, a network's width and its training time, a boosting round count all trace the same U on validation error — and in a real project the x-axis is usually "how long we kept tuning".
- DATA-SPECIFICThe degree where validation error turns up depends on noise and on how many points there are. Lower the noise and the optimum moves right; add data on the learning-curve tab and a degree that overfitted 30 points stops overfitting 320. Nothing about "degree 3 is best" transfers.