ContentsChapter 4 · Regression3 of 4

4.3

Overfitting and bias–variance

In this chapter
  1. 4.1Least squares
  2. 4.2Basis functions
  3. 4.3Overfitting and bias–variance
  4. 4.4Regularisation
Before you readIf a curve hits every training point, what could still make it a bad fit?
Watch: Machine Learning Fundamentals: Bias and Variance · StatQuest with Josh Starmer

Training error measures predictions on the data used to fit the model. Test error measures predictions on held-out data. A model overfits when it learns noise in the training set instead of the underlying pattern, so a low training error can hide a high test error.

At a fixed input, the expected squared prediction error splits into:

bias2+variance+σ2.\text{bias}^2 + \text{variance} + \sigma^2.

To pick a polynomial degree with kk-fold cross-validation, split the training set into kk folds and fit each candidate degree kk times, validating on a different fold each time and training on the rest. Pick the degree with the lowest mean validation error, refit on the whole training set and reserve the test set for final evaluation.

-4-2024-1-0.500.51
00.511.50123456789
Train MSE = 0.03Test MSE = 0.01
Filled points train the model; hollow points test it. Below, training MSE is solid and test MSE is dashed. Try degree 9: the training error falls to zero, but the test error rises.
Recall
What can low training error and high test error indicate?
Recall
What are the three terms in expected squared prediction error?
Recall
In one round of kk-fold cross-validation, which data fit the model?
Exercise
At one input, the bias is −2-2 the variance is 33 and the noise variance is 1.51.5 What is the expected squared prediction error?
Exercise
Which pair of errors most strongly suggests overfitting?