learning-it by example

Back to the video

Overfitting You Can See: Train vs Validation Error

Degree 14 had a training error of 0.00 and a validation error of 3.27.

Video #184 ยท Machine learning and data science

Steps in the video

  1. 0:00 Training error 0.00, validation error 3.27
  2. 0:35 The idea
  3. 1:10 Setup
  4. 1:30 The made-up data
  5. 1:58 Fit and score each degree
  6. 2:30 Bars you can read
  7. 2:47 The run
  8. 3:53 What this does not show
  9. 4:26 Mistakes to avoid
  10. 4:56 My take and next steps
  11. 5:26 Recap

Files

  • curves.py (24 lines)
  • data.py (15 lines)
  • run.py (15 lines)

Download the code (zip)

Tested with

Python 3.12.15 | numpy==2.5.4

What this does not show

Made-up points from a known curve, one train and validation split, and no separate test set.

Sources

Learning IT by Example.