Bayes’ Theorem in Practice
From formula to real decisions. Medical tests, spam filters, A/B experiments — all powered by Bayesian reasoning.
Sensitivity & Specificity
True positive rate
True negative rate
These describe the test. What patients want is the reverse: P(Disease | +)
Positive Predictive Value
PPV = P(Disease | positive test). Computed via Bayes’ theorem — and it depends on prevalence.
The Base Rate Fallacy
- Ignoring prevalence when interpreting a positive test
- Focusing on accuracy, forgetting how rare the disease is
- Most positive results from a rare-disease test are false positives
- Bayes’ theorem forces you to weight accuracy by base rate
The Surprising Result
Prevalence 0.1%, sensitivity 99%, specificity 99%. You test positive.
= 0.00099 / 0.01098 ≈ 9%
The Population View
In 100,000 people: 100 sick (99 test positive) and 99,900 healthy (999 false positives). The false positives outnumber true positives ~10 to 1.
Bayesian Updating
Today’s posterior is tomorrow’s prior. Each new piece of evidence refines your belief.
Spam Filtering
- Each word is independent evidence of spam (naïve assumption)
- Train on labeled spam / ham emails to get P(word | spam)
- For new email: P(spam | words) ∝ P(spam) × ∏ P(wi | spam)
- Fast, interpretable, competitive with complex models
Bayesian A/B Testing
Instead of a p-value, get a direct answer: P(B better than A | data). Start with a prior belief about each rate, then update it with every conversion.
Bayes & ML
- MAP estimation = MLE + prior = regularization
- L2 reg ↔ Gaussian prior; L1 reg ↔ Laplace prior
- Bayesian neural nets: full posterior over weights
- Gaussian processes: Bayesian models over functions
Always Ask: What’s the Prior?
- A “99% accurate” test means nothing without the base rate
- Uncertainty is first-class: models should know what they don’t know
- Learning is updating: every observation refines beliefs
- Prior knowledge is data — domain expertise enters naturally
What you learned
Sensitivity & specificity, PPV, the base rate fallacy, Bayesian updating, naïve Bayes spam filters, Bayesian A/B testing, and Bayes’ role in machine learning — the engine of rational belief revision.