The straight line misses most café days by a few drinks. A bendier rule can do better. In fact, with enough bends it can pass through every single point: a training error of zero. Is that the best model?
A degree-1 rule is a line; degree 2 can bend once; degree 11 can bend enough to visit all 12 days. Slide the bendiness up and watch the training gaps shrink to nothing.
Eight new days come in, drawn as hollow circles. The zero-error rule was never told about them. Look at the gaps now: between the days it memorised, the rule swings wildly, and the new days land in the swings.
Sweep the bendiness from 1 to 11 and keep both scores. The training score only ever improves. The score on new days improves a little, then turns around and climbs off the chart. There is a sweet spot, and it is nowhere near zero training error.
Pick the bendiness and choose how many days the café had recorded. With fewer days a bendy rule can memorise them all even sooner, and the new-day score gets worse faster. More data is the cheapest cure for a rule that bends too much.
A rule that fits its training days better than the world is *overfitting*: it has memorised noise instead of learning the pattern. The cure is to keep some days hidden, the *test set*, and trust only the score on those. Every serious AI result you read is a score on data the model never trained on.
Someone shows you a model with a perfect score.
The training score kept falling all the way to degree 11 while the new-day score turned around at degree 3. The training score simply cannot see the difference between learning the pattern and memorising the points; a held-out set can.