Once the network can learn, the next questions are how to keep it from overfitting and how to make training behave reliably.
Training, development, and test sets
Machine learning is a highly iterative process
| Data size | Preferred split (Train/dev/test) |
|---|---|
| Millions | 99.5/0.4/0.1 |
| Small | 50/20/30 |
Make sure that the Train & dev/test data distributions are the same
For meaningful evaluations
Use dev set to evaluate and iterate models performance
Test set is only used to provide unbiased estimate of final model performance
Regularization
Used to prevent overfitting in machine learning models
L2 Norm is also called Euclidean norm/Frobenius norm
L2 regularization is also called 'weight decay'
L1 regularization adds absolute values of weight parameters, leading to many sparse(zero) weight vectors
Weight decay multiplies weights by value slightly less than one during each GD iteration
L2/Frobenius Norm:

New Backprop eq:




Dropout regularization

During training, dropout temporarily deactivates randomly selected units, so each pass uses a different subset of the network.
Dropout in neural networks mimics ensemble learning by training different subsets of nodes in each iteration. During testing, without dropout, it's like averaging outputs from all these subnetworks. This approach mirrors ensemble methods, where multiple models' outputs are combined for improved robustness. Essentially, dropout acts as an efficient way to train numerous networks sharing the same weights, providing ensemble-like benefits within a single network structure.
Inverted dropout
Illustrating with layer3 and Keep_prob = 0.8
keep_prob = 0.8
D3 = np.random.rand(*A3.shape) < keep_prob
A3 = A3 * D3 / keep_probNet activations during inference would be larger if we don’t use inverted dropout technique.

In normal dropout algorithm, during inference activations are multiplied by p to ensure that activations are not too high
Inverted dropout divides retained activations by keep_prob during training to preserve their expected scale. No dropout scaling is needed during inference.
Dropout has similar effect to L2 regularization
We can apply dropout to input layers aswell as set individual keep_probs for different layers to ensure that layers with high params are dropout more
Other regularization methods
- Data augmentation
- Early stopping

When dev set error begins to increase, stop the algorithm then
Regularization lambda hyperparameter ko change krk mein bar bar train krna prta, whereas idhr ek hi baari mein pta lg jaata