Read this lesson as text
Spam Filters
Probability · Axiom Academy
How email filters use conditional probability to protect your inbox Every day, billions of spam emails are sent worldwide. How does your email filter automatically detect which messages are spam and which are legitimate? The answer: Naive Bayes Classification - one of the most elegant applications of conditional probability! What makes this email look suspicious? What features might a spam filter examine? Spam filters learn by analyzing thousands of labeled emails (known spam and legitimate emails). They calculate the probability that certain words appear in each category. Based on 10,000 spam emails and 10,000 legitimate emails These are conditional probabilities: the probability a word appears GIVEN the email is spam (or legitimate) But what we really want is the reverse: P(spam | word) - the probability the email is spam GIVEN that it contains certain words. This is exactly what Bayes' Theorem does: P(spam | "free"): What we want to know - probability email is spam given it contains "free" P("free" | spam): What we measured - probability "free" appears in spam (8.5%) P(spam): Prior probability - overall spam rate (let's say 40%) P("free"): Total probability "free" appears in any email Suppose an email contains the word "free". What's the probability it's spam? The word "free" alone gives very strong evidence of spam!
This is the written version of the interactive lesson above. See the full Probability course.