Fig. 1 in words
Six places a model can fail · each with its own test
- columns: class · symptom · test that catches it · dated case
- ① Data · Input is wrong · Check units at every hand-off · Mars Climate Orbiter, 1999: lbf·s read as N·s
- ② Structure · Residuals show a pattern · Plot residuals; push past the idealization · Small-angle pendulum at 90°: period off by 18%
- ③ Fit · Train and test disagree · Score on data the model never saw · Code below, degree 9: 0.073 train, 0.41 new points
- ④ Shift · Error grows over time · Re-score on fresh data, on a schedule · Google Flu Trends, Feb 2013: over twice the CDC's share
- ⑤ Range · Used beyond its data · Compare inputs to the training range · Challenger, 1986: 31°F; coldest earlier launch 53°F
- ⑥ Core · Anomaly survives every fix · A rival that explains it · Mercury's extra 43″/century: Newton → Einstein
- Fig. 1 — The first five can be fixed inside the model; the sixth needs a new one (Sprint 16). Cases from the NASA board report, Lazer et al. (2014), Dalal et al. (1989), Sprints 5 and 7.
01 Name It First
- Six classes: data, structure, fit, shift, range, core
- Each has its own symptom and its own test
Box (1976): it is “inappropriate to be concerned about mice when there are tigers abroad.”
02 Under & Overfit
- Too simple: high error everywhere (d = 1)
- Too flexible: training error falls, new-data error rises (d = 9)
Held-out data catches it. Training error never will.
03 Out of Range
- Past x = 3 the degree-9 error jumps from 0.41 to 482
- Challenger: 31°F, far below every earlier launch
The pre-launch chart also left out the flights with no O-ring trouble (Dalal et al., 1989).
04 Tied, Then Split
- Many models tie on the test set, then differ in use (D'Amour et al., 2022)
- Goodhart (1975): a rule used for control tends to collapse
One good test score is one draw, not a guarantee.
05 Try It Yourself
sprint17_taxonomy_of_model_failure.py
import numpy as np
rng = np.random.default_rng(17)
f = np.sin # the truth
x = rng.uniform(0, 3, 20) # training
y = f(x) + rng.normal(0, 0.1, 20)
xi = rng.uniform(0, 3, 1000) # inside
xo = rng.uniform(3, 4, 1000) # outside
def err(p, u, v):
e = np.polyval(p, u) - v
return np.sqrt((e**2).mean()).round(3)
for d in (1, 3, 9):
p = np.polyfit(x, y, d)
print(d, err(p, x, y),
err(p, xi, f(xi)),
err(p, xo, f(xo)))
Output, as printed on the image
1 0.294 0.314 1.451
3 0.107 0.061 0.118
9 0.073 0.41 482.043
Run it. sprint17_taxonomy_of_model_failure.py · versions, data and steps
Columns: degree, train, inside, outside (RMSE). Degree 9: 482.043 ÷ 0.41 ≈ 1 176× worse outside.
06 General Notes
- Name the class before the fix
- One failure can hide another
- Test on data the model never saw
- Log the date and the conditions
07 Mini Project
- Rerun with degrees 1 to 12
- Plot the three errors against degree
- Shrink the outside range to 3–3.5
- Classify one failure you have seen
