A lesson from Essential Probability & Statistics for ML
£29/month
£29/month£29/month or £249/year · 30-day money-back guarantee
Get full accessOur content is best on a larger screen
The law of large numbers
The law of large numbers is one of the central results of probability. It is the reason an expected value means something in practice: the average of many independent repetitions of a random quantity converges to its expected value .
A casino cannot predict the result of one spin of a roulette wheel, but it can predict its takings over a million spins. It relies on the law of large numbers, which states precisely what this convergence means.
Theorem
Let be i.i.d. random variables, each with finite mean , and let be the average of the first :
Then for every margin ,
Here says that the average is more than away from , and the limit says that the probability of this tends to as grows.
We say that the average converges to . This is a statement about a probability. It does not say that ever equals , or that it is sure to be within of once is large.
A fair die shows
The dots are the first
Tip
When each term has finite variance , the variance of is , which tends to as grows. So the distribution of is concentrated more and more tightly around , and the probability that is more than from tends to .
ML Context
To evaluate a machine learning model, we measure its error on each example in a test set (examples the model was not trained on). If the examples are independent draws from the distribution the model will be used on, these errors are i.i.d., with mean equal to the model's expected error on a new example. Their average, the test error, is , so by the law of large numbers it converges to as the test set grows.
Practice questions
5 questions
The numbers of customers who arrive at a shop in different minutes are i.i.d., each with mean . Let be the average number of arrivals over the first minutes.
What does the law of large numbers say about ?
Select the correct answer:
+ 4 more questions · unlocked with a subscription
Expected proportions after an early run
In 1913, at the casino in Monte Carlo, a roulette ball landed on black times in a row. As the run went on, gamblers lost millions of francs betting that red was due: they had misread the law of large numbers as saying that luck evens out.
To see why this is wrong, we simplify the roulette wheel: with no green pocket, each spin lands on black with probability . If we record each spin as for black and for red, the proportion of blacks is their average, so by the law of large numbers it converges to .
Now suppose the first spins give blacks. The later spins are independent of these, so they are still expected to split evenly. For example, the next spins are expected to give blacks, so in all after spins.
| Spins | Blacks so far + expected from later spins | Extra blacks over an even split | Expected proportion of blacks |
|---|---|---|---|
Key Point
The extra blacks are never cancelled: they stay in the count. But their share of a growing number of spins shrinks towards , so the proportion still converges to . We say the early lead is diluted. The same holds however long the early run, even blacks in a row.
Details
A fair coin lands heads times in the first tosses. Find the probability of heads on toss and the expected proportion of heads after tosses.
Solution
The tosses are independent, so the first do not change toss , and the condition can be dropped:
For the proportion, the first tosses are known, and tosses are still to come. Let be the number of heads among them. Each of these tosses lands heads with probability , so by linearity of expectation
The number of heads in all tosses is , with expected value , so the expected proportion of heads is
Practice questions
4 questions
A fair die shows a six on each of its first rolls. What is the probability that roll shows a six?
Select the correct answer:
+ 3 more questions · unlocked with a subscription
Every time you pull an answer from memory, the memory gets stronger. Reading doesn't do that. Nodeledge asks you questions on every step of every lesson, then asks again after days, weeks and months.