← All sessions
SESSION 8 OF 12
Step 1 of 8

1. Generative Spam Detection

y ∈ {spam, not-spam}, x = which words appear in the email.

The story: spam and non-spam emails come from different word distributions. Estimate:

  • P(spam), P(not-spam) — priors, from the fraction of spam in training data.
  • P(x|spam), P(x|not-spam) — how likely this email is, per class.

Then compare P(x|spam)·P(spam) vs. P(x|not-spam)·P(not-spam), predict whichever is bigger. (P(x) cancels out — same for both, so we can drop it.)