179 questions
No questions match those filters.
Bagging versus boosting — when does one fail catastroph...
This is one of the questions in the full AI/ML interview bank. Pro unlocks all 1789 questions; Premium includes the same bank plus the highest daily Practice limit.
See plansBoth are ensemble methods that reduce error relative to a single tree, but through opposite mechanisms — and that mechanism is exactly what predicts how each one breaks.
Bagging (Random Forest is the standard example) trains many trees independently, each on a bootstrap resample of the data, and averages their predictions. Averaging independent estimators reduces variance — no single tree’s idiosyncratic mistake can dominate the final prediction, since it gets diluted by however many other trees disagree with it. This makes bagging inherently robust: it degrades gracefully even on messy, noisy, real-world data, because the failure mode requires many trees to be wrong in a correlated way, which is comparatively rare.
Boosting (XGBoost, LightGBM) trains trees sequentially, and each new tree is explicitly fit to correct the current ensemble’s residual errors. This mechanism reduces bias rather than variance, and typically reaches meaningfully higher accuracy than bagging on clean data — but the same sequential-correction process is exactly what makes it fragile in three specific ways:
- Noisy labels — boosting has no mechanism to distinguish “a hard but genuinely learnable pattern” from “a mislabeled point.” It keeps allocating capacity to fit whatever residual error remains, including errors that are simply wrong labels, and can end up overfitting to noise rather than signal.
- Outliers — a handful of extreme points can dominate the earliest boosting rounds, pulling the ensemble toward fitting them before it’s had a chance to learn the broader, more representative pattern.
- Train/test misalignment — boosting’s aggressive iterative error-correction amplifies any subtle distributional mismatch between train and test into genuine overfitting, whereas bagging’s averaging tends to smooth exactly that kind of misalignment out.
The practical rule: reach for boosting when the labels are trusted and clean and maximum accuracy is the priority; reach for bagging when the data is noisy, labels are imperfect, or consistency and robustness matter more than squeezing out the last few points of benchmark accuracy — a fraud model with 2% label noise, in one real case, went from 0.67 AUC in production with boosting (which had overfit the noise patterns) to a more reliable 0.81 with bagging, a worse peak number that held up far better in practice.