Overfitting: Why a Perfect Explanation is Often Useless

Have you ever had this experience: you study for an exam by grinding through practice questions, and your performance improves at first, only to get worse as you do more? This phenomenon is rooted in a profound concept called Overfitting. This interactive page will let you experience it firsthand and understand why "simplicity is the ultimate sophistication" is not just a philosophical idea but a core principle of data science.

1. Data Fitting Lab: From Underfitting to Overfitting

True Function
Observed Data
Model Prediction
Diagnosis: —

Training MSE (on Observed Data)

Generalization MSE (on True Function)

Parameters

3
10^-2
1.8
12
Hint: With 12 data points, an 11th-degree polynomial can pass through every point perfectly.
View Coefficients & Complexity (L2 Norm)

Concepts & Guide

How to Use:

  1. Feel Complexity: Set "Regularization Strength λ" to its minimum, then slowly drag the "Polynomial Degree" slider from 0 to 11.
  2. Observe Overfitting: As the degree increases, the "Training MSE" drops, but the curve becomes wildly distorted, causing the "Generalization MSE" to skyrocket.
  3. Feel Regularization: At a high degree, increasing λ will "pull" the curve back to a smoother, simpler shape.
  4. Understand Occam's Razor: Among multiple explanations, choose the simplest one (e.g., a 3rd-degree polynomial), as it often generalizes better.

True function on this page:
f(x) = 15 + 10·sin(2π·(x-3)/12)

2. The "Find the Pattern" Quiz

The core of overfitting is ignoring "complexity". The answers to the following questions are rooted in psychology, not pure mathematics.

Question A: 1, 3, 5, 7, ?

Question B: 2, 4, 8, 16, 31, ?

Hint: View the full sequence

The full sequence for n=1 to 8 is: 1, 2, 4, 8, 16, 31, 57, 99

3. Overfitting in Life & Takeaways


Learning Principles