MIT 6.790 — Lecture 10
Stochastic Gradient Descent and Estimation Error Bounding
§ Stochastic Gradient Descent
One issue with gradient descent is that it's slow to compute when the function being minimized is the average of loss functions across data points, like so, because computing the gradient becomes an task.
Stochastic gradient descent sacrifices accuracy for speed like so:
Definition. To compute from in stochastic gradient descent, sample and compute . Then set ; the point is that is an unbiased estimate for , since .
Remark. If you want to decrease the variance of the approximation , you can also set to be the average of across randomly-sampled indices .
Importantly, the loss may increase on some iterations of SGD, even for arbitrarily small step sizes .
We conclude our discussion on SGD with the statement of a theorem, without proof.
Theorem. (SGD Convergence) Suppose is convex with minimizer and satisfies for all . Suppose:
We have , where is the initial value for SGD.
We have for all .
We have for all .
Then SGD with step size yields:
Remark. The 6.790 notes claim the RHS should have a coefficient of rather than , but this is incorrect by dimensional analysis alone. The details here, for 6.790's sake, are not too important regardless.
§ Estimation Error Bounding
Recently, we've been restricting ourselves to specific classes of hypotheses (regression, parametric models). Let's consider machine learning at a much more general level; what can we say regardless of what the hypothesis class looks like?
Definition. For any hypothesis , there are two types of errors (or risks).
The expected (test) error of is .
The empirical (training) error of is .
Can we upper-bound the estimation error between the expected error and the empirical error?
Theorem. (Estimation Error Bound) Assume and pick some . Then with probability , the following is true for all hypotheses :
Note that the assumption makes sense for classification problems, say. More generally, one can achieve a similar bound up to a constant factor for models with bounded loss functions.
Remark. It should make sense that the RHS grows as grows. The reason why is that larger yield higher rates of overfitting, in which case the empirical error becomes a less accurate estimation of the expected error.
One might question what happens in the case of linear regression, where is an infinitely-sized hypothesis class, with one hypothesis for each of the infinitely many parameters . The trick, then, is to replace with, say, the set of -bit floating point numbers. This way, and , and the RHS doesn't blow up.
We'll now provide a proof of this theorem. Expect the proof to be “simplistic”—after all, it has to work no matter what is!
Proof: The proof will rely on a statistical fact known as Hoeffding's Inequality, which we state below without proof.
Hoeffding's Inequality. If are sampled (i.i.d.) from the same distribution , then:
Note that is the average of the , and is the expected value (the same for all ).
Directly applying Hoeffding's Inequality with yields:
Then the union bound across all yields:
Plugging in now directly yields the promised bound; you can check this in your head.
We conclude with one more similar-looking theorem.
Definition. We establish the notation and .
Clearly is preferred to , but training data and ERM can only get us to . How do and compare?
Theorem. (ERM Risk Bound) Assuming , for all we have with probability that:
Proof: The point is the following:
The RHS has two bracketed expressions marked “bound #1” and “bound #2” that can each be upper-bounded using the “Estimation Error Bound” theorem. Summing these two upper bounds yields the promised result.