Overfitting.

A more flexible curve can always fit the data it was trained on more closely. Whether it predicts new data better is a different question. The dark dots are twelve students the curve is fitted to; new students show how it does on data it has not seen.

From Chapter 4: Generalization, which explains these figures step by step.

Figure

How flexible should the curve be?

3 h, score 453.1 h, score 503.9 h, score 585 h, score 755.5 h, score 675.9 h, score 756.6 h, score 697.3 h, score 808.5 h, score 788.6 h, score 749.7 h, score 7010.2 h, score 65
  • Students used for fitting
  • Fitted curve
Flexibility
degree 1: straight line
Error on fitted students
66.2
Error on new students
hidden
1
The dark dots are the twelve students used for fitting. Try it: raise the degree one step at a time and watch the error on the fitted students. At degree 9, press the button to show twenty new students.
Figure

Two errors, two stories

2, 11.922, 28.83new studentsfitted students
  • Error on fitted students
  • Error on new students
Degree
2
Fitted students
11.9
New students
28.8
Verdict
About right
2
The dark line is the error on the twelve fitted students. The orange line is the error on twenty new ones. Try it: move the slider from 1 to 9 and read the verdict at each step. Find where the two lines are closest.

Learn the ideas behind it

More playgrounds

Search

    The Book of Machine Learning
    Search
    Reading settings
    Text size
    Colours

    Saved in this browser only.

    Keyboard shortcuts
    /
    Search the book
    ← →
    Previous and next chapter
    g
    Glossary
    c
    Table of contents
    e
    Jump to the exercises
    t
    Reading settings
    ?
    Show this list
    Esc
    Close a window or pop-in