What is Overfitting?
Overfitting happens when a model memorizes its training data instead of learning general patterns, hurting performance on new data.
Overfitting happens when a machine learning model learns the training data too well — including its noise and quirks — instead of the general pattern. It scores great on data it has seen but fails on new, unseen data. It's like memorizing exam answers without understanding the subject.
How to Spot It:
- Training accuracy is high, but validation/test accuracy is much lower
- The model is very sensitive to small changes in input
- Performance degrades badly on real-world data
Common Causes:
- Too complex a model for the amount of data
- Too little training data
- Training too long without checks
- Noisy or unrepresentative data
How to Prevent It:
- More data: Or data augmentation to simulate more
- Regularization: Penalize complexity (L1/L2, dropout)
- Cross-validation: Test on multiple splits
- Early stopping: Halt training when validation stops improving
- Simpler models: Reduce parameters or features
FAQ
What is the opposite of overfitting?
Underfitting — when a model is too simple to capture the pattern and performs poorly on both training and test data.
How do I know if my model overfits?
Compare training and validation performance. A large gap, with training much better than validation, is the classic sign of overfitting.