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 picks one member of a family. A model fixes the whole family: the likelihood , the prior 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:
The denominator, so far only a normalizer, now takes the lead. It is the evidence, or marginal likelihood, of the model:
The likelihood is averaged over the prior, not maximized.
One level up, the model is just another unknown, a discrete one. Bayes' formula again:
With equal prior probabilities of the models, the most probable model is the one with the largest evidence. Otherwise maximize the product .
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 always votes for the biggest model.
Two practical remarks. In regression the inputs are taken as given, so the evidence is . For continuous data the evidence is a density value: it can exceed 1, and it changes with the units of . Compare evidences only for the same data in the same units.