PROBABILITY & REASONING · 10 MIN
Probability & Bayes' Rule
Bayes' rule updates how sure we are about a cause after seeing evidence.
NEURA explains
- P(A|B) = P(B|A) · P(A) / P(B).
- The prior P(A) is belief before evidence; the posterior P(A|B) is belief after.
- Rare causes stay fairly unlikely even after a positive test — always check the base rate.
Real world: A 99%-accurate test for a disease 1 in 1000 people have: a positive result still means only about 9%.
Code
prior, sens, false_pos = 0.001, 0.99, 0.01
p_pos = sens * prior + false_pos * (1 - prior)
print(round(sens * prior / p_pos, 3))Output ›
0.09Try it in the online compiler →Checkpoint quiz
In Bayes' rule, P(A) before seeing evidence is the…