One training set, many trees
The topic Bias–variance decomposition found the weak spot of a deep tree: its bias is small and its variance is large. It also found the cure in principle. An average of models trained by the same procedure has the same expectation as one of them, so it keeps the small bias, while its variance can be much smaller.
The catch is practical. Averaging over independent training sets needs many training sets, and we have one. The bootstrap from the topic Confidence intervals and the bootstrap (Probability Theory) gets around this: a resample of points drawn with replacement from the training set stands in for a fresh training set from the same distribution.
Bagging (bootstrap aggregation, Breiman, 1996) uses resamples to manufacture training sets.
- Draw bootstrap samples of points each from .
- Grow a tree on each, to full depth, without pruning.
- Average the trees: their mean prediction for regression; for classification (classes in this topic), the mean of their class-1 probabilities or a majority vote.
With the prediction of tree , the ensemble predicts
The trees are identically distributed, so the expectation of their average is the expectation of one bootstrap tree. Bagging does not change the bias, apart from a small increase: each tree sees only about 63% of the distinct points and is slightly cruder than a tree on all of . All the gain is in the variance.
So bagging helps unstable methods, whose output moves a lot when a few training points change: deep trees, greedy selection of a feature subset, neural networks. For stable methods it gains little and can slightly hurt. Nearest neighbours with a large already average many targets. Least squares on a few features barely moves between resamples. The sample mean does not move at all on average: averaged over resamples, the bootstrap mean is the sample mean itself.