Gradient Descent
Gradient descent tries to lower a function by repeatedly changing its inputs. The gradient points toward the steepest local increase, so the update moves in the opposite direction. The learning rate controls how far it moves.
Notes
Take a downhill step
Choose a starting point and a positive learning rate . At step , evaluate the gradient of the objective at the current point. The gradient contains one partial derivative per parameter. Subtracting the scaled gradient uses those slopes to propose the next point. Open Downhill step and identify which part gives the direction and which part controls distance.
Try the same slope with different step sizes
Switch to One-dimensional update and use with . The derivative is , so the update is . With , the first two steps go from to to . With , the first two steps go from to to . The second route crosses the minimum on every step, and both routes halve the distance to it.
Now try . The points alternate between and , and the objective stays at . A direction that points downhill at the starting point can still lead to a poor result when you take a large step.
Compute the gradient from a sample
For an objective that averages losses over a dataset, the full gradient uses every example. The Single-example stochastic update picks one example and uses its gradient instead. With uniform sampling, the average of these possible gradients at a fixed point equals the full gradient. Individual steps can move the full objective up or down. The amount of work saved per step depends on the cost of evaluating each example.
Sources
- Convex Optimization, §9.3, Gradient descent method — Stephen Boyd and Lieven Vandenberghe (2004)Derives the negative-gradient direction and discusses step size selection.
- CS231n Lecture 4, Optimization (2015)Introduces single-example and minibatch stochastic gradient descent.
Merch
Creating your shirt…