The curve that fitted the data best was five times worse on everything else.
It passes through nearly every one of the thirty sentences it was given, and its error on the hundred and ten it was not is 11.24 against a straight line's 2.34. Nothing about the training data warns you. Four rounds, real fits, and you choose the one to ship.
- Score
- 0
- Nailed
- 0
- Streak
- ×0
- Round
- 1/4
Every curve fits these dots. Ship the one that will hold up on sentences it never saw.Every curve below was fitted to the same sentences and every one of them can draw those dots. Choose the one you would actually ship, then watch each get judged on sentences it was never shown.
Fitted to 60 sentences · judged on the 80 held back
Characters across, tokens up. Which of these would you ship?
Good ship. With 60 examples, the best of these was degree 3, at 2.35.
Every curve here fits its own dots better than the straight line does. That is what more capacity buys, and it is worth nothing unless there were enough dots to tell a real bend from an accident.
Thirty real sentences, each one a dot: how many characters it has, and how many tokens it came to. There is a relationship in here, and it looks close to a straight line.
Loading the sentences…
How much model you can afford depends on how much data you have.
NextHow sure is that number?+What is actually going onWhy does more freedom always fit the data better?Because a bigger model can do everything a smaller one can, plus more. It is arithmetic, not skill.
A degree three curve can be a straight line, by setting its extra coefficients to zero. So it can never do worse on the training data than the straight line, and it will usually do slightly better by bending towards whatever accidents are in that particular sample.
Which means the training error is not measuring the model. It is measuring how much freedom you gave it. That is why the blue curve in the figure only falls, and why a report showing you nothing but that curve tells you nothing.
Hastie and colleagues frame the trade underneath it: a model too simple is systematically wrong in the same way every time, and a model too free swings around with whichever examples it happened to get. You are choosing which error to have.
+What is actually going onIs a simpler model always safer, then?No. The straight line here would be too simple on data with a real bend in it, and the U can even turn back down.
Underfitting is a real failure too, and the game showed it: with a hundred and ten sentences, the cubic was the better choice. The bottom of the U moves right as you get more data, because with more evidence a bend can be justified rather than imagined.
The honest rule is not simplicity. It is that capacity is something you have to be able to afford, and what pays for it is examples.
One caveat worth carrying, since it is why modern models seem to break the rule. Belkin and colleagues showed that pushing capacity far past the point of fitting the training data perfectly can make error on new data fall again, a second descent. The U is a reliable picture of the region most people work in, not a law of nature.
+Go and try this for realHalve the training data and look again
Go and try this
Halve the training data and look again
Take any model or analysis somebody near you relies on. Ask for it to be rerun on half the examples, chosen at random, and compare the two results.
If nobody can rerun it, that is the more useful finding.
What to watch for: How much the model's conclusions change. Anything that survives being retrained on half the data was probably in the data. Anything that reverses was in the sample.
+Check yourselfIt marks itself, and nothing is sent anywhere.
Your model scores better on training data every time you make it bigger. What does that tell you?
Which way does each of these push?
Tap an item, then tap where it belongs. Dragging works too.
Sources
- Alice's Adventures in Wonderland
Lewis Carroll, Project Gutenberg ebook 11
The 140 sentences every dot on this page comes from. Thirty are fitted; the rest are held out.
Public domain
- The Elements of Statistical Learning, second edition
Hastie, Tibshirani & Friedman (Springer, 2009)
Chapter 7 on the bias and variance trade: why error on new data falls and then rises as a model gains freedom, and why the turning point moves with the amount of data.
- Reconciling modern machine learning practice and the bias-variance trade-off
Belkin, Hsu, Ma & Mandal (arXiv:1812.11118, 2018)
The caveat this page ends on: with very large models the curve can turn back down again, which is why the U is a rule of thumb rather than a law.