Exercise 2: A Second Spam Filter Example — Possible Solution ==================================================================== GIVEN ------------------------------ P(spam) = 0.30 P("winner" | spam) = 0.25 P("winner" | not spam) = 0.01 STEP 1: THE LAW OF TOTAL PROBABILITY — P("winner") ------------------------------ P("winner") = P("winner"|spam) x P(spam) + P("winner"|not spam) x P(not spam) = (0.25 x 0.30) + (0.01 x 0.70) = 0.075 + 0.007 = 0.082 STEP 2: APPLYING BAYES' THEOREM ------------------------------ P(spam|"winner") = [P("winner"|spam) x P(spam)] / P("winner") = 0.075 / 0.082 ~= 0.9146 (about 91.46%) INTERPRETATION ------------------------------ Seeing the word "winner" raises the belief an email is spam from a 30% prior all the way to a roughly 91.5% posterior - a much sharper update than Chapter 4's own "free" example (which only reached 80%), since "winner" is a stronger, more spam-specific signal here (25% vs. 1% is a bigger gap than 30% vs. 5%). WHY THIS WORKS AS AN ANSWER ------------------------------ The calculation follows this chapter's own two-step Bayes' Theorem method exactly - first computing the total probability of the evidence via the law of total probability, then applying Bayes' Theorem to get the posterior - and the result is interpreted by comparing it directly against the chapter's own "free" example to explain why this particular word produces a stronger update.