MoonSay /Tutorials/Machine Learning Interview #5
Contents
  1. 01Introduction
  2. 02Maximum likelihood
  3. 03Where maximum likelihood fails
  4. 04Bayes’ theorem and the MAP estimate
  5. 05The seesaw
  6. 06A prior is a regularizer
  7. 07Side by side
  8. 08Interview questions and model answers
  9. 09Summary
  10. References

03Where maximum likelihood fails: too little data

Maximum likelihood trusts the data completely. With plenty of data that is exactly right. With little data it is dangerous, because the data alone can point to extreme answers.

  • Three flips, three heads. The likelihood is \theta^3, which peaks at \theta=1. Maximum likelihood concludes that this coin always lands heads and that tails is impossible. Nobody who has seen real coins believes that.
  • One five-star review. The maximum likelihood estimate of restaurant A’s rating is the average of its reviews, 5.0, so a single happy customer makes it the best restaurant in town, above restaurant B with two thousand reviews at 4.7.
  • A spam filter. A Naive Bayes spam filter estimates, for each word, the fraction of spam e-mails that contain it. Suppose “free” appears in 30 of 60 training spam e-mails (0.50), “money” in 12 (0.20) and “meeting” in none (0). A new spam e-mail that says “free money meeting” then gets P(\text{e-mail}\mid\text{spam})\propto0.50\times0.20\times0=0: one unseen word wipes out all the other evidence. This zero-count problem is the reason every practical Naive Bayes classifier smooths its counts (Manning et al., 2008, §13.2).

All three are overfitting in its simplest form: the estimate fits the particular sample, including its accidents, instead of what generalizes. What is missing is a way to say: I don’t believe extreme values without strong evidence. That is what a prior does.

Pause and think. With h=0 heads in n=2 flips, what does maximum likelihood say about the probability of heads, and why is that a problem for prediction?

Show the answer

\hat\theta=0: it predicts that heads can never happen, so the first head ever observed would have probability zero under the model, an infinitely bad log loss.