What is the probability of an email being spam if it contains the word 'free'?
Instruction: Assume that 5% of all emails are spam and 30% of spam emails contain the word 'free'. Is this sufficient to compute the probability that an email containing 'free' is spam? Identify any missing rate and derive the result in terms of it.
Updated
Worked answer
The supplied information is insufficient for a unique numerical answer. Let S mean spam and F mean contains “free.” We know P(S) = 0.05 and P(F | S) = 0.30. We still need b = P(F | not S), the fraction of legitimate mail containing the word.
Bayes' rule gives:
P(S | F) = (0.05 × 0.30) / (0.05 × 0.30 + 0.95 × b)
Therefore P(S | F) = 0.015 / (0.015 + 0.95b). The 30% is P(F | S), not the probability the question asks for.
For an explicitly assumed illustration, suppose b = 0.02. In a hypothetical 10,000 emails, 500 are spam and 150 of those contain “free.” Of the 9,500 legitimate emails, 190 contain “free.” Hence 150 of the 340 emails containing “free” are spam: 15/34 ≈ 44.12%. Changing the assumed legitimate-mail rate changes that result.
To estimate a real spam probability, obtain representative labeled mail, estimate the missing rate, and check whether the base rate and word frequencies still apply to the deployment population.
Related Questions
-
easy
-
medium
-
medium
-
hard