Overfitting vs Underfitting Demo

Visualize how model complexity affects bias, variance, and generalization

Overview

The Overfitting vs Underfitting Demo illustrates the fundamental machine learning trade-off between model complexity and generalization. Adjust polynomial degree to see how models that are too simple (underfit) or too complex (overfit) perform poorly on test data compared to well-balanced models.

Tips

  1. Start with degree 1 (linear) and gradually increase to see the progression from underfitting to good fit to overfitting
  2. Compare training vs test errors - a large gap indicates overfitting, while both being high suggests underfitting
  3. Try degree 10+ on simple data to clearly see overfitting behavior with wild oscillations between points
  4. Use the preset patterns (linear, quadratic, sinusoidal) to understand how the right complexity depends on the underlying data pattern
  5. Add noise to the data and observe how overfitting becomes more problematic as the model tries to fit random variations