Bagging improves predictive reliability by training multiple models on bootstrapped versions of the training data and aggregating their predictions. It is an averaging ensemble: regression predictions are averaged, while classification predictions use majority voting. The main practical goal is to reduce prediction variance without greatly increasing bias. section 5.1.1 section 5.6
Use bagging as one member of a broader family of sampling-based averaging strategies:
- Pasting samples training examples without replacement. section 5.1.1
- Bagging samples training examples with replacement, also called bootstrapping. section 5.1.1 section 5.6
- Random subspaces sample features, while random patches sample both training examples and features. section 5.1.1
A bagged tree classifier
A practical classifier can use scikit-learn's BaggingClassifier with a DecisionTreeClassifier base estimator, 300 estimators, bootstrapping enabled, and all samples and features available to each model. A preprocessing pipeline can one-hot encode categorical columns and pass through numeric columns. The recorded result is an accuracy of 0.809 with a 0.004 variation, requiring 37.93 seconds to fit and 0.83 seconds to predict.
Bagging can improve results by making predictions less sensitive to the quirks of one training sample. The trade-off is computational cost and possible bias when sampling excludes important parts of the data distribution. Random forests extend the idea by combining bootstrapped samples with feature subsampling. section 5.1.1 section 5.6



