Skip to content

AIC Penalizes Model Complexity to Fight Overfitting

AIC scores a model by how well it fits and charges it for how many parameters it needed to get there, and the smallest score wins. Hirotugu Akaike defined it in 1974 as AIC = (−2) log(maximum likelihood) + 2(number of independently adjusted parameters within the model). You compute it for each candidate model, and the one with the smallest AIC is the one you pick. Akaike called that choice the minimum AIC estimate, or MAICE.

The two terms pull in opposite directions. Fit a more flexible model and the maximum likelihood goes up, so −2 log(likelihood) goes down. But every extra parameter adds 2 to the penalty. Akaike calls that 2k term "crucial". Without it you would only be comparing −2 log(likelihood), and for models nested one inside the next that number can only improve as parameters are added, because the bigger model can always do at least as well on the data it was fit to.

Try it by hand. Compare two models fit to the same data. Model P has k = 3 parameters and a maximum log-likelihood of −60. Then AIC = 2 × 3 − 2 × (−60) = 6 + 120 = 126. Model Q has k = 6 parameters and a maximum log-likelihood of −58. Then AIC = 2 × 6 − 2 × (−58) = 12 + 116 = 128. Model Q fits better: its log-likelihood is 2 higher, worth 4 AIC points. But three extra parameters cost 6 points, so P wins, 126 to 128. These numbers are invented for the arithmetic.

For a linear model with Gaussian errors, maximum likelihood and least squares are the same thing. When the error variance σ² is estimated once, typically from the full model, and shared by every candidate, James, Witten, Hastie, and Tibshirani write AIC, dropping irrelevant constants, as (1/n)(RSS + 2dσ̂²) for d predictors. That is a scaled version of Mallows' Cp, so under this convention it ranks the models in the same order as Cp. Their footnote 4 adds that when σ² is unknown and is not estimated that way, the likelihood-based formula has a log(RSS) term in place of the RSS term.

The trap: letting the smallest training error choose the model. Training error and the fitted likelihood keep improving as you add parameters to nested models, so they favor the biggest model. AIC is a way to ask for a fair price. It compares models only when they are fit to the same data and the same response, so you cannot compare an AIC from one data set against another.

Prof Rod's rule: fit all your candidates on the same data, compute AIC for each, and distrust any model that wins on fit alone.

Akaike, "A new look at the statistical model identification," IEEE Transactions on Automatic Control, 19(6), 1974, pp. 716–723

James, Witten, Hastie, and Tibshirani, An Introduction to Statistical Learning, 2nd ed., Section 6.1.3, p. 234, and footnote 4