TL;DR
- Gradient = vector of partial derivatives; points in the direction of steepest ascent. At a minimum of a differentiable function: .
- Two gradients to know by heart: and .
- Gradient descent: . SGD uses the gradient of one random data point.
- Convex: every local minimum is global. -strongly convex: curved at least like , unique minimizer. -Lipschitz: (slope at most ). -smooth: the gradient is -Lipschitz.
- Logs: , , ; is AdaBoostβs vote.
Derivatives and the chain rule
| for (not differentiable at 0) | |
| (ReLU, hinge) | 0 for , 1 for |
Chain rule: . Example: .
Minimizing a one-dimensional function
: . The "" (a ridge penalty) pulls the minimizer from 3 towards 0.
Gradients
Gradient
For : . It points in the direction of steepest increase; is the direction of steepest descent.
Gradients used in the course
- .
- .
- .
- for symmetric .
Setting gives the normal equations . For ridge, gives (L5).
Gradient descent and SGD
Update rules
- GD: with step size (learning rate) .
- SGD: pick a random data point and use instead of the full gradient.
- Least squares: .
Where it appears: the perceptron is SGD on the linear loss (L2); stability of GD and SGD (L4); implicit regularization of GD (L8).
Memory aid
βWalk downhillβ: minus the gradient, times a step size. Too large a step overshoots ( can diverge), too small is slow.
Convexity, Lipschitz, smoothness
Convex
is convex if the line between two points of its graph lies above the graph: for . Equivalent for twice differentiable : (Hessian PSD). Every local minimum is a global minimum.
Examples: , , , hinge , logistic are convex; the 0-1 loss is not, which is why surrogate losses are used.
Strongly convex, Lipschitz, smooth
- -strongly convex: is still convex; the function curves up at least like a parabola with curvature . Example: is -strongly convex. Consequence: a unique minimizer.
- -Lipschitz: ; for differentiable the same as . Example: hinge and logistic loss are 1-Lipschitz in the score, the squared loss is not (on an unbounded domain).
- -smooth: the gradient is -Lipschitz, : no sharp kinks.
Where it appears: stability of ERM with strongly convex losses and of regularized ERM (L4, L5); Lipschitz constant as robustness measure (L8).
Memory aid
Lipschitz = speed limit (the function cannot change faster than ). Strongly convex = bowl (the minimum is sharp and unique, so one changed data point moves it only a little: stability). Smooth = no kinks (the slope changes slowly, so gradient steps are safe).
Logs and exponentials
Rules
, , , , , . Useful values: , , , . . Solving : .
AdaBoost's vote
: for : ; : (a coin flip gets no vote); : . Weight update: , so a misclassified point is multiplied by when (L6).
argmin, sup, inf
- is the smallest value, the point where it is attained. ERM: .
- (supremum) is the smallest upper bound, like a maximum that need not be attained (). likewise for lower bounds. The Bayes risk ; uniform convergence looks at , the worst function in the class.
Memory aid
A over a class means βthe worst case in the classβ: if even the worst function has a small gap between training and true risk, then so does the one ERM picks.
Self-check
Question cards (4)
Minimize .
Answer
.
What is ?
Answer
.
AdaBoost round with : compute and the factor for a misclassified point.
Answer
; factor (before normalizing).
Is the squared loss Lipschitz in on ?
Answer
No, its derivative is unbounded. On a bounded domain it is.