Answers · The mathematics underneath
Why can a model get 100% on the training set and still be useless?
In shortA perfect training score only shows the model can reproduce the examples it was fitted on; it says nothing about new examples, where it may be no better than guessing.
It can score 100% because the score is computed on the examples used to choose every part of the model, so a procedure that stores those examples is enough. The perfect number says the examples were fitted, not that a pattern will carry to examples the model has not seen.
Take a procedure that keeps a list of 1,000 training examples and their labels. Shown a training input, it returns the stored label; on those 1,000 inputs it is right 1,000 times out of 1,000, which is an accuracy of 1.00 and an error of 0.00. Shown an input that is not in the list, it has nothing stored and guesses. With ten possible labels, a guess is right with probability , so the expected error on new examples is . This is not an exotic model. It is the limiting case of fitting, and it establishes what a perfect training score can mean. The number is real; the inference that learning occurred is not available from it.
The gap is how much of the training performance did not transfer. Here and , so . A training error of zero is therefore compatible with new error of 0.90. Neither number means much alone; the pair does. The lower the training error and the wider the gap, the more of the apparent success was fitting. A perfect training score alone cannot distinguish this from a model that has found a pattern that does transfer.
Why the training number is contaminated
The training examples were used to pick the model. Every adjustment during training was made to improve performance on exactly those examples, including adjustments that fitted their particular accidents. Real examples carry accidents: a measurement that is a little off, an unusual case, or two features that happen to line up in this sample and not in general. A flexible model fits all of it because fitting it improves the number being optimised, and nothing in the procedure distinguishes an accident from a pattern. That is why the training number is contaminated rather than merely optimistic. It is computed on the very data whose accidents were fitted, so it cannot separate pattern from accident. Asking the training number whether the model learned is like asking a student to mark their own paper against answers they wrote.
- error measured on the examples used to fit the model
- error on examples that played no part in fitting it
- the generalisation gap, which is how much of the training performance did not transfer
Reading the pair is the practical skill. A low training error with a wide gap means the model fitted the specific examples; the first response is to reduce freedom or add data. A high training error with a narrow gap means the model was too rigid to fit anything, and the gap is narrow only because there was nothing to lose; the first response is more freedom or better inputs. A low training error with a narrow gap is the target. A high training error with a wide gap usually means the measurement is broken, not the model. The two situations call for opposite responses, and the pair is the fastest way to tell them apart.
| Training error | Gap | Reading | First response |
|---|---|---|---|
| low | narrow | working | change nothing yet |
| low | wide | fitted the sample | less freedom or more data |
| high | narrow | too rigid or task hard | more freedom or better inputs |
| high | wide | setup or measurement is broken | check the measurement first |
What capacity and more data change
Capacity is the freedom to fit. Regularisation is a deliberate reduction of that freedom. More data makes an accident harder to fit reliably, because an accident does not repeat; less freedom removes the ability to fit it at all. Those two responses act on different causes, which is why a wide gap is not automatically a request for more examples. The lookup table shows the limit: adding examples leaves it perfect on the enlarged training set and still guessing on new ones, because its failure is in what the method does with data, not in how much data there is. If the model is merely flexible, more data or less freedom can narrow the gap. If the method memorises exactly, neither changes the new-example error.
The assumption that lets a measurement transfer
A held-out measurement is only informative if the held-out examples come from the same source as the training examples. Grant that and a sample can tell you about the population; deny it and a model fitted to the old process has no claim on the new one. This is why an honest held-out number can still fail in deployment: prices change, users change, the thing being measured changes, and sometimes the model itself changes the behaviour it is predicting. When the source moves, the old measurement stops being a promise, and more old examples do not repair it. No quantity of training examples repairs a source that has moved.
Worth keeping
- A perfect score on the training set is compatible with having learned nothing at all.
- The only informative number is performance on examples held out from the same source.
- More data does not fix a method whose failure is memorising rather than insufficient examples.
Where this goes next
This question is one step of Why Learning Works At All, a course that works through its subject from the beginning. The page that teaches this part of it is Memorising the Answer Sheet, and it reads the whole way through whether or not you have an account.
What an account changes is the practice: problems standing under every idea, marked with a reason rather than a tick, in a copy of the course that is yours.
Read that pageThe whole courseOther questions people ask about this
- Why does test error go down and then back up as I make the model more complicated?A more flexible model first removes its systematic miss, then starts fitting the noise in its particular training sample, so test error falls and then rises.
- Why does my test set stop being a fair test if I keep tuning on it?Because every time you use the test set to choose something, information from it shapes the model, so it stops being untouched and its score becomes optimistic.
- Why does adding a penalty on the weights stop overfitting?Adding a penalty makes large weights costly, so the fit keeps them only when the training data saves enough error to pay for them, which limits the settings the model can reach.
- What is the difference between variance and standard deviation?They measure the same spread: variance is the average squared distance from the mean, standard deviation is its square root, so you report the standard deviation and calculate with the variance.
- How do you make a vague claim precise enough to tell whether it's true?Fix what is being talked about, what is asserted, which cases are covered and the cut-off, then name an observation that would prove it false.
- How do you find the parabola that best fits a function near a point?Match the function's height, slope and bending at the chosen point; those three conditions single out exactly one parabola.