Before you readYou know the slope of your loss where you are now, but not where its minimum is. Which way should you step?
Watch: Gradient Descent, Step-by-Step · StatQuest with Josh Starmer
Gradient descent takes a step against the gradient of the loss J, then recomputes the gradient at the new point:
θt+1=θt−η∇J(θt).
The gradient points in the direction of steepest increase, so the minus sign sends you downhill for a small enough step. The learning rateη>0 scales the step. Too small and progress is slow; too large and you can overshoot or even move farther from the minimum on every step.
x = -0.39Loss = 0.15
Start at x = 1.8 on the loss curve J(x) = x². The larger dot is your latest step. Try rates of 0.10, 0.50 and 1.10: when do you approach, land on or move away from the minimum?
A loss is convex if the line segment between any two points on its graph lies on or above the graph. For a differentiable convex loss on Rd, a zero gradient is enough to identify a global minimum. For a non-convex loss, a zero gradient could instead mark a local minimum, a maximum or a saddle.
For example, J(x)=∑i=1n(x−yi)2 is convex. Setting J′(x)=2(nx−∑iyi) to zero gives x=n1∑iyi: the mean is the best constant prediction under squared loss. Here you can solve for it directly; gradient descent is useful when that shortcut is unavailable.
Recall
Which direction does gradient descent move, and what scales the step?
Recall
For a differentiable convex loss on Rd, what does a zero gradient tell you?
Exercise
For J(x)=x2, start at x0=2 and take one gradient descent step with η=0.75. What is x1?