Level 0: Foundation
★☆☆☆☆ Introductory⏱ 5 minGeneral audience. No mathematics required.Two ways to be wrong
Imagine many students each learning from a different set of practice problems.
- Bias: if they all make the same mistake because their method is too simple, that’s bias. More practice won’t fix it.
- Variance: if each student’s answer depends wildly on which problems they happened to practise, that’s variance. Averaging many students, or giving each more practice, helps.
On top of both, the questions themselves contain some randomness (noise) that nobody can predict.
Choosing model size, regularization strength or how many neighbours to use is always a bias–variance trade-off. With small datasets, typical in robotics and space science (few flights, rare events), variance dominates, so simpler models, regularization and ensembles matter. Ensembles such as random forests and deep ensembles also give uncertainty estimates.
- 1. A model that's systematically off in the same way, whatever the data, has high…
- 2. A model whose predictions change a lot with each new training set has high…
- 3. Can more data reduce the irreducible noise?
Level 1: Beginner
★★☆☆☆ Basic⏱ 25 minSecondary-school mathematics: arithmetic and elementary algebra.The decomposition
Let with and . Let be trained on a random dataset D. At a point x,
Bias is about the average learner. Variance is about how learners trained on different samples disagree.
What moves each term
- More complexity (higher degree, smaller k, deeper trees) lowers bias and raises variance.
- More data lowers variance; bias is unchanged.
- Regularization (ridge, early stopping) raises bias a little and lowers variance a lot.
- Averaging independent-ish learners lowers variance and leaves bias unchanged.
- 1. If bias² = 0.01, variance = 0.02 and σ² = 0.09, the expected error is…
- 2. More training data mainly reduces…
- 3. Increasing a ridge penalty typically…
Level 2: Intermediate
★★★☆☆ Intermediate⏱ 40 minUndergraduate students and practising engineers.k-nearest neighbours
The prediction averages k noisy labels. If the neighbours are close enough that f barely changes, its variance is . Larger k averages over a wider neighbourhood, so bias grows with the curvature of f. The best k balances the two; it grows with n, and k-NN is consistent if and .
Averaging learners
For M predictors, each with variance σ² and pairwise correlation ρ, the average has variance
Averaging kills the uncorrelated part but not the shared part. Bagging (Breiman, 1996) trains on bootstrap resamples to make learners differ. Random forests also subsample features to cut ρ further (Breiman, 2001).
Beyond squared loss
For 0-1 loss the decomposition isn’t additive, and bias and variance can interact (Domingos, 2000). Modern over-parameterized networks also break the classic U-shaped curve (double descent, B4). The decomposition is still the right first lens.
- 1. k-NN variance (nearby neighbours, noise σ):
- 2. Averaging infinitely many learners with correlation ρ leaves variance…
- 3. Random forests reduce correlation between trees by…
Level 3: Advanced
★★★★☆ Advanced⏱ 40 minGraduate level, with full derivations and proofs.Proof of the decomposition
Write . Then . Square and take expectations. The cross terms vanish because , ε has mean 0, and ε is independent of D. The result is . ∎
Variance of an average
. ∎
k-NN variance
With the neighbours’ inputs fixed, the prediction is , which has variance conditionally. Randomness in which points are neighbours adds a little more. ∎
Exercise 3.1: a forest’s variance
25 trees with variance 0.2 and correlation 0.6: . Correlation, not the number of trees, sets the floor.
- 1. The decomposition's cross terms vanish because…
- 2. Variance of 25 averaged learners (σ² = 0.2, ρ = 0.6):
- 3. k-NN with k → ∞ but k/n → 0 is…
Level 4: Expert
★★★★★ Expert⏱ 35 minResearchers: original papers and open problems.Bias and variance, measured
Polynomials. At x = 0.25, with 30 points per training set and σ = 0.3, over 3000 training sets:
| model | bias² | variance | noise | total |
|---|---|---|---|---|
| degree 1 | 0.2646 | 0.0193 | 0.090 | 0.374 |
| degree 3 | 0.0001 | 0.0112 | 0.090 | 0.099 |
| degree 9 | 0.0000 | 0.0369 | 0.090 | 0.129 |
The three terms add up to the measured expected error. (These are the browser’s numbers; the degree-9 fit amplifies rounding, so results differ slightly by platform: desktop CPython gives variance 0.0367.)
Ridge on degree 9: λ = 10⁻⁸, 10⁻⁴ and 10⁻³ give bias² of 0.0000, 0.0010 and 0.0101 and variance of 0.0209, 0.0121 and 0.0101. The middle penalty has the lowest total.
k-NN (n = 200): the variance at k = 1, 5 and 20 is 0.0900, 0.0187 and 0.0042, matching σ²/k = 0.090, 0.018 and 0.0045. At k = 80, bias² jumps to 0.063.
Bagging 50 bootstrap 1-NN predictors halves the variance (0.092 → 0.042) without adding noticeable bias.
Bias and variance in AI, robotics and aerospace
- Model selection: cross-validation estimates the total; learning curves diagnose bias (both errors high) versus variance (big train–test gap).
- Ensembles: random forests and gradient boosting for tabular sensor data; deep ensembles for uncertainty in perception.
- Small-data science: flight-test and mission data are scarce, so strong priors and regularization trade a little bias for a lot of variance.
- Estimation theory: the Cramér–Rao bound (a12-5) and James–Stein shrinkage are bias–variance results in disguise.
References
- S. Geman, E. Bienenstock, R. Doursat (1992). “Neural networks and the bias/variance dilemma.” Neural Computation, 4.
- T. Hastie, R. Tibshirani, J. Friedman (2009). The Elements of Statistical Learning, 2nd ed. Springer.
- L. Breiman (1996). “Bagging predictors.” Machine Learning, 24.
- L. Breiman (2001). “Random forests.” Machine Learning, 45.
- P. Domingos (2000). “A unified bias-variance decomposition.” ICML.