Bagging (Bootstrap Aggregation)
Source: Unit 3 §2
The idea
Problem: splitting the data into disjoint subsets gives each learner too few instances, which brings back overfitting and high variance - the very thing the ensemble was supposed to fix.
Solution - bagging: randomly sample with replacement from the dataset to create new datasets of the same size as the original.
Bagging = Bootstrap AGGregation. Sample with replacement, train a model on each sample, then aggregate the models' predictions.
The 63% / 37% rule
For a sufficiently large sample drawn with replacement, each bootstrap set contains about 63% (roughly two thirds) of the original unique data; about 37% (roughly one third) is left out.
Out-of-bag (OOB) error
- The roughly one third left out of each subset is that learner's out-of-bag (OOB) examples.
- Measure a learner's error only on the samples it did NOT train on, then average across learners.
- Accumulate the OOB error over all data points to get an average error estimate.
- This is close to leave-one-out cross-validation, and it needs no separate validation set.
How many learners?
- Research shows that around 100 learners are usually enough.
- The output can be formulated as class probabilities rather than a hard vote.
Bagging attacks variance, so it pays off most on low-bias, high-variance base learners - unpruned decision trees being the canonical case. On a high-bias model such as a decision stump there is little variance to average away, and bagging buys almost nothing.