Deep Learning, Week 4: every "how many weight updates" question from the PYQs (Quiz-1 Sep'24 to Jan'26) and the Practice Assignment, solved step by step.
$N$ = number of training samples, $B$ = batch size, $E$ = number of epochs. One epoch is one full pass over the data, and one step is one parameter update.
| Algorithm | Updates per epoch | Total updates |
|---|---|---|
| Vanilla / Batch GD | $1$ | $E$ |
| Stochastic GD (SGD) | $N$ | $N \times E$ |
| Mini-batch GD | $N / B$ | $\dfrac{N}{B} \times E$ |
| Batch GD + line search | $1$ | $E$ |
A team has a data set that contains 20000 samples for training a feed-forward neural network. Suppose they used a mini-batch gradient descent algorithm with a batch size of 500 to update the weights. How many times do the weights get updated after training the network for 10 epochs?
Consider a network trained on a dataset of 5000 data points using mini-batch gradient descent with a batch size of 50. If the network is trained for 100 epochs, how many times does each parameter in the network get updated?
To learn the parameters of a neural network for a classification problem, mini-batch gradient descent is run on a dataset of size 1000 with a batch size of 25 for 10 epochs. Find the number of times each parameter is updated.
A team has a data set that contains 10000 samples for training a feed-forward neural network. Suppose they decided to use the stochastic gradient descent algorithm to update the weights. How many times do the weights get updated after training the network for 10 epochs?
A team has a data set that contains 10000 samples for training a feed-forward neural network. Suppose they decided to use the gradient descent algorithm to update the weights. Suppose further that they use a line search algorithm for the learning rate as follows: $\eta = [0.01, 0.1, 1, 2, 10]$. How many times do the weights get updated after training the network for 10 epochs? (Note: for each weight update, the absolute difference between the current loss and the loss at the previous epoch should be high.)
Consider a training set consisting of 12 samples. The vanilla gradient descent algorithm is used to update the model parameters over 4 epochs. The learning rate follows an exponential decay scheme given by $$\eta_t = 0.8\,\exp(-0.2t),$$ where the iteration index $t$ starts from zero and increments only when the parameters are updated. What is the value of the learning rate $\eta_t$ at the end of training? (Enter your answer up to 3 decimal places. For example, if your answer is 0.12345, enter 0.123.)