We want to design a spam filter for email. As described in Exercise 1, a major strategy is to find phrases that are much more likely to appear in a spam email than in a nonspam email. In that exercise, we only consider one such phrase: "free money". More realistically, suppose that we have created a list of 100 words or phrases that are much more likely to be used in spam than in non-spam.
Let $W_{j}$ be the event that an email contains the $j$ th word or phrase on the list. Let
$$
p=P(\text { spam }), p_{j}=P\left(W_{j} \mid \text { spam }\right), r_{j}=P\left(W_{j} \mid \text { not spam }\right),
$$
where "spam" is shorthand for the event that the email is spam.
Assume that $W_{1}, \ldots, W_{100}$ are conditionally independent given that the email is spam, and conditionally independent given that it is not spam. A method for classifying emails (or other objects) based on this kind of assumption is called a naive Bayes classifier. (Here "naive" refers to the fact that the conditional independence is a strong assumption, not to Bayes being naive. The assumption may or may not be realistic, but naive Bayes classifiers sometimes work well in practice even if the assumption is not realistic.)
Under this assumption we know, for example, that
$$
P\left(W_{1}, W_{2}, W_{3}^{c}, W_{4}^{c}, \ldots, W_{100}^{c} \mid \text { spam }\right)=p_{1} p_{2}\left(1-p_{3}\right)\left(1-p_{4}\right) \ldots\left(1-p_{100}\right)
$$
Without the naive Bayes assumption, there would be vastly more statistical and computational difficulties since we would need to consider $2^{100} \approx 1.3 \times 10^{30}$ events of the form $A_{1} \cap A_{2} \cdots \cap A_{100}$ with each $A_{j}$ equal to either $W_{j}$ or $W_{j}^{c} .$ A new email has just arrived, and it includes the $23 \mathrm{rd}, 64 \mathrm{th}$, and 65 th words or phrases on the list (but not the other 97 ). So we want to compute
$$
P\left(\mathrm{spam} \mid W_{1}^{c}, \ldots, W_{22}^{c}, W_{23}, W_{24}^{c}, \ldots, W_{63}^{c}, W_{64}, W_{65}, W_{66}^{c}, \ldots, W_{100}^{c}\right)
$$
Note that we need to condition on all the evidence, not just the fact that $W_{23} \cap W_{64} \cap W_{65}$ occurred. Find the conditional probability that the new email is spam (in terms of $p$ and the $p_{j}$ and $r_{j}$ ).