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