The three schools of ensemble learning. Bagging (random forests): base learners train independently and in parallel, each on its own bootstrap sample, voting/averaging at inference — base learners should be strong (deep, unpruned trees); it mainly reduces variance. Boosting (AdaBoost / GBDT / XGBoost / LightGBM): base learners are sequential and dependent, each round focusing on the previous residuals (negative-gradient pseudo-residuals) or misclassified samples (amplified weights), combined additively with weights — base learners should be weak (shallow trees); it mainly reduces bias. Stacking: heterogeneous base learners plus a meta-learner; the base learners' outputs (probabilities or classes) become meta-features for a second-level model (typically logistic regression or a linear model) that learns the optimal combination — it does not require homogeneous base learners and exploits model diversity to reduce both bias and variance; meta-features must be generated via cross-validation/OOF folds, otherwise the base learners have already seen the samples and the meta-features leak, overfitting the meta-model. Theory: bias-variance decomposition
Err=bias2+variance+σϵ2; averaging
k learners with variance
σ2 and pairwise correlation
ρ gives
Var(fˉ)=ρσ2+k1−ρσ2 — bagging reduces variance by lowering
ρ via sample/feature randomization and growing
k, leaving bias unchanged; boosting reduces bias directly by fitting negative-gradient residuals round by round (weak learners are bias-dominated); stacking breaks error correlation through heterogeneity and lets a meta-learner learn the combination weights. Selection rule of thumb: high-variance settings (little data, strong models) → bagging; high-bias settings (weak models, underfitting) → boosting; multiple complementary strong models → stacking.