In part I, it was shown the difference between extra-sample and in-sample error. Besides, it was explained why the training error will be an overly optimistic estimate of the generalization error . With that in mind, an “obvious way” to estimate prediction error is to estimate the optimism and then add it to the training error . Some methods, like , AIC, BIC and others, work in this way, for a special class of estimates that are linear in their parameters. Those quantities tries to measure the fit of the model to the data while penalizing complexity. The difference between those measures is how they choose to measure the goodness-of-fit and to penalize complexity.
In-sample error and model selection
In-sample error is not usually of direct interest since future values of the features are not likely to coincide with their training set values. But for comparison between models, in-sample error is convenient and often leads to effective model selection. The reason is that the relative (rather than absolute) size of the error is what matters.
In-sample error estimates
The general formula of the in-sample estimates is
where is the in-sample error, and is the average optmism, as defined in Part 1. Basically, Section 7.5 of  shows that and AIC are particular cases of Eq. (1), for different choices of loss functions used to compute (measuring the fitness) and different estimates of (penalizing complexity). The estimates of are closely related to what is called the effective number of parameters of the model.
For simple models, the effective number of parameters, , are easily computed. For example, in a simple linear regression model, the effective number of parameters are equal to the number of parameters in the model, , where is the parameter vector. However, in a more complex scenario, when a set of models is indexed by a tuning parameter , as for example in regularized regression, the effective number of parameters, , depends on .
My opinion …
To be honest, I didn’t like the coverage of Sections 7.5 through 7.8, which is about AIC, BIC, MDL and how to compute the effective number of parameters in more complex models. I think the subject is complex and its computation varies on a case-by-case basis, specially for the effective number of parameters. I think there are better material for those subjects and I will leave them to future posts. For example, in my opinion, a much better treatment of AIC is given by Chapter 2 of  (which I have summarized here). Chapter 7 of  did a much better job covering cross-validation and bootstrap methods, which will be the subject of the third and last post about Chapter 7 of .