Overfitting and underfitting are the two most common reasons a model fails on new data. Every data science interview asks about them.
Underfitting
The model is too simple to capture the pattern. It does badly on the training data and on the test data. A straight line fitted to a clearly curved pattern is an example.
Overfitting
The model learns the training data too closely, including its noise. It does very well on training data and badly on new data. A model that memorises answers instead of learning the rule is an example.
How to spot them
Compare the training score with the test score. Both low means underfitting. A high training score with a much lower test score means overfitting.
How to fix them
- Underfitting: use a more flexible model or add useful features.
- Overfitting: use more data, a simpler model, or regularisation, and check with cross-validation.
Next step: see our data science course at ScholarLogic, or book a free demo class. A counsellor will share the fee and the next batch dates.
