좋은 모델은 새로운 input data 를 적절히 일반화하여 future data 에 대한 예측을 돕는다. 하지만 이와 반대로 machine learning 에서 모델의 성능을 저하시키는 주요한 원인으로는 underfitting 과 overfitting 이 존재한다. 이번 글에서는 이 두 경우에 대해 자세히 알아보자.
Underfitting 과 overfitting 을 설명하기에 앞서 우선 bias 와 variance 를 이해해야 한다.
- Bias: The error due to overly simplistic assumptions in the learning algorithm.
- Variance: The error due to the model’s sensitivity to fluctuations in training data.

Machine learning 에서 bias 는 모델이 input 과 output 의 관계를 나타내지 못해 발생하는 반면, variance 는 모델이 너무 정확하여 데이터의 underlying pattern 이나 complexities 대신 noise 나 random fluctuations 를 학습하기 때문에 일어난다. 그렇다면 당연하게도 bias 는 underfitting 으로, variance 는 overfitting 으로 이어지게 된다.

Underfitted model is unable to capture the relationship between the input and output variables accurately, generating a high error rate on both the training set and unseen data.
Underfitting 이라고 함은 단어 그대로 모델이 train set 을 적절히 학습하지 못해 오히려 test set 보다도 score 가 더 낮게 나오는 경우이다. 즉, training 당시 우리의 모델은 input 과 output variables 의 관계를 제대로 파악하지 못했기 때문에 특히 새로운 데이터들에 대해 매우 부정확한 결과를 출력한다. 참고로 이런 경우 train set 보다도 test set 에 대한 점수가 더 높은 경우를 보이는데, 이는 우연일 확률이 높다.
Note: An underfitted model has high bias and low variance.
| Reasons for underfitting | Solutions |
|---|---|
| Too simplistic model | Increase model complexity |
| Inadequate or unscaled feature representations | Perform feature engineering |
| Insufficient training data | Increase the number of features or the number of epochs |
| Excessive regularization | Reduce regularization |
Overfitting occurs when the machine learning model gives accurate predictions for training data but not for new data.
이와 반대로 overfitting 은 train set 에 너무 의존하여 새로운 데이터가 주어졌을 때 예측을 제대로 하지 못하는 경우이다. 따라서, train set 의 score 가 test set 에 비해 더 높은 것을 확인할 수 있다.
Note: An overfitted model has low bias and high variance.
| Reasons for overfitting | Solutions |
|---|---|
| Too complex model | Reduce model complexity |
| Inadequate feature representations | Remove noise |
| Insufficient training data | Increase the number of features or the number of epochs |
| Insufficient regularization | Ridge or Lasso regularization, Dropout, Early stopping |
