Deep Learning · TEE · section
Model answer: generalization and early stopping
Regularization and generalization
Question
Question. Distinguish underfitting and overfitting. Explain how validation data and early stopping help control overfitting.
Answer — step by step
Underfitting occurs when a model has not captured enough useful structure in the training data. Both training and validation errors are usually high relative to a sensible task baseline. Causes can include insufficient capacity, inadequate features, excessive regularization or incomplete optimization.
Overfitting occurs when a model fits training-specific details or noise that do not generalize. Training error is low while validation error is substantially higher. A mismatch between training and validation data can produce a similar gap, so the split must also be examined.
How early stopping works
1. Train using the training set; do not learn parameters from the validation targets as training samples.
2. After an epoch or another chosen interval, evaluate validation loss.
3. Save the parameters whenever validation loss reaches a new best value.
4. Count consecutive intervals with no qualifying improvement.
5. When the count reaches the chosen patience, stop and restore the saved best parameters.
For validation losses 0.8, 0.6, 0.5, 0.53 and 0.55, epoch 3 is best. With patience 2, epochs 4 and 5 supply two non-improvements: stop after epoch 5 and restore epoch 3. The stopping epoch and the retained model epoch are different.
Other remedies for overfitting include appropriate L1/L2 penalties, dropout, augmentation and more representative training data. Underfitting may instead require a better model, adequate training or less regularization. Use the test set for final evaluation after those choices, not for repeatedly choosing the stopping point.