Loading…
Glossary term
A method of updating the probability of a hypothesis as new evidence arrives.
Bayesian inference starts with a prior belief, then updates it using Bayes' theorem when new evidence arrives, producing a posterior belief. It treats probability as a degree of belief.
A classic example is how likely you are to have a disease given a positive test, which depends on how common the disease is.
A positive test, a rare disease
prior = 0.01 # 1% have the disease
sensitivity = 0.90 # P(positive | disease)
false_pos = 0.05 # P(positive | no disease)
evidence = sensitivity * prior + false_pos * (1 - prior)
posterior = sensitivity * prior / evidence
print(round(posterior, 3)) # 0.154: only about 15%It gives a principled way to combine prior knowledge with data and to express uncertainty.