| Rank | Hyperparameter tuning priority |
|---|---|
| 1 | Learning rate |
| 2 | Momentum term |
| 3 | Mini batch size |
| 4 | Hidden units |
| 5 | # layers |
| 6 | Learning rate decay |
| 7 | Beta1, Beta2, epsilon |
Grid and random search
- Traditional sampling: earlier ML algorithms sampled hyperparameters in a grid format, all combinations in the grid were tried
- Random sampling: choosing hyper parameter combinations randomly, start with a broad range(coarse sampling). Once you identify a promising region, zoom in and sample more densely within that region(fine sampling)

Sampling learning rate
Use logarithmic scale, consider values like 0.0001, 0.001, 0.01, 0.1, 1 and sample randomly on this log scale
r = -4 * np.random.rand() [-4, 0]
alpha =
Sampling the averaging parameter β
When beta is near 1, even minor variations can have significant impacts
Shifting beta from 0.9 to 0.9005 has minimal effect
Shifting from 0.999 to 0.9995 drastically changes the results
1/(1-beta) is highly sensitive to minor changes in beta when its near 1
So you can sample more densely when closer to 1

Batch normalization
When training models like logistic regression, it’s widely known that normalizing the input features can speed up learning
"Can we normalize activations from any hidden layer to optimize the training of subsequent parameters?”
For each hidden layer, compute mean and variance of layer's activation
Normalize these activations to have zero mean and unit variance
After normalization, scale and shift values using learnable parameters γ and β


Traditional NN uses weights and biases, Batch norm too uses weights and biases, but replaces biases b with beta β and γ, which are learned during training
Update W using standard backprop
Learn β and γ using derivatives Dβ and Dγ derived from cost function
Update these parameters too using any optimizer
Why batch norm works
- Feature scaling accelerates the learning process
- DNNs can be sensitive to changes in weights in earlier layers, which might impact weights in subsequent layers. Batch norm makes the deeper layers less sensitive to such changes
Covariate shift: when distribution of model's input features in production changes compared to what model has seen during training and validation, this makes model perform not optimally
As weights in earlier layer change, values to subsequent layers also change, leading to an internal covariate shift
Regularization effect: An additional benefit of batch norm is its slight regularization effect. As batch norm computes mean and variance based on mini-batches, there’s inherent noise in the values, somewhat similar to the noise added by the dropout technique. This noise prevents over-reliance on any single hidden unit, which aids in regularization. However, the main purpose of batch norm isn’t regularization; it’s to normalize activations and speed up learning
Handling data during testing: Batch norm processes data in mini-batches, computing mean and variances accordingly. But when making predictions (especially for single data points),
use a running average of μ and computed during training.
Deep learning frameworks

Criteria of choosing framework
- Ease of programming
- Running speed
- Truly open with a trust that they'll remain opensource