Visual explainer
Bagging vs Boosting
Two fixes for weak trees: average parallel hands to calm variance or chain fixes to melt bias.
Individual decision trees fail in one of two distinct ways. Fully grown, unconstrained trees exhibit high variance: their decision boundaries fluctuate wildly in response to small training perturbations, overfitting sample noise. In contrast, shallow decision stumps exhibit high bias: their rigid single-split axis cuts underfit the problem, persistently misclassifying non-linear class distributions. Ensemble algorithms resolve this trade-off by combining collections of learners.
Deal Overlapping Hands
Bootstrap Aggregation (Bagging) reduces variance through parallel randomization. Drawing instances with replacement from a dataset of size generates overlapping bootstrap folds, each containing approximately unique samples while leaving out-of-bag. Multiple deep decision trees are trained independently and in parallel across these distinct data views, with no communication between models.
Chase the Leftover
Boosting reduces bias through sequential error correction. Rather than training models independently, each base learner directly attacks the errors made by its predecessors. When the true label is and the initial model predicts , the leftover residual is . The subsequent tree is trained with this residual as its explicit optimization target, gradually refining the global prediction.
Combine the Votes
The two paradigms aggregate predictions through fundamentally different voting rules. Bagging treats all ensemble members as equal peers: individual classifications are averaged uniformly as . Boosting computes a linear combination of stage-weighted predictors , where highly accurate base models earn larger voting coefficients: .
Calmer and Sharper
Both strategies produce dramatic empirical improvements on identical datasets. For correlated trees with pairwise correlation , averaging 5 parallel trees cuts prediction variance from down to . In parallel, chaining 20 boosted stumps drives cumulative residual bias down from toward , turning blunt weak learners into sharp boundary sculptors.
Choose by the Data
Selecting between bagging and boosting depends on dataset noise characteristics. When datasets contain noisy labels or measurement contamination, choose Bagging: parallel averaging washes out random label errors. When labels are reliable and clean but model capacity lags behind a complex signal, choose Boosting: iterative residual optimization carves intricate non-linear frontiers.
Where It Breaks
Sequential residual fitting creates a critical vulnerability when confronted with mislabeled outliers. In Bagging, an erroneous point only appears in a subset of bootstrap samples and is easily outvoted by the honest majority. In Boosting, an uncorrectable mislabeled sample generates persistent, massive residuals; successive boosting rounds assign it escalating weights, ultimately warping the decision boundary into an unnatural loop around the corrupted dot.
The Quick Version
- Deep trees suffer high variance; shallow stumps suffer high bias.
- Bootstrap sampling deals overlapping subsets with replacement.
- Sequential boosting trains each base tree on prior residuals.
- Bagging averages equal votes; boosting sums earned stage weights.
- Averaging cuts variance to 0.52; chaining reduces bias to 0.2.
- Bagging cleans noisy labels; boosting sculpts intricate signals.
- Mislabeled outliers warp sequential boosting boundaries into loops.