Input normalization
Steps
- Zero centering: Subtract mean from all training sample to ensure mean is 0
- Normalize variances: normalize data by dividing each feature by its standard deviation

Vanishing and exploding gradients
When gradients(derivates) become extremely large(exploding) or extremely small(vanishing), making it impossible for the network to converge to solution


Solution:
Initialize weights with a scale suited to the activation function and layer width.
Weight initialization
W = np.random.randn(n_out, n_in) * np.sqrt(2 / n_in)Where n is the number of neurons in layer l-1
For ReLU, He initialization uses a standard deviation of √(2/n_in).
For Tanh activations use
Gradient checking
Is a technique used to verify if gradients calculated by backprop are correct
Idea is to approximate graident of each param by tweaking it slightly and observing change in cost function. The computed gradient and this approximation should be close it backprop is implemented correctly
Flatten W₁, b₁, …, Wₗ, bₗ into a parameter vector θ, and their derivatives dW₁, db₁, …, dWₗ, dbₗ into dθ.


Implementation details
- Don’t use in training, only use in debugging
- If algorithm fails grad check, look at components to try to identify bug
- Remember if you are currently using regularization
- Disable dropout while checking gradients so the numerical and analytical calculations use the same network.
- Run at random intilizations, perhaps again after some training