JA EN
LearnProbability & Statistics
·★ MEMBER·PAPER·10 min read

Bayes' Theorem in AI — Priors, Posteriors, and Uncertainty

One line of math — Bayes' theorem — turns into three workhorse tools in real AI systems: probability calibration, active learning, and Bayesian optimization. Starting from a positive medical test, we build up priors, posteriors, and uncertainty with zero background assumed.

ModalitytextTaskmath

On Calibration of Modern Neural Networks

Primary source — what this article is built on

undefined2026-08-13

On Calibration of Modern Neural NetworksarXiv:1706.04599Paper page·PDF
Practical Bayesian Optimization of Machine Learning AlgorithmsarXiv:1206.2944Paper page·PDF

You test positive. How worried should you be?

Suppose you take a test for a disease that affects 1 in 1,000 people, and the result comes back positive. The test catches 99% of people who have the disease, and falsely flags 1% of people who don't. What's the probability you're actually sick?

Intuition wants to say "about 99%." The right answer is roughly 9%. Count it out with 100,000 people: 100 of them have the disease, and 99 of those test positive. The other 99,900 are healthy, and 1% of them — 999 people — get a false positive anyway. So 1,098 people are holding a positive result, but only 99 of them are actually sick. 99 ÷ 1,098 ≈ 9%.

Why did intuition fail? Because it ignored the prior information that the disease is rare in the first place. Bayes' theorem is the formula that mixes "what we knew beforehand" with "the evidence in front of us" in exactly the right proportions. And in AI, this single line of math answers some remarkably practical questions: can we trust the model's confidence? Which data point should we label next? Where should we spend our next expensive experiment?

Intuition: Bayes' theorem is a rule for updating beliefs

In one sentence, Bayes' theorem is a rule that takes your belief before seeing evidence (the prior), weights it by how well each hypothesis explains the evidence (the likelihood), and produces your belief after seeing the evidence (the posterior).

Picture a detective story. At the start of the investigation, the detective holds a hunch about each suspect — that set of hunches is the prior distribution. Then new evidence turns up: a footprint at the scene. For each suspect, the detective asks, "if this person were the culprit, how natural would this footprint be?" That's the likelihood. Multiply prior suspicion by explanatory power, renormalize so everything adds up, and you get an updated set of hunches — the posterior distribution. Every new piece of evidence repeats the update, and the distribution gradually sharpens.

The crucial point is that the answer comes out not as a verdict ("A did it") but as a probability distribution. A sharp distribution means high confidence; a flat one means "we don't know yet." Being able to carry uncertainty around as a number is the single biggest advantage of thinking in Bayesian terms.

The machinery: one line of math

P(HD)=P(DH)P(H)P(D)P(H \mid D) = \frac{P(D \mid H)\,P(H)}{P(D)}
(1)

In words: HH is a hypothesis (you have the disease; this image is a cat), and DD is the observed data (the test was positive; these were the pixels). P(H)P(H) is the prior — your belief before seeing data. P(DH)P(D \mid H) is the likelihood — the probability of seeing that data if the hypothesis were true. P(D)P(D) is the evidence — the probability of that data regardless of hypothesis (a normalizing constant, summed over all hypotheses, that makes the answers add up to 1). The left side, P(HD)P(H \mid D), is the posterior — your belief after seeing the data.

Swap every symbol for an everyday word and, in words, the line reads: what you should believe now = how well the hypothesis predicted what you saw × how believable it was before you saw anything ÷ how ordinary that observation was. That last division is what the opening example turns on: a positive result is not rare — 1,098 people in 100,000 walk away holding one — so a large P(D)P(D) drags the answer back down to 9%.

Since the denominator exists only to normalize, practitioners usually remember the proportional form:

P(HD)P(DH)P(H)P(H \mid D) \propto P(D \mid H)\,P(H)

Which says: posterior ∝ likelihood × prior. Your updated belief is proportional to how well the hypothesis explains the evidence, times how plausible it was to begin with. Said in words with the symbols stripped out: explain the evidence, but stay believable. The two factors multiply, so a hypothesis scoring near zero on either one is finished no matter how well it does on the other. The medical test at the top and the detective's investigation are both just this multiplication.

A classifier's output has the same shape. When a model says "cat: 0.92, dog: 0.08," that's a kind of posterior distribution over classes. How sharp such a distribution is — and what it feels like to tune that sharpness — is exactly what the temperature slider below demonstrates. Lower the temperature and the mass piles onto one answer (strong conviction); raise it and the distribution flattens toward "no idea."

FIG 1Sharpness is confidence. Lower the temperature and the model bets on one answer; raise it and it approaches "I don't know." The probability calibration we meet later is precisely this temperature knob, tuned on validation data

Look at neural-network training through Bayesian glasses and the scenery changes. Replace the hypothesis with the model's parameters (the collection of weights), and the question becomes "after seeing data , which parameters are most plausible?" Picking the that maximizes the posterior is called MAP estimation (maximum

What's behind this

§

Members-only from here

371 walkthroughs, 26 textbook chapters, 48 student units and 6 close readings — all included for $4.99/mo, with three new explainers every day. Cancel any time; access runs to the end of the period.

Already a member? Sign in to keep reading

References

  1. On Calibration of Modern Neural Networks. arXiv:1706.04599Paper page·PDF
  2. Practical Bayesian Optimization of Machine Learning Algorithms. arXiv:1206.2944Paper page·PDF

This article is written from the source paper above. Where they differ, the original is authoritative.

Comments

Sign in to comment