Smoothing the Counts Before You Classify

Bayesian InferenceHard+30 XP+30

Smoothing the Counts Before You Classify

A Naive Bayes spam filter is trained on a labelled email corpus built from a vocabulary of exactly V=20V = 20V=20 distinct words.

Across the whole training set:

  • The Spam class contains NSpam=180N_{\text{Spam}} = 180NSpam​=180 word tokens in total, and P(Spam)=0.30P(\text{Spam}) = 0.30P(Spam)=0.30.
  • The Ham class contains NHam=230N_{\text{Ham}} = 230NHam​=230 word tokens in total, and P(Ham)=0.70P(\text{Ham}) = 0.70P(Ham)=0.70.

The raw training counts of three particular words are:

wordcount in Spamcount in Ham
offer393939999
meeting333494949
click292929444

The filter uses add-one (Laplace) smoothing, so every word probability is estimated as

P(w∣c)=count(w,c)+1Nc+VP(w \mid c) = \frac{\text{count}(w, c) + 1}{N_c + V}P(w∣c)=Nc​+Vcount(w,c)+1​

A new message arrives containing exactly the three words offer, meeting and click, each once. The classifier assumes the words are conditionally independent given the class.

What is P(Spam∣offer,meeting,click)P(\text{Spam} \mid \textit{offer}, \textit{meeting}, \textit{click})P(Spam∣offer,meeting,click)?

Give your answer as a percentage, rounded to 2 decimal places.

Hints

Solve it to unlock the solution

Once you get it right, the reasoning behind the answer shows up here.

%