Skip to content
BIASED

The Bayesian approach

Block 1 of 7~3 min

Parameters are uncertain too

One question runs through this course: how do we reason and predict when the parameters of a model are themselves uncertain, and what do we do when the exact computation is out of reach? The first half answers the first part exactly. The second half builds approximations and scales them to big data and neural networks. This topic sets up the vocabulary on the smallest example there is.

A friend tosses a coin three times and gets three heads. Let xi∈{0,1}x_i \in \{0, 1\} be the outcome of toss ii, with 11 for heads, and let θ\theta be the probability of heads. The model says the tosses are Bernoulli⁡(θ)\operatorname{Bernoulli}(\theta) and independent given θ\theta. A sequence with ss heads in nn tosses then has probability

p(X∣θ)=θs(1−θ)n−s.p(X \mid \theta) = \theta^{s} (1 - \theta)^{n - s}.

The frequentist reading treats θ\theta as a fixed unknown constant. Only the data are random, and an estimate is judged by how it would behave over many imagined repetitions of the experiment. The standard estimate is the maximum likelihood estimate (MLE): the θ\theta that maximizes the log-likelihood

ℓ(θ)=log⁡p(X∣θ)=slog⁡θ+(n−s)log⁡(1−θ).\ell(\theta) = \log p(X \mid \theta) = s \log\theta + (n - s) \log(1 - \theta).

The logarithm does not move the maximum and turns products into sums. For our three heads out of three, ℓ(θ)=3log⁡θ\ell(\theta) = 3\log\theta keeps growing all the way to θ=1\theta = 1, so θ^ML=1\hat\theta_{\text{ML}} = 1. The model is now certain that tails is impossible. Three tosses do not justify that.

The Bayesian reading uses probability for a degree of belief given the available information. Then nothing stops us from giving θ\theta itself a distribution: it describes what we know and do not know about this coin. The rules of probability are the same in both readings; what changes is which quantities get distributions. Two people with different information may reasonably hold different probabilities for the same event: someone who has seen the coin's previous hundred tosses knows more than we do.

With plenty of data and a correct model the two readings mostly agree. They differ most on small samples like ours.

Answers are saved on the server and tied to this browser until you sign in.

Go deeper — optional

Code and labs do not count toward the main percentage or the certificate.

  • Beta–Binomial posterior after headsoptional

    Update Beta(α,β) after h heads and t tails; match mean and a 4/5-style predictive.

    ~20 min · easier on a computer · The matching course topic has been read.

    Self-check in the notebook — not part of mastery or the certificate.