Grounds the probability notation and Bayes-rule prerequisites needed for the page.
Bayesian Inference
Bayesian inference updates a prior distribution over unknowns into a posterior by multiplying by the likelihood and normalizing.
Intuition
The idea in plain words, before the symbols.
Maximum likelihood asks: which parameter makes the data look most probable?
Bayesian inference asks a different question: after seeing the data, what should we believe about each possible parameter?
That difference matters when data is scarce or uncertainty matters. The likelihood is a score of parameters by data fit. A prior is what you believed before the data. A posterior is the updated distribution after both forces are combined.
For a coin with unknown head probability , maximum likelihood might pick one number such as . Bayesian inference keeps a whole distribution over plausible values. With little data, the prior can still matter. With lots of data, and with a prior that gives nonzero density near the data-favored values, the likelihood usually concentrates the posterior near the parameters that explain the observations.
So Bayesian inference is not maximum likelihood with a correction added. It produces a different kind of answer: MLE returns one estimate, while Bayesian inference returns a distribution over the unknown quantity.
Study prompts for this section: Intuition
Each button copies a prompt about this section to your clipboard, for an AI assistant you already use. Nothing is sent by this site.
Mathematics
Definitions, assumptions and the derivation.
Let be an unknown parameter and let be observed data. Bayesian inference starts with a prior distribution or density and a likelihood . Bayes' rule gives the posterior:
For a continuous parameter, the denominator
is the evidence or marginal likelihood. Its job is to normalize the posterior so it integrates to .
If lives in a discrete set, replace the integral with a sum. The job is the same: add up prior-weighted likelihood over all possible parameter values.
For parameter comparison, the key proportional form is
This is the central contrast with maximum likelihood. The likelihood is a function of , but it is not automatically a probability distribution over . Multiplying by a prior and normalizing turns it into the posterior distribution.
For a coin with unknown head probability , suppose the data has heads and tails, with . The likelihood shape is
If records only the count of heads, the full binomial likelihood also has a factor . That factor does not depend on , so it disappears in proportional calculations.
If the prior is a beta distribution with ,
then
Multiplying prior and likelihood gives
so the posterior is
The maximum-likelihood estimate is
when . The posterior mean is
When , the posterior mean can also be written as
This is the clean bridge to maximum likelihood: the posterior mean is a weighted compromise between the prior mean and the MLE. The posterior distribution is the richer object; the mean is only one summary of it.
It is safe to think of as prior strength for this averaging formula. The density exponents are and , so pseudo-count language is only a mnemonic. The exact conjugate update is the parameter update .
Study prompts for this section: Mathematics
Each button copies a prompt about this section to your clipboard, for an AI assistant you already use. Nothing is sent by this site.
Code
The same calculation as runnable code, in the notation of the derivation.
import math
import numpy as np
def log_beta_fn(a, b):
return math.lgamma(a) + math.lgamma(b) - math.lgamma(a + b)
def log_beta_pdf(theta, a, b):
if theta <= 0 or theta >= 1:
return -math.inf
return (a - 1) * math.log(theta) + (b - 1) * math.log(1 - theta) - log_beta_fn(a, b)
alpha, beta = 2.0, 2.0
heads, tails = 8, 2
post_alpha = alpha + heads
post_beta = beta + tails
n = heads + tails
mle = None if n == 0 else heads / n
prior_mean = alpha / (alpha + beta)
posterior_mean = post_alpha / (post_alpha + post_beta)
print("MLE:", "undefined" if mle is None else round(mle, 3))
print("prior mean:", round(prior_mean, 3))
print("posterior mean:", round(posterior_mean, 3))
print("posterior:", f"Beta({post_alpha:.1f}, {post_beta:.1f})")
# Grid approximation to show prior * likelihood -> posterior shape.
grid = np.linspace(0.01, 0.99, 99)
log_prior = np.array([log_beta_pdf(theta, alpha, beta) for theta in grid])
log_likelihood = heads * np.log(grid) + tails * np.log(1 - grid)
log_unnormalized_posterior = log_prior + log_likelihood
# Normalize on the grid for inspection.
weights = np.exp(log_unnormalized_posterior - log_unnormalized_posterior.max())
weights = weights / weights.sum()
grid_mean = float(np.sum(grid * weights))
print("grid posterior mean approx:", round(grid_mean, 3))
The code mirrors the math: the prior is a density over , the likelihood scores the observed heads and tails for each , and the posterior beta parameters add the observed counts to the prior parameters.
Study prompts for this section: Code
Each button copies a prompt about this section to your clipboard, for an AI assistant you already use. Nothing is sent by this site.
Demo
Change an input, predict the result, and see which quantities respond.
Explore Bayesian Inference
Observation guide
Optional and ungraded. Opening a guide saves nothing.
Choose what to inspect in Bayesian Inference, then open its guide.
Use the sliders and presets to compare prior strength against observed data. The prior and posterior curves are densities over . The likelihood curve is normalized only for display so its shape can be compared on the same plot.
Try the "strong prior, little data" preset, then the "data wins" preset. The MLE only follows the observed fraction. The posterior mean moves between prior belief and data fit, and the full posterior curve shows how much uncertainty remains.
Before the posterior is revealed, the demo asks which of five outcomes the data will produce. The "balanced update" preset uses the code's numbers, , , . The prior mean gets weight and the MLE gets , so . Subtracting the prior mean from the weighted form gives : the mean moves the fraction of the way to the MLE, less than half exactly when , exactly half when and more than half when .
That fraction measures movement only when the two means differ. With no observations the posterior is the prior. When already equals the prior mean, the weighted average stays put whatever the weights, yet the posterior is still rather than . A beta distribution with mean has variance , so with the mean fixed the added counts strictly reduce the spread. The demo decides the outcome by exact comparisons of these counts; its displayed decimals are rounded.
Study prompts for this section: Demo
Each button copies a prompt about this section to your clipboard, for an AI assistant you already use. Nothing is sent by this site.
Concept: Bayesian Inference
What is the smallest example of Bayesian Inference you can work through by hand, and what does it show?
DetailsProbability
Reference id
concept:probability/bayesian-inferenceAfter the first pass
Go deeper
Optional material for a second reading. Sources are always shown; the other panels open from their headings or from these links, and closing one keeps what you wrote or revealed.What to look for in each sectionChoose a section and what you expect to see in it, then read short advice.
Section by section
Choose what to look for in each section
Bayesian inference updates a prior distribution over unknowns into a posterior by multiplying by the likelihood and normalizing.

Start with the picture, metaphor, or geometric mechanism.
Choose what you expect to see in this section of Bayesian Inference.
Questions to ask of the pictureChoose a part of the picture and what you expect, then read short advice.
Looking at the picture
Questions to ask of the picture
Bayesian inference updates a prior distribution over unknowns into a posterior by multiplying by the likelihood and normalizing.
Which part of the picture should you look at first?
Pick the part of the picture you expect to explain Bayesian Inference.
Sources
References for this page
A reference shows where an idea comes from; it does not vouch for every step on this page.Grounds Bayesian inference as posterior updating under probabilistic models.
Philosophical Transactions of the Royal Society of London 53, 370–418 (1763, published posthumously by Richard Price). Infers an unknown chance of success from observed successes and failures, starting from a uniform prior.
What each claim rests on1 claim, each with its sources, where it appears on this page, and its caveats.
Claims and sources
Bayesian inference updates a prior distribution over unknowns into a posterior by multiplying by the likelihood and normalizing.
The checks were made by this site, not by an independent reviewer.
Deisenroth et al. ground Bayes' rule as posterior = likelihood times prior divided by evidence and define evidence as the posterior normalizer; Murphy grounds Bayesian parameter inference as updating p(theta...
Covers posterior updating and the contrast with MLE, not approximate inference, hierarchical models, asymptotics or decisions. The code and demo use the beta-Bernoulli model; the binomial coefficient they om...
MML supports Bayes-rule notation with prior, likelihood, evidence, and posterior labels, defines evidence/marginal likelihood as the normalizer, and notes that the full posterior retains more information than focusing on a maximum/statistic. Murphy directly supports parameter-level Bayesian updating as p(theta|D) proportional to p(theta)p(D|theta) normalized by p(D), contrasts this with MLE as a single likelihood-maximizing parameter estimate, and gives the beta-Bernoulli/binomial posterior update used by the page.
Explain it without the pageWrite your own explanation before asking for feedback. Your draft and any hints stay while this page is open.
Practice · Bayesian Inference
Try the idea in your own words
Bayesian inference updates a prior distribution over unknowns into a posterior by multiplying by the likelihood and normalizing.
Concept · Selected for practice
Bayesian Inference
What it rests on: Sources: Mathematics for Machine Learning; Probabilistic Machine Learning: An Introduction; An Essay towards solving a Problem in the Doctrine of C...
Context and links
Probability
Explain the mechanism
For Bayesian Inference: What is the smallest example of Bayesian Inference you can work through by hand, and what does it show? Explain your answer, including what changes, why, and which assumption matters.
A rough first thought is enough. Your draft stays when you change tasks.
Your draft stays on this page and is cleared when you leave or reload.
A little help · Explain
Open one hint at a time. These are suggestions, not your answer or a grade.
0 of 3 hints shown for this question.
Clearing your answer keeps this help record. Outside help is your own report; this page cannot check it.
Where am I stuck? (optional)
Take your draft to a feedback conversation
No AI feedback runs here. You can copy a prompt to use elsewhere; nothing is sent automatically. Review the text before sharing, and leave out private information.
Write an attempt before copying a feedback prompt.
A draft, or an AI reply to it, is not a test of what you have learned. To check that, try a different case later without help.
Ask about this pagePick one item on this page and copy a prompt about it into an AI assistant you already use. Notes you write here stay in this browser.
if theta <= 0 or theta >= 1:Your question
Choose what your question is about
Pick the idea, equation, source, code, claim, misconception or demo state you want to ask about. The prompt you copy includes it, so the answer can stay on that item.Open the draft below to save one note and next action in this browser.
Bayesian Inference
What is the smallest example of Bayesian Inference you can work through by hand, and what does it show?
Fixed prompts generated from this item. They are not comments from people or independent reviews.
The 3 cited sources must support this exact item, not just the surrounding topic.
Connect the definition to one equation, piece of code or demo before widening the discussion.
Change one input, then check that the same relationship holds in the mathematics, the code and the demo.
You can state the mechanism in your own words
Local action draftNo local draft saved yetOpen when you are ready to write one next action
This draft stays in this browser and is attached to this item only.
- What the 3 cited sources say about this exact item
- The definition, its prerequisites, and a contrasting concept
- The equation or code that makes the concept concrete
- One demo state that shows what stays the same as the inputs change
- You can state the mechanism in your own words
- You can name the prerequisite that would clear up the confusion
- You can predict how the result changes when one input changes
Reference id
concept/concept-notebook/probability/bayesian-inference
concept:probability/bayesian-inference