Bayes' theorem
Bayes' theorem updates a prior probability to a posterior using new evidence: P(A | B) = P(B | A) × P(A) / P(B). It is the foundation of Bayesian inference and many classification methods.
FrameworkBayesian inference
See it move
Loading infographic...
A test catches 90% of true defects but also false-alarms 5% of the time, on a batch defect rate of just 2%. Bayes' theorem combines these into a posterior probability: P(defective | alarm) = (0.90 × 0.02) ÷ [(0.90 × 0.02) + (0.05 × 0.98)] ≈ 27% — still more likely not defective, despite the alarm.
Where it fits
TopicProbability & DistributionsAdvancedSubjectData Analysis & StatisticsAdvanced
The formula
LaTeX
Variables
- Prior probability of A before observing B
- Likelihood: probability of observing B if A is true
- Posterior probability of A after observing B
- Marginal probability of B; can be expanded as P(B|A)P(A) + P(B|Aᶜ)P(Aᶜ)
The theorem converts a prior belief P(A) into an updated posterior P(A|B) by weighting the likelihood of the observed evidence.