Lesson 2.3 · 8 min read · about 50 min to master at a very slow pace
Underfitting and Overfitting
Too simple and a model misses the pattern; too flexible and it memorises noise. How to recognise each from training and validation errors, and what to do about it.
Three fits to the same data
The overfit curve has zero training error: it passes through every point. Yet between and beyond the points it is wild, so its predictions for new data are poor.
The diagnosis table
| Training error | Error on unseen data | Story | |
|---|---|---|---|
| Underfitting | High | High | Model too simple to capture the real pattern (high bias) |
| Good fit | Low-ish | Similar, low | Captures repeatable structure |
| Overfitting | Very low | Much higher | Fits noise and quirks of this sample (high variance) |
The U-shaped curve
What to do
| If you see... | Try |
|---|---|
| Underfitting | A more flexible model, better features (e.g. , interactions), less regularisation |
| Overfitting | More training data, a simpler model, fewer features, regularisation (Section 5), cross-validation to tune complexity |
Training error can't choose complexity
Training error always prefers the most complex model: a degree-10 polynomial always fits the training data at least as well as a degree-1 line. Use validation data or cross-validation instead.
Stuck? Common doubts
Questions real learners asked while studying this lesson. They stay closed so they don't spoil your own thinking: open only the ones you need.
Going deeperHow do I read training, validation and test results together?
- Training high, validation low → possible overfitting.
- Training and validation high, test low → possible distribution shift, a preprocessing inconsistency, or another evaluation problem (see lesson 2.4).
- All three low → possible underfitting.
"High" and "low" here refer to performance (accuracy), not error.
Cheatsheet
Diagnose from errors
Training error picks complexity
Check your understanding
Score 75% or more to master this lesson and earn XP. Answer first, then check.