Actuarial Notes

Bagging

Study guides: Exam SRM, Exam PA, Exam MAS-II, Exam ACIA-CAPSTONE

Bagging, or bootstrap aggregation, is a method that fits the same model to B bootstrap samples of the training data and averages the predictions. For regression trees the bagged prediction is

\hat{f}_{\text{bag}}(x) = \frac{1}{B}\sum_{b=1}^{B}\hat{f}^{*b}(x)

  • \hat{f}^{*b} is the tree fitted to the bth bootstrap sample.

For classification, the bagged prediction is the majority vote of the B trees. The trees are grown deep and unpruned, so each has low bias, and averaging cuts their variance while leaving the bias essentially unchanged. B is not a tuning parameter: adding trees does not cause overfitting, because the error flattens as B grows and never increases. B is set large enough for the error to settle, often a few hundred trees.

An actuary bags 500 deep regression trees, and separately 500 ordinary least squares fits, on the same data. Which shows the larger improvement in test MSE?

  • A deep tree has high variance, since refitting it on a different sample can change its shape entirely, so averaging removes a large variance term.
  • A least squares fit with n large relative to p barely changes across samples, so its bagged average is almost the original fit.
  • The trees improve far more.

Variance of an average of correlated trees

When each tree's prediction has variance \sigma^2 and any two trees' predictions have correlation \rho, the average \bar{Z} of B trees has variance

\mathrm{Var}(\bar{Z}) = \rho\sigma^{2} + \frac{1 - \rho}{B}\sigma^{2}

Averaging more trees removes the second term but not \rho\sigma^2. In bagging, a dominant predictor tends to be chosen for the top split in most trees, so the trees are highly correlated, and averaging them reduces the variance less. Random forests decorrelate the trees.

Bagged trees have prediction variance \sigma^2 = 1 and correlation \rho = 0.6. What is the variance of the average of 100 trees?

  • \mathrm{Var}(\bar{Z}) = 0.6(1) + 0.4(1)/100 = 0.604.
  • No number of trees brings it below 0.6.

Out-of-bag error and variable importance

Each bootstrap sample leaves out about 37% of the observations, which gives the out-of-bag error, a test-error estimate with no extra fitting. A bagged model of hundreds of trees can't be read like one tree, and variable importance recovers some of the interpretability.

Practice questions

Actuarial Notes