Ranking from few ratings: shrinkage and Bayesian averages
- Explain why the top and the bottom of a ranking by raw average fill up with items that have few ratings
- Rank with a Bayesian average, and say what its prior weight does
- Pick the prior weight from the data with empirical Bayes, and shrink each item by how much evidence it has
- Rank thumbs-up ratings by the Wilson score's lower bound
- Take harsh and easy raters out of the scores, and expect the winners to fall back toward the mean
Ranking by ratings, the way the statistics round asks
A Netflix data science guide asks how you would analyze focus-group ratings when each of 1,000 participants rated a random 100 of the pilot episodes (1 source). The same problem sits on every top rated page. This lesson's practice problem builds the tools, in three levels:
bayesian_average(ratings, prior_mean, weight), andrank_by_bayes(items, weight): rank items by their averages after adding imaginary ratings at the overall mean.wilson_lower(ups, n)andrank_by_wilson(items): rank thumbs-up shares by the lower end of the Wilson interval.shrink(items), which lets the data choose how hard to pull each average toward the mean, andrater_adjusted(rows), which takes harsh and easy raters' habits out of their scores.
Call Returns bayesian_average([5, 5, 5], 3.9, 10)4.15: three 5-star ratings move it only a little wilson_lower(1, 1)0.207 wilson_lower(80, 100)0.711 rater_adjusted(rows), a generous rater and a harsh one{"pilot 1": 6.0, "pilot 2": 7.0, "pilot 3": 7.0}
The lesson follows the shop's tent ratings: what goes wrong when you rank by raw average, Bayesian averages, empirical Bayes, the Wilson bound and rater offsets. Five steps end with a small task in the editor.
Rank by raw average, and see who comes out on top
Back to the Netflix pilots: some end up with many ratings and some with few, and the raters differ. The same problem sits on every top rated page.
The shop has 300 tents with star ratings, from 1 rating to about 400. Every tent's quality comes from the same modest spread around 4 stars.
Rank the 300 tents by their average rating. Which tents fill the top 10?
And the bottom 10 averages?
Wainer's small schools: besides crowding the top of the test-score rankings, where else do they show up?
Add some imaginary ratings at the mean, and luck washes out
IMDb doesn't rank by the arithmetic mean. Its help page describes a weighted average that takes into account each title's number of ratings, a minimum count and the mean rating of all titles:
Here R is the title's own average from v ratings, C is the mean across titles, and m, currently 25,000, sets how hard titles get pulled toward C. That's a Bayesian average: add m imaginary ratings at the overall mean, then average. Evan Miller frames the same problem: a single perfect rating shouldn't sit atop a list of top-rated items.
A tent has one 5-star rating. With 10 imaginary ratings at the shop's mean of 3.9, what's its Bayesian average?
How many of the truly best 10 tents does each method put in its top 10?
Rank with the Bayesian average
A ranking is one sort away. The prior mean is the mean of every rating of every item, not the mean of the item averages, so an item with many ratings counts for more in it. Sort by the Bayesian average, best first, and break ties by name so the order never depends on how the items happened to be listed.
In the editor, write rank_by_bayes(items, weight). It prints three tents: one with a single 5, and two with many ratings.
Let the data choose how hard to shrink
How many imaginary ratings? Split the spread of the averages into two parts. Each rating is noisy, with variance σ², and the tents' true averages really differ, with variance τ². An average of n ratings then deserves a weight of τ² / (τ² + σ²/n) on itself, and the rest on the mean. That's the same as adding c = σ²/τ² imaginary ratings.
Tents really differ only a little, and single ratings are noisy. Does that call for more imaginary ratings or fewer?
How much closer to the truth does shrinking get, on average?
For thumbs-up ratings, rank by the Wilson lower bound
Some ratings are yes or no: helpful or not, thumbs up or down. Evan Miller's post on sorting them names two common mistakes. Positive minus negative puts an item with 1,000 more ups than downs, at 55% positive, above one with 200 more at 60%. And the plain share puts an item with 2 positive ratings and 0 negative at 100%, at the top.
His fix: sort by the lower bound of the Wilson score interval, a confidence interval for a share that NIST notes can never go below 0. The simple normal interval, p ± z √(p(1 − p)/n), fails right where you need it: at 2 of 2, p(1 − p) is 0, so its lower bound is a full 1.0.
import math
for name, ups, n in (("A", 2, 2), ("B", 90, 100), ("C", 600, 700)):
print(f"{name}: {ups}/{n} = {ups / n:.0%}, Wilson lower bound {wilson_lower(ups, n):.3f}")
A is 2 of 2, B is 90 of 100, and C is 600 of 700. Which ranks first by the Wilson lower bound?
Take each rater's habit out of their scores
In the Netflix setup, each participant rates a random 100 pilots, and people use a scale differently. Cortes and Lawrence, studying the NeurIPS review experiment, call this a classical challenge: reviewers interpret the same scale differently. Their model splits each score into the paper's quality, the reviewer's offset and noise.
The simplest fix subtracts each rater's offset: their own average minus everyone's average. Here are 200 participants who each rate a random 20 of 50 pilots on a 1 to 10 scale, with offsets that vary almost as much as the noise:
rng = random.Random(12)
# how good each pilot really is, on a 1 to 10 scale
pilots = [rng.gauss(6.0, 0.5) for _ in range(50)]
# each participant's own offset
harsh = [rng.gauss(0.0, 0.8) for _ in range(200)]
rows = []
for person in range(200):
# each sees a random 20 of the 50
for pilot in rng.sample(range(50), 20):
rows.append((person, pilot, pilots[pilot] + harsh[person] + rng.gauss(0, 1.0)))
raw = [mean(r[2] for r in rows if r[1] == k) for k in range(50)]
by_pilot = rater_adjusted(rows)
adjusted = [by_pilot[k] for k in range(50)]
for name, est in (("raw", raw), ("rater-adjusted", adjusted)):
print(f"{name:14}: off by {mean((e - q) ** 2 for e, q in zip(est, pilots)) ** 0.5:.3f} points on average")
Pilots went to random raters. Does adjusting for harsh raters still help?
A worked example: the Netflix pilots, out loud
Here's the Netflix question, worked out loud.
1,000 participants each rated a random 100 pilot episodes. How would you analyze the ratings to pick the pilots to make?
1. Ask about the design. How many pilots are there, so how many ratings does each get? Was the assignment truly random, and what's the scale?
With 400 pilots and 100,000 ratings spread at random, about how many ratings does each pilot get?
The split-half check finds that only 2 of the top 10 pilots repeat across the halves. What does that tell you?
Measure the winners again
One follow-up comes up after every ranking question.
Pick the top items by any noisy score, and their scores overstate their truth. Airbnb's experimentation team found this with launches: the experiments chosen for success overestimate their true effects. Here's the size of it when noise is as large as the real spread:
rng = random.Random(13)
inflation = []
for _ in range(2_000):
truth = [rng.gauss(0, 1) for _ in range(50)]
# each estimate is as noisy as the spread
measured = [x + rng.gauss(0, 1) for x in truth]
top = sorted(range(50), key=lambda k: measured[k], reverse=True)[:5]
inflation.append(mean(measured[k] - truth[k] for k in top))
print(f"the top 5 by measured score overstate their true score by {mean(inflation):.2f} on average")
Pick the top 5 of 50 by a score that's as noisy as the real differences. How far do their scores overstate their truth?
A pilot topped the focus group. What should you expect from its next, bigger test?
The practice problem, start to finish
That's every piece the practice problem needs. It asks for the three levels from the start of the lesson, from a blank file, and the interviewer follows up after each one.
1.Why does a ranking by raw average fill its top and bottom with items that have few ratings?
2.What is a Bayesian average?
3.Ratings are noisy, with σ² = 0.78, and true averages differ with τ² = 0.052. About how many imaginary ratings does empirical Bayes add?
4.Which thumbs-up item should rank first by the Wilson lower bound?
5.You launch the 5 features with the biggest measured wins out of 50 tests. What should you expect?
Practice
Sources (23)
- The Most Dangerous Equation · Howard Wainer, American Scientist (copy hosted by University of Washington Statistics) · May 1, 2007
“showed that the standard deviation does not increase in proportion to the sample. Instead, it is proportional to the square root of the sample size.”
- The Most Dangerous Equation · Howard Wainer, American Scientist (copy hosted by University of Washington Statistics) · May 1, 2007
“The variation of the mean is inversely proportional to the sample size, so small counties display much greater variation than large counties.”
- The Most Dangerous Equation · Howard Wainer, American Scientist (copy hosted by University of Washington Statistics) · May 1, 2007
“A county with, say, 100 inhabitants that has no cancer deaths would be in the lowest category. But if it has 1 cancer death it would be among the highest.”
- The Most Dangerous Equation · Howard Wainer, American Scientist (copy hosted by University of Washington Statistics) · May 1, 2007
“smaller schools are expected to have higher variance and hence should be over-represented at both extremes”
- Ratings FAQ · IMDb Help Center · Nov 19, 2026
“We don't use the arithmetic mean ... instead the rating displayed on a title's page is a weighted average.”
- Ratings FAQ · IMDb Help Center · Nov 19, 2026
“This formula provides a true ... which takes into account the number of ratings each title has received, minimum ratings required to be on the list, and the mean rating for all titles”
- Ratings FAQ · IMDb Help Center · Nov 19, 2026
“a title must have received a minimum amount of ratings (currently 25,000) in order to appear in one of these charts.”
- Ranking Items With Star Ratings: An Approximate Bayesian Approach · Evan Miller · Sep 16, 2014
“The main problem addressed here is what to do with items that have a small number of ratings, since an item with a single perfect rating probably should not sit atop a list of top-rated items.”
- The Most Dangerous Equation · Howard Wainer, American Scientist (copy hosted by University of Washington Statistics) · May 1, 2007
“Kelley's equation, which indicates that the truth is estimated best when its observed value is regressed toward the mean of the group that it came from”
- Stein's Paradox in Statistics · Bradley Efron and Carl Morris, Scientific American (copy hosted on gwern.net) · May 1, 1977
“The essential process in Stein's method is the shrinking of all the individual averages toward this grand average.”
- Stein's Paradox in Statistics · Bradley Efron and Carl Morris, Scientific American (copy hosted on gwern.net) · May 1, 1977
“Stein's theorem states that the shrinking factor is always less than 1. Its actual value is determined by the collection of all the observed averages.”
- Stein's Paradox in Statistics · Bradley Efron and Carl Morris, Scientific American (copy hosted on gwern.net) · May 1, 1977
“Stein's theorem states that Clemente's true batting ability is best estimated not by .400 but lies closer to .294.”
- Stein's Paradox in Statistics · Bradley Efron and Carl Morris, Scientific American (copy hosted on gwern.net) · May 1, 1977
“The observed averages y have a total squared error of .077, whereas the squared error of the James-Stein estimators is only .022. By this comparison, then, Stein's method is 3.5 times as accurate.”
- Stein's Paradox in Statistics · Bradley Efron and Carl Morris, Scientific American (copy hosted on gwern.net) · May 1, 1977
“For 16 of the 18 players the James-Stein estimator z is closer than the observed average y to the true, or seasonal, average”
- How Not To Sort By Average Rating · Evan Miller · Feb 6, 2009
“Average rating works fine if you always have a ton of ratings, but suppose item 1 has 2 positive ratings and 0 negative ratings.”
- How Not To Sort By Average Rating · Evan Miller · Feb 6, 2009
“This algorithm puts item two (score = 1000, but only 55% positive) above item one (score = 200, and 60% positive).”
- How Not To Sort By Average Rating · Evan Miller · Feb 6, 2009
“Score = Lower bound of Wilson score confidence interval for a Bernoulli parameter”
- 7.2.4.1. Confidence intervals · NIST/SEMATECH e-Handbook of Statistical Methods · Nov 19, 2026
“Another advantage is that the lower limit cannot be negative.”
- Inconsistency in Conference Peer Review: Revisiting the 2014 NeurIPS Experiment · Corinna Cortes and Neil D. Lawrence, arXiv · Sep 20, 2021
“A classical challenge with such scales is that they may be interpreted differently by different reviewers.”
- Winner's Curse: Bias Estimation for Total Effects of Features in Online Controlled Experiments · Minyong Lee and Milan Shen (Airbnb), KDD 2018 · Aug 19, 2018
“When a group of experiments is conducted, usually the ones with significant successful results are chosen to be launched into the product.”
- Selection Bias in Online Experimentation · Milan Shen and Minyong Lee, The Airbnb Tech Blog · May 29, 2017
“Analogously, the observed effects of selected experiments tend to overestimate the true effects of experiments.”
- Understanding empirical Bayes estimation (using baseball statistics) · David Robinson, Variance Explained · Oct 1, 2015
“These aren't the best batters, they're just the batters who went up once or twice and got lucky.”
- Regression towards Mediocrity in Hereditary Stature · Francis Galton, Journal of the Anthropological Institute (galton.org) · Jan 1, 1886
“the mean filial regression towards mediocrity was directly proportional to the parental deviation from it.”