I keep meaning to write a post on this...
At least within Bayesian probability, there is a single unique unambiguously-correct answer to "how should we penalize for complexity?": the Bayes factor. The Bayes factor is Hard to compute in general, which is why there's a whole slew of of other numbers which approximate it in various ways.
Here's how Bayes factors work. Want to know whether model 1 or model 2 is more consistent with the data? Then compute and . Using Bayes' rule:
where Z is the normalizer. If we're just comparing two models, then we can get rid of that annoying Z by computing odds for the two models:
In English: posterior relative odds of the two models is equal to prior odds times the ratio of likelihoods. That likelihood ratio is the Bayes' factor: it directly describes the update in the relative odds of the two models, due to the data.
20 coin flips yield 16 heads and 4 tails. Is the coin biased?
Here we have two models:
- Model 1: coin unbiased
- Model 2: coin has some unknown probability of coming up heads (we'll use a uniform prior on for simplicity; this is not a good idea in general)
The second model has one free parameter (the bias) which we can use to fit the data, but it’s more complex and prone to over-fitting. When we integrate over that free parameter, it will fit the data poorly over most of the parameter space - thus the "penalty" associated with free parameters in general.
In this example, the integral is exactly tractable (it's a dirichlet-multinomial model), and we get:
So the Bayes factor is (.048)/(.0046) ~ 10, in favor of a biased coin. In practice, I'd say unbiased coins are at least 10x more likely than biased coins in day-to-day life a priori, so we might still think the coin is unbiased. But if we were genuinely unsure to start with, then this would be pretty decent evidence in favor.
Why is this hard to compute in general? Well, if the model has an m-dimensional vector of free parameters , then , which is an integral in m dimensions. That's not just NP-complete, it's #P-complete.
There's various ways to approximate that integral. The two most common are:
- MCMC (see e.g. here for application to Bayes factors): main limitation is that MCMC gets finicky in high dimensions.
- Laplace approximation around the maximum-likelihood point. Aside from the usual limitations of using a single maximum-likelihood point, main limitation is that we need the determinant of the Hessian, which takes somewhere between O(k) and O() to compute for most k-free-parameter models (depending on how clever we are with the linear algebra).
The BIC can be derived directly from the Laplace approximation. Laplace says:
where is the maximum likelihood point and k is the dimension of .
Notice that is the usual "score" of a model; the rest is what we can think of as a complexity penalty, and that's what the BIC will approximate. The main assumption is that scales with the number of data points N; this is trivial if the data points are iiid (given ), since in that case is a sum over data points.
Now for the trick: that's the only part of the Laplace approximation's "complexity penalty" which scales with the number of data points N. It scales in proportion to , since each of k dimensions of the determinant contributes a factor N. Take the log of the whole thing, and all the rest will be constants which are dominated by the term as N goes to infinity. And that's the BIC: log of the MAP probability, minus .
Finally, the important part: the main benefit of knowing all this is being able to predict when the BIC will and will not work well. If it's an approximation of Laplace, which is itself an approximation of the Bayes factor, then BIC will work well exactly when those approximations are accurate. In particular, BIC fails when the terms we ignored (i.e. ) are as large as or even larger than , i.e. the BIC itself.