Stochastic updates are applied one after another. This lesson shows s2 first, then recomputes the s3 gradient from the newly updated parameters.

highlighted = computed this step

First update uses s2

Start at a=0, b=1. For sample s2, the prediction is 1, the residual is -1, and the gradient is (-1, -1). The update lands at (1/2, 3/2).

s2:(a,b)=(0,1)(1/2,3/2)s2:\quad (a,b)=(0,1) \rightarrow (1/2,3/2)
Two Stochastic Updates in OrderSecond gradient recomputed after the first update.ordered stochastic updates; eta=1/2stepsamplestart (a,b)predictionresidualgradientnew (a,b)1s2(0,1)1-1(-1,-1)(1/2,3/2)2s3(1/2,3/2)7/23/2(3/2,3)(-1/4,0)second gradient is recomputed at the new parametersnew = old - eta*gradientone exact step only; sample is chosen before the update; NOT convergence; NOT generalization;NOT learning

Second update starts from the new line

Now the start is a=1/2, b=3/2. For sample s3, the prediction is recomputed as 7/2, the residual is 3/2, and the gradient is (3/2, 3).

s3:y^=7/2,g=(3/2,3)s3:\quad \hat y=7/2,\quad g=(3/2,3)
Two Stochastic Updates in OrderSecond gradient recomputed after the first update.ordered stochastic updates; eta=1/2stepsamplestart (a,b)predictionresidualgradientnew (a,b)1s2(0,1)1-1(-1,-1)(1/2,3/2)2s3(1/2,3/2)7/23/2(3/2,3)(-1/4,0)second gradient is recomputed at the new parametersnew = old - eta*gradientone exact step only; sample is chosen before the update; NOT convergence; NOT generalization;NOT learning

The order matters in the arithmetic

Applying the second update gives (a,b)=(-1/4, 0). The second gradient is recomputed at the new parameters; it is not reused from the starting line.

(a,b)after s3=(1/4,0)(a,b)_{\text{after }s3}=(-1/4,0)
Two Stochastic Updates in OrderSecond gradient recomputed after the first update.ordered stochastic updates; eta=1/2stepsamplestart (a,b)predictionresidualgradientnew (a,b)1s2(0,1)1-1(-1,-1)(1/2,3/2)2s3(1/2,3/2)7/23/2(3/2,3)(-1/4,0)second gradient is recomputed at the new parametersnew = old - eta*gradientone exact step only; sample is chosen before the update; NOT convergence; NOT generalization;NOT learning