Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Too stiff or too wobbly
Imagine tracing a hill’s outline with a ruler: it is too stiff and misses the curve, however carefully you trace. That is underfitting. Now trace it with a wobbly string that passes through every pebble: it copies every bump, and a new photo of the same hill would look completely different. That is overfitting. A good model is flexible enough for the hill but not for the pebbles.
Knowing which failure you have decides what to spend money on. More flight tests won’t fix a model that is too simple. A more complex model won’t fix one that already memorises your few test campaigns. Learning curves answer this question before you spend.
- 1. A straight line fitted to a sine wave is…
- 2. A model that is perfect on training data but poor on new data is…
- 3. In the demo, more data helps most for…
Level 1: Beginner
★★☆☆☆ Basic⏱ 20 minSecondary-school mathematics: arithmetic and elementary algebra.Two diagnostic plots
- Validation curve: error against complexity, such as degree, depth or 1/λ. Training error keeps falling. Validation error first falls, then rises, and the minimum marks the best complexity.
- Learning curve: error against the number of training examples, for a fixed model. Training error rises and validation error falls as n grows, and they meet at a plateau.
| Symptom | Diagnosis | Remedies |
|---|---|---|
| high training error, small gap | high bias (underfit) | richer model, better features, less regularisation |
| low training error, large gap | high variance (overfit) | more data, simpler model, regularisation, ensembling, early stopping |
| both low and close to the target | good | stop |
from sklearn.model_selection import learning_curve, validation_curve
sizes, tr, va = learning_curve(model, X, y, train_sizes=[0.1, 0.3, 0.6, 1.0], cv=5, scoring="neg_mean_squared_error")
tr2, va2 = validation_curve(model, X, y, param_name="poly__degree", param_range=range(1, 12), cv=5)- 1. Training error 0.30, validation error 0.31, target 0.1: diagnosis?
- 2. Training error 0.01, validation error 0.40: remedy?
- 3. A validation curve plots error against…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 35 minUndergraduate students and practising engineers.The decomposition behind the plots
For squared loss at a point x, averaging over training sets (B1.3):
E[(y − f̂(x))²] = bias²(x) + variance(x) + σ², where bias(x) = E f̂(x) − f(x) and variance(x) = Var f̂(x).
Bias falls and variance rises as capacity grows. Variance shrinks roughly as 1/n as data grow, which is why learning curves of flexible models converge. The noise σ² is a floor no model can beat. An asymptote well above it means bias.
Learning curves of many models follow a power law in n: err(n) ≈ a + b·n^(−c). Here a is the irreducible-plus-bias floor. Fitting it to small-n points lets you estimate what more data would buy.
- 1. With σ = 0.3, the lowest possible expected MSE is…
- 2. Variance of a flexible model typically shrinks as…
- 3. In err(n) = a + b n^(−c), a is…
Level 3: Advanced
★★★★☆ Advanced⏱ 30 minGraduate level, with full derivations and proofs.Beyond the classical U-curve
- Regularisation moves you along the trade-off continuously (D1.5, D1.6). Ensembles cut variance (bagging) or bias (boosting) (D7).
- Model selection with CV finds the bottom of the validation curve, but noisily (D0.4). Prefer the simplest model within one standard error of the best.
- Very over-parameterised models can show double descent: test error falls again past the interpolation threshold (B4.4). The classical picture still holds within a fixed model family and moderate size.
- For classification with 0–1 loss, bias and variance do not add simply, but the diagnostic logic is the same.
Interview questions.
- Your model has 99% training and 70% validation accuracy. What do you do? High variance: get more data, regularise, simplify, use early stopping or ensembles.
- Why doesn’t more data fix underfitting? Bias does not depend on n; the curves have already converged above the target.
- 1. The 'one-standard-error rule' picks…
- 2. Bagging mainly reduces…
- 3. Double descent appears…
Level 4: Expert
★★★★★ Expert⏱ 30 minResearchers: original papers and open problems.Can a learning curve predict the value of data?
Exercise 1. With 30 training points, validation error is lowest at degree 3. Over 300 simulated training sets:
- degree 1 has bias² 0.177 and variance 0.023;
- degree 9 has bias² 0.0002 but variance 0.235, more than twice the noise σ² = 0.09.
Exercise 2: extrapolating learning curves. Median validation errors at n = 20–150 (60 repetitions each) are fitted with err(n) = a + b·n^(−c) and extrapolated to n = 2000.
| Degree | Train / val error at n = 150 | Fitted plateau a | Predicted at n = 2000 | Actual at n = 2000 |
|---|---|---|---|---|
| 1 | 0.282 / 0.291 | 0.287 | 0.287 | 0.288 |
| 3 | 0.092 / 0.097 | 0.098 | 0.098 | 0.095 |
| 9 | 0.083 / 0.095 | 0.095 | 0.095 | 0.091 |
Extrapolating 13× beyond the data, the power law predicts errors to within 0.3–4%. It slightly overestimates for flexible models, which keep improving towards the noise floor (0.09) more slowly than the fit expects. For degree 1, both curves sit on a plateau 3× above the noise floor with almost no gap, which says high bias before any extra data is collected.
Which fix? At n = 30, validation errors:
| Model | Validation error | Doubling the data | Switching to degree 3 |
|---|---|---|---|
| degree 1 (high bias) | 0.310 | 0.296 | 0.105 |
| degree 9 (high variance) | 0.126 | 0.103 | 0.105 |
The diagnosis predicts the right remedy. Extra data barely help the biased model, while a richer model cuts its error threefold. For the high-variance model, more data and a simpler model help about equally.
Bias and variance in AI, robotics and aerospace
- System identification: too few parameters miss dynamics (bias); too many fit sensor noise (variance). Learning curves guide how many test flights to plan.
- Perception models: learning curves of detection error against labelled images decide labelling budgets.
- Scaling laws for large models are learning curves in n and model size (B4.10).
References
- S. Geman, E. Bienenstock, R. Doursat (1992). “Neural networks and the bias/variance dilemma.” Neural Computation 4(1).
- T. Hastie, R. Tibshirani, J. Friedman (2009). The Elements of Statistical Learning, 2nd ed., chapter 7. Springer.
- C. Perlich, F. Provost, J. Simonoff (2003). “Tree induction vs. logistic regression: a learning-curve analysis.” JMLR 4.
- J. Hestness et al. (2017). “Deep learning scaling is predictable, empirically.” arXiv:1712.00409.
- A. Ng (2018). Machine Learning Yearning, chapters on bias and variance.