Take one gradient descent step on a parabola

Check signs and decimal points before moving to the next value. · 168 words

Gradient descent updates a parameter by moving opposite the gradient, or slope, of an objective function. The objective is the loss to reduce, and the learning rate controls the step size. For a concrete parabola, let J(theta) = (theta - 3)^2. Start at theta = 1 with learning rate 0.1. The derivative is J'(theta) = 2(theta - 3), so the gradient at 1 is -4. The update is theta_new = theta - learning_rate * gradient = 1 - 0.1(-4) = 1.4. This moves toward 3, the minimum. The loss falls from 4 to 2.56.

For another check, let J(theta) = (theta - 2)^2, start at theta = 5, and use learning rate 0.2. The gradient is 2(theta - 2), which equals 6. Therefore theta_new = 5 - 0.2(6) = 4.2, moving left toward the minimizing value 2. The objective changes from 9 to (4.2 - 2)^2 = 4.84. A learning rate that is too large can overshoot the minimum, while one that is too small makes learning slow.

Check your recall

For J(theta) = (theta - 3)^2, starting at theta = 1 with learning rate 0.1, what is the parameter after one gradient descent step?

Check your answer

The gradient is 2(1 - 3) = -4, so theta_new = 1 - 0.1(-4) = 1.4.

Sources and credits

Original KeyTouch lesson. Background reading · Google · Linear regression.