Skip to main content

The Lab · Learn

How AI actually works

Small pages that run on this device. Read the plain version, move the sliders, watch what changes, then say what you saw. Tap any word you do not know.

Lesson 10

Underfitting and overfitting

A model can be too simple to see the pattern, or so eager that it memorizes every quirk and mistake as if it mattered.

It is like
Like a student who crams last year’s exact exam answers. Perfect on that paper, lost on a new one.
Why it matters at work
A tool that looks perfect in the demo can fall apart on your real data. Always try it on cases it was not shown.
The exact idea

A model that is too simple misses the pattern, and one that is too flexible learns the noise as if it were pattern.

Words on this page

Try this

  1. Start at degree 1. The straight line misses the curve. That is underfitting.
  2. Move to degree 11. The curve passes through every point and the error on the points falls to almost zero.
  3. Turn on the real pattern at degree 11 and compare the two errors.

Change it

Ask for a button that adds fresh noisy points from the same pattern, drawn in a different shape.

At degree 11 the error on the points is almost zero. Why is that not a good model?

Pick the one that fits what you saw.

Field notes

Reading the notes.