A data scientist is developing a Bayesian spam filter. From a large dataset, they determine that the overall probability of an incoming email being spam is 20%. The probability that a spam email contains the word 'special' is 50%. However, the word 'special' also appears in non-spam emails 5% of the time. Given a new email that contains the word 'special', what is the posterior probability that this email is spam?
This question requires the application of Bayes' rule to find the posterior probability P(Spam | 'special').
First, define the known probabilities:
Prior probability of spam, P(Spam) = 0.20
Prior probability of not spam, P(Not Spam) = 1 - P(Spam) = 1 - 0.20 = 0.80
Likelihood of 'special' given spam, P('special' | Spam) = 0.50
Likelihood of 'special' given not spam, P('special' | Not Spam) = 0.05
Bayes' rule is: P(A|B) = [P(B|A) * P(A)] / P(B)
In this context: P(Spam | 'special') = [P('special' | Spam) * P(Spam)] / P('special')
To use this formula, we first need to find the total probability of the word 'special' appearing, P('special'), using the law of total probability: P('special') = P('special' | Spam) * P(Spam) + P('special' | Not Spam) * P(Not Spam) P('special') = (0.50 * 0.20) + (0.05 * 0.80) P('special') = 0.10 + 0.04 P('special') = 0.14
Now, substitute all the values back into Bayes' rule: P(Spam | 'special') = (0.50 * 0.20) / 0.14 P(Spam | 'special') = 0.10 / 0.14 P(Spam | 'special') ≈ 0.714
Therefore, the probability that the email is spam given it contains the word 'special' is approximately 71.4%.
Ask Bash
Bash is our AI bot, trained to help you pass your exam. AI Generated Content may display inaccurate information, always double-check anything important.
Why is Bayes' rule important in spam filtering?
Open an interactive chat with Bash
What is the law of total probability, and why is it used here?
Open an interactive chat with Bash
What are prior and posterior probabilities in Bayesian analysis?