Skip to content
BIASED

Bayesian model selection

Block 1 of 7~2 min

Parameters and models: two levels of inference

The topic Conjugate priors and the exponential family gave us posteriors in closed form, but always inside one model chosen in advance. In practice several models fit the same data: a fair coin or a coin with an unknown bias, a polynomial of degree 1, 3 or 9, a narrow or a wide prior. This topic chooses among them with the tool we already have, Bayes' formula.

There are two levels. A parameter θ\theta picks one member of a family. A model MM fixes the whole family: the likelihood p(X∣θ,M)p(X \mid \theta, M), the prior p(θ∣M)p(\theta \mid M) and its hyperparameters. Linear and cubic regression are two models; two sets of cubic coefficients are two parameter values of one model.

Inside a model nothing is new:

p(θ∣X,M)=p(X∣θ,M) p(θ∣M)p(X∣M).p(\theta \mid X, M) = \frac{p(X \mid \theta, M)\, p(\theta \mid M)}{p(X \mid M)}.

The denominator, so far only a normalizer, now takes the lead. It is the evidence, or marginal likelihood, of the model:

p(X∣M)=∫p(X∣θ,M) p(θ∣M) dθ=Eθ∼p(θ∣M)[p(X∣θ,M)].p(X \mid M) = \int p(X \mid \theta, M)\, p(\theta \mid M)\, d\theta = \mathbb E_{\theta \sim p(\theta \mid M)}\big[p(X \mid \theta, M)\big].

The likelihood is averaged over the prior, not maximized.

One level up, the model is just another unknown, a discrete one. Bayes' formula again:

p(Mj∣X)=p(X∣Mj) p(Mj)∑kp(X∣Mk) p(Mk).p(M_j \mid X) = \frac{p(X \mid M_j)\, p(M_j)}{\sum_k p(X \mid M_k)\, p(M_k)}.

With equal prior probabilities of the models, the most probable model is the one with the largest evidence. Otherwise maximize the product p(X∣Mj) p(Mj)p(X \mid M_j)\, p(M_j).

Why not compare the fits? Because models are often nested. A cubic with zero leading coefficients is a straight line, so the best cubic fits at least as well as the best line, and the training error can only go down as the degree grows. A rule built on max⁡θp(X∣θ,M)\max_\theta p(X \mid \theta, M) always votes for the biggest model.

Two practical remarks. In regression the inputs are taken as given, so the evidence is p(y∣X,M)p(y \mid X, M). For continuous data the evidence is a density value: it can exceed 1, and it changes with the units of yy. Compare evidences only for the same data in the same units.

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