Friday night, streaming app, sorted by rating. At the top sits a film you've never heard of with a perfect 5.0. Then you notice it has three ratings, probably from the director's family. A few rows down is a film with 4.6 stars from two thousand people.
Everyone knows to distrust the 5.0. The interesting questions are how much to distrust it, and what number should replace it. Football has the same problem: should you trust the striker who's three from three, or the one who's 52 from 60?
The films, ratings and app are made up.
Sorting by average rewards luck
Small samples produce extreme averages, in both directions. Three ratings can easily all be fives, or all be ones. Two thousand ratings can't. So if you sort anything by its raw average, the very top and the very bottom of the list fill up with things hardly anyone has rated.
The fix is to give every film some pretend votes at the app's overall average before its real votes are added. A film with three ratings is mostly pretend votes, so it sits near the average. A film with two thousand is almost all real. Flip between the two rankings below.
That's not a made-up trick. IMDb originally ranked its famous Top 250 with exactly this formula, and called it "a true Bayesian estimate": weighted rating = (v ÷ (v + m)) × R + (m ÷ (v + m)) × C, where R is the film's average, v its number of votes, m the pretend votes and C the average across all films.
But one thing should bother you. Where did "50 pretend votes" come from? Push the slider to 300 and the old favourites dominate; drop it to 5 and the three-rating wonders creep back. The number looks arbitrary. It isn't, and the next figure shows why.
Let the data choose how much to shrink
Here's the model. Every film has a true quality: the average it would get if everyone watched it. True qualities are spread around the app's average by some amount; call it the spread between films. Each individual rating is noisy around a film's true quality, because people disagree.
If films are all much alike (a small spread), a handful of ratings tells you little, and you should shrink hard towards the average. If films vary wildly, trust each film's own average more. The pretend votes from Fig. 7 are just the ratio of those two: disagreement between people ÷ spread between films.
And here's the clever bit. You don't have to guess the spread between films. You can measure it from all the films at once, because the films that have thousands of ratings show you how different films really are. Each film's prior is learned from the rest. That's what a hierarchical model is: individuals inside a group, with the group setting the prior for each member.
Below are 30 simulated films where, unlike real life, we know the true quality. Each hollow circle is a film's raw average; the arrow shows where the model moves it.
Look at the tiles. Treating each film alone makes big misses on the films with few ratings. Treating every film as average ignores real differences. Partial pooling beats both, and "Let the data choose" lands close to the best setting without ever peeking at the truth. Press New films a few times: it keeps winning.
Notice who moves. Films near the top, with a handful of ratings, slide a long way towards the middle. Films at the bottom, with hundreds or thousands, barely move. Nobody decided that by hand; it falls straight out of the model.
The striker who's three from three is one row in a table like this. Pool him with every other penalty taker in the league and his 100% shrinks to something believable, while the 52-from-60 veteran keeps most of his record. This is the standard way to rank anything with uneven sample sizes: players, schools, hospitals, restaurants, products.
Key findings
- Sorting by raw averages fills the top and bottom of any list with things that have very little data.
- Shrinkage blends each item's average with the group average, weighted by how much data it has. IMDb's Top 250 formula is exactly this.
- How hard to shrink depends on how much individuals truly differ. A hierarchical model estimates that from the whole group, so each member's prior comes from the others.
- Partial pooling usually makes smaller errors than either treating everyone alone or treating everyone the same.
Appendix — the maths
Film j has true quality θj. True qualities vary around the app average μ with spread τ, and each rating varies around θj with spread σ (how much people disagree; about 1 star here):
θj ~ Normal(μ, τ²) average of nj ratings ȳj ~ Normal(θj, σ² ÷ nj)The posterior mean for each film is a weighted average of its own average and the app average:
estimatej = wj · ȳj + (1 − wj) · μ wj = nj ÷ (nj + σ²/τ²)Compare that with IMDb's formula: the pretend votes m are simply σ² ÷ τ². "Let the data choose" estimates τ with the method of moments: the spread of the raw averages, minus the part explained by sampling noise, τ² ≈ variance(ȳ) − average(σ² ÷ nj). A full hierarchical model would put a prior on τ too and average over it, usually with the method in the bonus chapter.
Source: IMDb, Wikipedia (the original Top 250 weighted-rating formula, and its name in actuarial science as a credibility formula).