AI Logic

Glossary

Overfitting

Updated:

Graph with epochs (time spent training) on the horizontal axis and loss on the vertical axis. The training loss keeps decreasing until the end. The validation loss reaches its lowest point around epoch 40; to the left of that point both losses decrease, and the shaded region to the right is the overfitting region, where the training loss decreases while the validation loss rises. At the right edge, an arrow marks the gap between the two curves, labeled as worse performance on unseen data.

Explanation

Overfitting is a phenomenon in which a machine learning model performs well on its training data but performs worse on unseen test data. The main cause is that the model learns the noise and peculiarities of the training data too closely, which impairs its ability to generalize. Overfitting is especially likely when the model is too complex, when there is not enough training data, or when training runs for too long. Theoretically, overfitting is defined as the state in which "the model adapts too closely to the training data and loses its ability to generalize," and it is an important consideration in understanding the performance of machine learning models. Preventing overfitting therefore requires keeping model complexity in check and securing sufficient training data.

Where It Is Used

Various methods are effective for preventing overfitting. First, regularization can be used to restrain model complexity. Specifically, applying L1 or L2 regularization limits the magnitude of the model's weights and maintains an appropriate level of expressive power. Data augmentation, which artificially increases the training data, also makes the model more robust to various kinds of variation. Early stopping is another effective technique: it suppresses overfitting by halting training once performance on the validation data stops improving. It is also important to avoid excessive fitting by evaluating the model's generalization performance on a validation set and simplifying the model. By taking these measures, overfitting can be kept in check and the performance of machine learning models can be maximized.

FAQ

Q. Why does overfitting happen?
A.

When the model is too complex, the data is too scarce, or training runs for too long, the model learns the characteristics of the training data too closely.

Q. How can it be prevented?
A.

Effective countermeasures include regularization, data augmentation, early stopping, making use of validation data, and simplifying the model.

Q. What are the signs of overfitting?
A.

Overfitting is suspected when accuracy on the training data is high but accuracy on the validation or test data is low.