38. Overfitting and Underfitting in Machine Learning
38.1 Too Fit vs Too Weak
Why. A notebook can look brilliant on training rows and fail on next week’s live orders. That gap has names: overfitting and underfitting.
What. Overfitting = the model memorised training noise (“too fit”). Underfitting = the model is too weak to catch the real pattern (“too simple”). Both hurt new rows.
How.
Picture two students
- Overfit student: memorises last year’s exact MCQs, blanks on new wording.
- Underfit student: only learned “always tick option B.”
- Good student: learns patterns that still work on a fresh question paper (test set).
print("Overfit: train score >> test score")
print("Underfit: train and test scores both weak")
print("Healthy: both decent, gap not huge")
Ravindra Bagale's Tip
Training accuracy 100% pahun khush bilkul nako — test bagha.