← back to cognitive science

Probability and Bayes

Lovelace textbook · CC BY-SA 4.0 · computationalcognitivescience.github.io/lovelace/home

Bayes' theorem tells you how to update beliefs when new evidence arrives. Start with a prior (what you believed before), multiply by the likelihood (how probable the evidence is under each hypothesis), and normalize. The posterior is your updated belief. This is the engine underneath every Bayesian model of cognition.

Bayes' theorem

P(H|D) = P(D|H) P(H) / P(D). The prior P(H) encodes what you believed before seeing data. The likelihood P(D|H) says how probable the observed data is if hypothesis H is true. Your updated belief is the posterior P(H|D). The denominator P(D) is a normalizing constant that ensures it sums to one.

Prior P(H) × Likelihood P(D|H) Posterior P(H|D) Normalize by P(D) = sum over all H of P(D|H)P(H)
Scheme

Priors and sequential updating

The posterior from one observation becomes the prior for the next. Bayesian inference is naturally sequential: each new piece of evidence sharpens (or broadens) your beliefs. The order of evidence does not matter. Two observations yield the same posterior regardless of which comes first.

Scheme

Conjugate priors

A prior is conjugate to a likelihood function when the posterior has the same functional form as the prior. The Beta distribution is conjugate to the Binomial likelihood: if your prior on a coin's bias is Beta(a, b), then after observing h heads and t tails, the posterior is Beta(a+h, b+t). The update is just adding counts to the parameters.

Scheme

Notation reference

Symbol Scheme Meaning
P(H)p-hypothesisPrior probability
P(D|H)p-data-given-hLikelihood
P(H|D)p-h-given-dataPosterior probability
P(D)p-evidenceMarginal likelihood (normalizer)
Beta(a, b)(beta-mean a b)Conjugate prior for coin bias
Neighbors
  • Grinstead Ch.4 — Bayes' theorem from first principles
  • Fritz 2020 — Markov categories: a categorical foundation for probability
  • 🍞 Ho & Wu 2026 — Bayesian inference as a lens: prior-to-posterior update via optics
  • wpConjugate prior — the mathematical convenience that makes sequential updating tractable

Translation notes

The Lovelace textbook introduces probability from scratch with interactive visualizations. This page assumes basic familiarity with probability and focuses on the Bayesian update machinery that subsequent chapters build on. The textbook also covers joint distributions, marginalization, and independence, which are prerequisites for the graphical models in Chapter 3.

Read the original: Lovelace, Chapter 2.