Mini-batch gradient descent

If there are 5M training examples, it is very costly to update weights after iterating every training example
5,000 mini-batches of 1,000 each
Epoch = single pass through the training set

| Mini batch size | Term |
|---|---|
| 1 | Stochastic gradient descent |
| 1<t<m | Mini-batch gradient descent |
| m | Batch gradient descent |
For training sets <2000 use batch gradient descent
Due to computer memory sizes, mini batches of size works really well
Exponentially weighted averages

If B = 0.9
Here vₜ is the exponentially weighted average of temperature.
If B = 0.98
If B = 0.5
We are smoothing the curve
We can decide who to give more weight to,
previous calculated value or current input value
Bias correction

We want to make sure that purple line doesn’t starts from 0
We do these calculations to ensure that purple line is altered into green line
Optimization geometry

These lines are called contour lines (level curves) of cost function
Each contour Line represent that cost function has the same value
Innermost circle represents minimum value of cost function
Gradient descent with momentum

β is the momentum hyperparameter.
B = 0.9 (preferred)
Momentum averages out the oscillations
Consider the analogy of ball moving rolling down the hill and we provide it
Friction, velocity and acceleration
RMSprop
We had to decrease the learning in vertical direction and speed up learning in horizontal direction in order for faster convergence

In directions where the gradients are smaller, such as horizontal direction with smaller dW, the change remains higher
In directions where the gradients are higher (oscillations), such as vertical direction in this example with higher db, the change remains slower
Adam optimization algorithm
Adaptive moment estimation
Combines exponential weighted average and RMS prop together

New hyperparameters:

Learning rate decay

Sometimes the cost noises around the minimum value, the steps can be noisy and the algorithm might never converge

So we decrease learning rate to ensure the algorithm learning rate is smaller when reaching center
Learning rate decay other formulaes:

Saddle points and plateaus

In high-dimensional spaces, true local optima are rare
However encountering saddle point is very common than a true local optima

Plateau is a region where gradient is nearly zero over a large area, causing learning process to slow down
Adam optimizer makes learning process accelerate through these plateaus