Interactive Lab · The two enemies of every model
Every model's error splits into two enemies, bias and variance, and they fight each other. Train a dozen models on a dozen fresh noisy datasets: if they all overlap, your model is stable but might all miss the truth the same way (bias). If they scatter wildly, each one chased its own sample's noise (variance). Push complexity to kill one and the other pops right back up. Drag the knob and watch the fits agree or thrash.
▶ The playground, drag complexity, watch the fits
Expected test error, decomposed0.000
The bias-variance tradeoff is the daily bread of every ML practitioner: it's the reason behind regularization, early stopping, ensembling, and the size of every model you deploy. When a team debates “bigger model or more data?”, they are standing exactly on the curve you just traced.
The code that's actually running
Crank complexity to max (12) and hit 🎲 Resample a few times, watch the faint fits thrash around the truth, a different tangle every time (that's variance). Now drop to degree 1: the fits barely move from resample to resample, but they all sit wrong in the same place (that's bias). Before you slide back: predict where total error bottoms out, and why it isn't at either extreme.
The takeaway