Unbiased gradients
A sampled gradient is unbiased for a target objective when its expectation, at fixed parameters, equals that objective's full gradient.
On this page 7 sections
01Average over the sampling scheme#
A sampled gradient is unbiased for a target objective when its expectation, at fixed parameters, equals that objective's full gradient. The sampling probabilities are part of the claim.
For a mean loss over examples, the full gradient is the average of their gradients. Sampling one example uniformly gives that same average in expectation, because each example has probability .
02Compare two sampling rules#
At fixed parameters, suppose two scalar example gradients are and . The gradient of their mean objective is . Uniformly choosing either raw example gradient has expectation .
If the first example is chosen with probability and the second with , the expected raw gradient becomes . This sampling rule is biased for the original equally weighted objective.
Raw example gradients are −2,6, sampled with probabilities 0.75,0.25. Their expected sampled gradient?
Show answer and explanation
The weighted average is −1.5+1.5=0.
03State which objective is targeted#
The nonuniform sampler is unbiased for a different weighted objective whose weights are . Calling an estimator biased or unbiased requires naming the target, not merely examining whether the sample looks random.
For vector gradients, compare each coordinate's expectation. Unbiasedness does not make an individual draw equal to the full gradient, and it does not guarantee that every stochastic step decreases loss.
A sampler favors examples with large gradients but applies no correction. A draft calls it unbiased solely because all examples remain possible. What must be checked?
Show answer and explanation
Unequal sampling can change the expected raw gradient.
Sampling convenient or easy examples can change the expected gradient. Importance weighting can correct some nonuniform schemes, but deriving such corrections is outside this lesson. Here, compute the expected supplied gradient under the stated probabilities and compare it with the intended target.
Check an unbiased stochastic-gradient claim under a stated sampling scheme.
- Check an unbiased stochastic-gradient claim under a stated sampling scheme.
Sources & further reading
- [1]Stanford CS229, Main Notes, Part I §1 ↗cs229.stanford.edu · Article
- [2]Dive into Deep Learning, §2.6 Probability and Statistics ↗d2l.ai · Article