Lensa ML
Lensa ML

How Bayes' Theorem Works

Step 1 of 6

Prior Belief

What you believe before seeing any evidence

Prior Probability DistributionP(H)0.50P(¬H)0.50
Prior P(H)
P(H)
0.50
P(¬H)
0.50

A balanced prior means you're fairly uncertain. Evidence will have the biggest relative impact here.

Step 1 of 6: Prior Belief

What you believe before seeing any evidence

Prior Probability DistributionP(H)0.50P(¬H)0.50
Prior P(H)
P(H)
0.50
P(¬H)
0.50

A balanced prior means you're fairly uncertain. Evidence will have the biggest relative impact here.

Step 2 of 6: Likelihood

How probable is the evidence under each hypothesis?

Likelihoods: How probable is the evidence?P(E|H)0.80P(E|¬H)0.20
P(E|H) — likelihood if hypothesis true
P(E|¬H) — likelihood if hypothesis false
P(E|H)
0.80
P(E|¬H)
0.20
LIKELIHOOD RATIO
4.00

The evidence is much more likely under H than ¬H. This evidence will strongly boost your belief in the hypothesis.

Step 3 of 6: The Update

Bayes' formula combines prior and likelihood

BAYES' THEOREM
P(H|E) = P(E|H) × P(H) / P(E)
P(E|H) = 0.90P(H) = 0.30P(E|¬H) = 0.20P(¬H) = 0.70
P(H|E) = 0.90 × 0.30 / (0.90 × 0.30 + 0.20 × 0.70)
= 0.270 / 0.410 = 0.659
Prior → PosteriorPrior0.30Posterior0.659
Prior P(H): 0.30
P(E|H)×P(H)
0.270
P(E) = total evidence
0.410
P(H|E)
0.659

Evidence boosted belief from 0.30 to 0.659 — a strong upward update because the evidence fits the hypothesis well.

Step 4 of 6: Visual Bayes

An area diagram makes the math intuitive

Area = Probability. Colored area = evidence observed.P(H) = 40%P(¬H) = 60%P(E|H)P(E|¬H)P(H|E) = P(E|H)·P(H) / [P(E|H)·P(H) + P(E|¬H)·P(¬H)]orange area / total colored areaP(H|E)=0.77
Prior P(H): 0.40
P(E|H): 0.75
P(E|¬H): 0.15
P(H|E)
0.769
UPDATE SIZE
36.9%

Both colored areas are comparable. The evidence provides moderate information — neither strongly confirming nor refuting H.

Step 5 of 6: Sequential Updates

Feed evidence one at a time — posteriors compound

Each posterior becomes the next prior0.10Start
Initial Prior: 0.10
Next evidence: Test +
P(E|H)0.85
P(E|¬H)0.25
CURRENT BELIEF
0.100
EVIDENCE SEEN
0 / 5
LAST P(E|H)
LAST P(E|¬H)

Press Play or Step to feed evidence one at a time. Each observation updates your belief — the posterior becomes the next prior.

Step 6 of 6: Bayes in ML

Naive Bayes classification in action

Naive Bayes: P(class|feature) via Bayes' theorem024681012Feature valueCatDogP(x|Cat)=0.109P(x|Dog)=0.121Cat42.5%Dog57.5%
Feature value: 5.0
P(CAT|X)
42.5%
P(DOG|X)
57.5%
DECISION
Dog

Near the overlap region, both classes are plausible. The decision boundary is where the posterior probabilities cross — this is where uncertainty is highest.