Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Memorizing vs understanding
A student who memorizes last year’s exam answers scores perfectly on that exam but fails a new one. That’s overfitting: learning the quirks of the examples instead of the pattern. A student who learns only one rule of thumb does badly on both: that’s underfitting. Capacity is how much a model can memorize: more parameters, more wiggle room. The trick is matching capacity to how much data you have.
A terrain classifier that’s perfect on its training images but fails on a new crater field, or a dynamics model that fits test-flight data exactly but predicts nonsense outside it, are overfitting failures. Validation discipline (held-out data, cross-validation, early stopping) is what separates a demo from a deployable system.
- 1. Perfect training accuracy but poor accuracy on new data means…
- 2. A model too simple for the pattern…
- 3. More training data generally lets you use…
Level 1: Beginner
★★☆☆☆ Basic⏱ 25 minSecondary-school mathematics: arithmetic and elementary algebra.Training vs test error
Training error measures fit to the examples; test error on fresh data estimates the true risk (b1-1).
- As capacity grows, training error only falls: a richer model can always fit at least as well.
- Test error falls, then rises. This classic U-shape mirrors the bias–variance trade-off (b1-3).
- Generalization gap = test error − training error.
Controlling capacity
- Explicitly: number of parameters, polynomial degree, tree depth, k in k-NN.
- Implicitly: regularization penalties (ridge, lasso, weight decay), early stopping, dropout, data augmentation.
Learning curves
Plot training and test error against n for a fixed model. Training error rises and test error falls until both approach the noise floor. If they plateau high together, the model is underfitting: add capacity. A persistent gap means overfitting: add data or regularize.
- 1. As polynomial degree increases, training error…
- 2. Learning curves with a large persistent gap suggest…
- 3. Early stopping is a form of…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.Validation and cross-validation
Never choose capacity using test data. Hold out a validation set, or use k-fold cross-validation: split into k folds, train on k − 1, evaluate on the held-out fold, and average. Choose the capacity with the lowest CV error, then retrain on all the data. Small datasets favour k = 5–10; leave-one-out has low bias but high variance.
Information criteria
For likelihood models, AIC = 2k − 2 ln L̂ and BIC = k ln n − 2 ln L̂ trade fit against parameter count k without a held-out set (a5-2-5). For Gaussian regression, AIC ∝ n ln(RSS/n) + 2k.
Double descent
Modern networks often have more parameters than data points and fit the training data exactly, yet generalize. Belkin, Hsu, Ma and Mandal (2019) observed that test error can follow a double descent:
- the classic U up to the interpolation threshold (parameters ≈ data points), where the model barely manages to fit everything, highly unstably;
- a second descent as capacity grows further, because among the many interpolating solutions, gradient descent and least squares pick a minimum-norm, “smooth” one.
Regularization smooths away the spike (Hastie et al., 2022; Nakkiran et al., 2021).
- 1. Why not choose the degree with the lowest test error?
- 2. The interpolation threshold is where…
- 3. Beyond the threshold, least squares (pseudo-inverse) returns…
Level 3: Advanced
★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.Why training error is monotone
The degree-d polynomials are a subset of the degree-(d + 1) polynomials (set the top coefficient to 0). So the minimum training error over the larger class is no bigger. ∎
Why the threshold is dangerous
At p = n the feature matrix F is square, typically with tiny singular values . The fitted coefficients amplify noise by . With p much larger than n, the minimum-norm solution only uses the large singular directions, and the effective noise amplification falls again. Ridge adds λ to the squared singular values (it divides by s + λ/s instead of s), capping the amplification. ∎ (Hastie et al., 2022, make this exact for random features.)
Model selection by AIC
AIC estimates out-of-sample log-likelihood: the 2k penalty corrects the optimism of the in-sample fit, to first order (Akaike, 1974).
- 1. Training error is monotone in degree because…
- 2. At the interpolation threshold, noise is amplified by about…
- 3. Ridge regularization fixes the spike by…
Level 4: Expert
★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.Classic and modern generalization curves
The U-curve. With 25 points of y = sin 2πx + x/2 + noise (σ² = 0.0625), the median test MSE over 20 training sets is 0.436 at degree 0, 0.077 at degree 3 (best), 0.227 at degree 9 and 1.9 at degree 13. On one dataset, 5-fold CV picks degree 5, whose test MSE is 0.077 against the best possible 0.068. Degree-7 learning curves (train/test): 0.016/4.91 at n = 10, 0.042/0.092 at n = 30, 0.061/0.068 at n = 100 and 0.062/0.064 at n = 1000, converging to the noise.
Double descent. Random-ReLU-feature regression with n = 100 samples. Median test MSE of the minimum-norm least-squares fit against the number of features p:
| p | 10 | 40 | 80 | 100 | 120 | 300 | 1000 |
|---|---|---|---|---|---|---|---|
| test MSE | 1.18 | 1.27 | 3.45 | 189 | 4.04 | 1.55 | 1.27 |
At p = 100 the training error is exactly zero, and the fit is wildly unstable. A ridge penalty of 0.01 removes the spike: test MSE 1.23, 1.70 and 1.17 at p = 40, 100 and 1000. Here the second descent recovers to about the level of the best small model; with richer targets and inductive biases (deep networks) it can go well below it.
Capacity in AI, robotics and aerospace
- Practice: train/validation/test splits; cross-validation for small datasets; early stopping on validation loss; data augmentation for vision.
- Deep learning: over-parameterized networks interpolate and still generalize; implicit regularization of SGD (B4).
- System identification: model-order selection for dynamics models (AIC, validation on separate flights).
- Safety: monitoring for out-of-distribution inputs where an overfit model is most dangerous.
References
- T. Hastie, R. Tibshirani, J. Friedman (2009). The Elements of Statistical Learning, 2nd ed. Springer.
- M. Belkin, D. Hsu, S. Ma, S. Mandal (2019). “Reconciling modern machine-learning practice and the classical bias–variance trade-off.” PNAS, 116.
- P. Nakkiran, G. Kaplun, Y. Bansal, T. Yang, B. Barak, I. Sutskever (2021). “Deep double descent: where bigger models and more data hurt.” J. Stat. Mech. (ICLR 2020).
- T. Hastie, A. Montanari, S. Rosset, R. Tibshirani (2022). “Surprises in high-dimensional ridgeless least squares interpolation.” Annals of Statistics, 50.
- H. Akaike (1974). “A new look at the statistical model identification.” IEEE TAC, 19.