Probability Bayes 8–12 min
Understand Bayes.
With a spam filter.
Change the probabilities, watch what happens and learn to solve a case yourself.
Is it spam or a false alarm?
The filter flagged an email. That does not mean it is right.
Out of every 100 emails, 1 are spam.
What percentage of flagged items are spam?
Green is spam. Orange is a false alarm: a legitimate email flagged by the filter.
The filter detects 90 % of spam. It also flags 5 % of legitimate email.
Adjust the filter
De todo el spam, cuánto acaba marcado.
Correo legítimo que marca por error.
Keep experimenting Simulate, compare or share
Try a random sample.
The model gives a probability of
Simulate an inbox. With only a few emails, chance can cause a large variation.
Reproduce this sample
Seed 42. The same seed and rules reproduce the sample.
The key: look only at flagged emails.
Bayes answers a new question: if the filter flagged it? We no longer look at the whole inbox. Look only at emails the filter flagged. Some are spam; others are legitimate.
Expected counts for 10,000 emails. Some may be fractional: these are expected values, not a simulated sample.
Of the 585 flagged emails, 90 are spam. That proportion is the answer.
Because the filter still produces false alarms
See the tree and Bayes' formula
10 spam messages remain unflagged.
9,405 legitimate emails remain unflagged.
S means spam; M means flagged. The bottom sums all flagged emails: real detections and false alarms.
Now, without the spam filter.
The same idea, a new problem. No inbox, no formula in view.
Now, a bot detector.
A community uses a bot detector. 5% of accounts are bots; it flags 80% of bots and 10% of real users.
Your progress 0 of 3 cases solved
Saved only in this browser.
- ○Your own prediction
- ○A simulation