What to expect
A mystery box: 5% of the time it pays $100, 25% of the time $5, the rest — nothing. What is one play worth?
No single play answers that. Most plays pay $0; occasionally one pays $100. The honest question is: what do I get per play, on average, if I keep playing?
Weight each outcome by how often it shows up
Section titled “Weight each outcome by how often it shows up”Play 100 times and the world roughly keeps its promises: ~5 plays pay $100, ~25 pay $5, ~70 pay nothing. Total ≈ 5×$100 + 25×$5 + 70×$0 = $625. Per play: $6.25.
Shrink that reasoning into one line and you get the expectation:
E[X] = Σ p(x) · x = 0.05×100 + 0.25×5 + 0.70×0 = 6.25
Each outcome, weighted by how often it happens. Not a prediction of the next draw — a property of the whole distribution: the number the running average is forced toward as plays pile up.
The license to sample
Section titled “The license to sample”Flip the logic around and you get the most load-bearing trick in machine learning. If the true average is what you want but the distribution is too big to touch — every possible sentence, every possible game — you can sample: draw randomly, average what you see, and trust the long run to drag your estimate toward the truth.
A uniformly sampled minibatch can estimate the average loss over a fixed training dataset. That dataset, in turn, may only approximate the population we care about. Individual batch losses and gradients are noisy; convergence of a sample mean is not by itself a guarantee that an optimization procedure converges or generalizes.
Go deeper: why the average settles
For independent, identically distributed draws with finite variance , the sample mean has variance and standard deviation . This is a typical error scale, not a bound that every realized error follows. Reducing that standard deviation tenfold requires 100 times as many draws.
The law of large numbers concerns convergence of averages. It does not, by itself, supply the rate without the finite-variance assumptions used here.
Now combine this chapter with the log from chapter one. Weight what by how often it happens? The next chapter picks the single most interesting choice: how surprised you are.