The main idea of gradient descent for minimizing a function is to move in the direction of the negative gradient. In order to be useful as an algorithm, a stopping condition is also required. Ideally, the algorithm would stop at a local minimum, but the algorithm cannot directly observe when it is at the local minimum. Instead, the algorithm should stop updating when the gains from updating or the gradient becomes sufficiently small.
Gradient descent updates its estimate of the minimum according to a parameter . Specifically, if
is the algorithm’s estimate of the minimum at time
, then the algorithm updates itself using
Using this update, when the algorithm gets close to the minimum, it may jump past the minimum, then follow the gradient and jump back to its estimate from the previous step. Because of this, is often decreased as the algorithm runs. This continues to run until the differences between successive steps is within some margin of error
For general functions, this technique isn’t guaranteed to find the global minimum, nor will any algorithm which doesn’t query every possible input for the function. It’s always possible that some unqueried region contains the minimum. To account for this case, we will assume that the function we are trying to minimize is convex. This means that the entire function sits on or above the tangent line or plane at any point. More precisely:
A function is convex if for any two points
,
For any convex function, a local minimum must also be the global minimum (since at any minimum , the gradient is 0, so applying the above definition yields
for any point
in the domain, implying
is the global minimum).
Another characteristic of convex functions is that, if a function is twice differentiable, then
is convex if and only if the second derivative of
is always nonnegative (since
and
, and since
,
and so
).
The concept of the second derivative being positive can be generalized to higher dimensions: the Hessian (matrix of second-order partial derivatives of the function) is Positive SemiDefinite (PSD), meaning that all eigenvalues are nonnegative (positive semidefinite is a generalization of being nonnegative to matrices). Equivalently, a matrix (in this case
) is PSD iff for all
,
.
Another problem that affects gradient descent algorithm is the possibility of overshooting the minimum and ending up relatively far up a particularly steep section of the function. In order to avoid this, a second assumption is made: that the gradient is bounded (, where
is the bound on the gradient). Then, some bounds can be put on the performance of the algorithm. Let
be a minimum. Then,
If (meaning the algorithm will continue), then this is also
. Then, to maximize the reduction in
, set
. Furthermore, if the domain is finite and of diameter
(meaning for any pair of points
in the domain,
), then the maximum number of iterations the algorithm can take is
. We can either output the point with the minimum function value among all the points encountered, or stop when the norm of the gradient is at most
and output the last point.
The concept of convexity can also be refined. While convex functions have a nonnegative Hessian, a strongly convex function has a strictly positive Hessian. A function is
-strongly convex if, for all
in the domain,
. From this,
being
-strongly convex implies that
.
An proof of the above fact follows from the intermediate value theorem: For any there exists a
s.t.
(Why?)
At the end of the lecture, we saw a second variant of gradient descent. This algorithm operates by repeatedly finding a scalar such that
is minimized, then updating the current
value by
until
. We will analyze this algorithm in the next lecture.