Contents
05The seesaw: prior versus data
5.1The MAP estimate of a mean
For averages, MAP has a simple physical picture. Let the observations be Gaussian with known noise, x_i\sim\mathcal N(\theta,\sigma^2), and put a Gaussian prior on the mean, \theta\sim\mathcal N(\mu_0,\tau^2). By (8), MAP minimizes the negative log-posterior
Its derivative, -\frac{1}{\sigma^2}\sum_i(x_i-\theta)+\frac{1}{\tau^2}(\theta-\mu_0), is zero when \theta\big(\frac{n}{\sigma^2}+\frac{1}{\tau^2}\big)=\frac{n\bar x}{\sigma^2}+\frac{\mu_0}{\tau^2}. Multiplying by \sigma^2,
This is a weighted average of the prior mean \mu_0 and the data mean \bar x (the maximum likelihood estimate). It is exactly the balance point of a seesaw that carries a weight m at position \mu_0 and a weight n at position \bar x. The prior is worth m imaginary observations: a confident prior (small \tau) is a heavy weight. Here the posterior is Gaussian, so its mode and its mean coincide, and its variance is \sigma^2/(m+n), which shrinks as data arrive (Bishop, 2006, §2.3.6).
5.2The two restaurants
Model a restaurant’s ratings this way, with a prior mean of \mu_0=4.0 stars (a typical restaurant) worth m=10 imaginary reviews. Restaurant A has n five-star reviews, so \bar x=5.0, and Table 1 shows its MAP rating.
| five-star reviews n | 0 | 1 | 10 | 100 | 1{,}000 |
|---|---|---|---|---|---|
| MAP rating (40+5n)/(10+n) | 4.00 | 4.09 | 4.50 | 4.91 | 4.99 |
With one review, A’s MAP rating is 4.09. Restaurant B, with 2{,}000 reviews averaging 4.7, gets (40+9400)/2010=4.70, almost exactly its own average. So MAP ranks B above A, as our instinct did, while maximum likelihood (5.0 against 4.7) ranks A first. Figure 4 shows how A’s estimate climbs from the prior toward the data as reviews accumulate, faster for a weak prior and slower for a strong one.
This is not only a textbook device. For many years the Internet Movie Database ranked its Top 250 films with the “weighted rating” \frac{v}{v+m}R+\frac{m}{v+m}C, where R is a film’s average rating, v its number of votes, C the mean vote across all films and m the minimum number of votes required to be listed; in December 2010 the page gave m=3000 and C=6.9 (IMDb, 2010). That is (12) with n=v, \bar x=R and \mu_0=C.
5.3When the data win
Equation (12) shows the two classic limits at a glance. As n\to\infty with m fixed, the weight on the data, n/(m+n), tends to 1 and MAP tends to maximum likelihood. With a flat prior, \tau\to\infty, so m\to0 and MAP equals maximum likelihood for any n. The prior matters most when the data are scarce, exactly where maximum likelihood fails.
Pause and think. With the prior of the table, how many five-star reviews does restaurant A need before its MAP rating passes restaurant B’s 4.70?
Show the answer
Solve (40+5n)/(10+n)>4.70: 40+5n>47+4.7n, so 0.3n>7 and n>23.3. Twenty-four reviews.