"Free money", spam and Bayes' rule

3.6k Views Asked by At

A spam filter is designed by looking at commonly occurring phrases in spam. Suppose that 80% of email is spam. In 10% of the spam emails, the phrase "free money" is used, whereas this phrase is only used in 1% of non-spam emails. A new email has just arrived, which does mention “free money”. What is the probability that it is spam?

So in this problem I am trying Bayes' rule, so I have to find P(A), P(A^C), and P(B).

I made P(A) the emails that are spam = 80%

P(A^C) is the emails that are not spam = 20%

But I am having trouble on P(B) which is the emails that contains "Free Money"

It has to do with the following phrase:

In 10% of the spam emails, the phrase “free money” is used, whereas this phrase is only used in 1% of non-spam emails.

Once I figure out P(B), I can finish the rest of the problem from there.

1

There are 1 best solutions below

0
On BEST ANSWER

Let's create some notations

S - an email is a spam
FM - 'free money' phrase is used
N - an email is normal (not a spam)

We are asked to find
$P(S|FM)$

Notice $P(S) + P(N) = 1$ and apply Baysian formula
$$ P(S|FM) = \frac{P(FM|S)P(S)}{P(FM|S)P(S) + P(FM|N)P(N)} $$ where $$ P(FM|S) = 10\%, ~P(FM|N) = 1\% $$ Plug all back to the conditional probability, I got $$ P(S|FM) = \frac{40}{41} $$

I had a hard time starting to solve this type of problems. Just find some more similar problems then you will have a good feeling how to deal with it. Good luck!