One Pass, Three Ways

OptimizersMedium+20 XP+20

One Pass, Three Ways

A model has a single weight www and four training examples with targets

x=1, 3, 5, 7x = 1,\ 3,\ 5,\ 7x=1, 3, 5, 7

Each example's loss is 12(w−xi)2\tfrac12 (w - x_i)^221​(w−xi​)2, so its gradient is w−xiw - x_iw−xi​. A batch's gradient is the average of its examples' gradients. The best www for the whole dataset is the mean target, 444.

The examples are stored, and fed, in exactly the order 1,3,5,71, 3, 5, 71,3,5,7, with no shuffling. Starting from w=0w = 0w=0 with a learning rate of 0.50.50.5, you make one pass through the data with each of three batch sizes:

schemebatches, in order
full batch{1,3,5,7}\{1, 3, 5, 7\}{1,3,5,7}
mini-batch of 2{1,3}\{1, 3\}{1,3}, then {5,7}\{5, 7\}{5,7}
stochastic{1}\{1\}{1}, then {3}\{3\}{3}, then {5}\{5\}{5}, then {7}\{7\}{7}

Every update uses the gradient at the current value of www, recomputed after the previous update.

Where does www end up after the one pass, for each scheme?

Hints

Solve it to unlock the solution

Once you get it right, the reasoning behind the answer shows up here.

Select all that apply.