# R23 Q7b

Subject: Deep Learning

Exam: TEE

Reader: https://deep-learning-study-room.vercel.app/#tee/read/16/tee-c16-s16

Canonical: https://deep-learning-study-room.vercel.app/read/dl/tee/section/tee-c16-s16/

## Question

**Question (10 marks).** Training performance is good but unseen-data performance degrades. Identify the issue and explain ways to improve it.

## Answer — step by step

Overfitting means learning training-specific patterns that do not generalize well. Very good training results with substantially worse validation results suggest overfitting, provided both sets are comparable and correctly evaluated. Regularization limits this tendency; its strength should be chosen using validation data.



$$
J_{L1}=L+\lambda\sum_j|w_j|,\qquad J_{L2}=L+\frac{\lambda}{2}\sum_jw_j^2
$$



L1 adds a magnitude penalty and can make weights exactly zero at the optimum, encouraging sparsity. Away from zero its added gradient is λ sign(w). L2 adds gradient λw under the displayed convention and smoothly discourages large weights. L2 generally shrinks many weights without making them exactly zero. Some notes omit the half in L2; their added gradient is 2 λw.

Dropout randomly removes selected activations during training, reducing dependence on a particular combination of units. With inverted dropout, retained units are divided by the keep probability q; at inference dropout is disabled and the ordinary network is used. Early stopping monitors validation loss and restores the best validation checkpoint before prolonged fitting to training noise. Data augmentation creates label-preserving input variations. Too much regularization may underfit: both training and validation performance can then worsen.

A comparable-distribution train/unseen gap suggests overfitting. Also check whether the new data have shifted, preprocessing differs or labels are inconsistent. Select regularization using validation performance, not final-test tuning. Improvement must be demonstrated on representative held-out examples.
