TL;DR
Ensemble learning trains several models on the same problem and combines their predictions, usually by averaging or voting. One model is often noisy, but the mistakes of different models do not always point the same way, so combining them cancels part of the error. The result is usually more accurate and more stable than any single member.
The trick only works if the members disagree in useful ways. Identical models give you nothing new, so every ensemble method is really a recipe for making models different from each other while keeping each one good.
Where you'll see it: random forests in tabular machine learning, gradient-boosted trees in many competition and industry systems, and the "model soup" and checkpoint-averaging tricks used to polish large neural networks.
Intuition
Ask a crowd
Suppose you want to guess the weight of an ox at a county fair. One guess from one person is a gamble. Francis Galton, reporting on a contest in 1907, found that the median of about 800 guesses was within a percent of the true weight, even though many individual guesses were far off. The crowd was not smarter than any one person. Each guess had its own random error, and those errors partly cancelled when pooled.
A model is the same kind of guesser. It learns from a finite training set, so it picks up a particular pattern of noise along with the signal. A different training set would produce a different pattern of noise. If you train several models and average them, the parts of their errors that are specific to their own training data tend to cancel, while the shared signal stays.
Why a single model is not enough
A flexible model has low bias but high variance: it follows the training data closely, including its noise, so it overfits and gives different answers on different samples. A rigid model has the opposite problem. Ensembles are the practical way out of this trade-off. Averaging many high-variance models keeps the low bias and shrinks the variance.
- correlation 0.3
- independent models
The plot shows the key limit. Adding models helps quickly at first and then flattens. The floor is set by how correlated the models are, which is why the ensemble methods below spend most of their effort on decorrelating their members.
Two families
There are two broad strategies. Parallel ensembles train members independently and average them; the goal is to reduce variance. Sequential ensembles train each member to fix the mistakes of the ones before it; the goal is to reduce bias. Bagging and random forests are the first kind. Boosting is the second.
flowchart LR D["Training data"] --> R1["Resample 1"] D --> R2["Resample 2"] D --> R3["Resample 3"] R1 --> M1["Model 1"] R2 --> M2["Model 2"] R3 --> M3["Model 3"] M1 --> A["Average or vote"] M2 --> A M3 --> A A --> P["Final prediction"]
The math
Averaging M predictions
Let be predictors of a target , and let be their average. Each has variance over training sets, and every pair has correlation , meaning covariance . The variance of the average is
There are diagonal terms, each equal to , and off-diagonal terms, each equal to . So
Two limits follow directly. If , the variance is , which goes to zero as grows. If , the variance can never drop below , however many models you add. Correlation sets the floor. This is the formula behind the plot above, with .
Averaging does nothing to bias. If every member has the same expected prediction, the average has that same expectation. Ensembles of identical-bias models lower variance only.
Bagging
Bootstrap aggregating, or bagging, trains each member on a bootstrap sample: draw points from the -point training set with replacement. A given point is missed by one draw with probability , so it is missed by all draws with probability , which approaches . Each bootstrap sample therefore contains about 63.2% distinct original points, and the rest are duplicates. The resamples are different enough to make the members less correlated than models trained on the full data. See Bootstrap Sampling for the resampling idea itself.
For regression, the ensemble prediction is the mean of the members. For classification, it is a majority vote, or the average of predicted probabilities.
Random forests
A random forest is bagging of decision trees with one extra step. At each split, the tree may consider only a random subset of the features. This stops one strong feature from dominating every tree, which would make all the trees alike. Lower correlation means a lower floor in the formula above, so the extra randomness often matters more than the extra trees.
Boosting
Boosting builds members one after another. Each new learner focuses on the examples the previous ones got wrong. In AdaBoost, which is the classic version for binary labels , each example has a weight . After training weak learner with error (weighted by the current ), it gets a vote
which is large when the learner is accurate. The weights are then updated so that misclassified points gain weight, and the final model is
Gradient boosting generalises this: each new tree is fitted to the negative gradient of the loss at the current ensemble, so the same idea works for any differentiable loss.
Worked examples
Each of three classifiers is correct on a new point with probability , and their errors are independent. The majority is correct when at least two of the three are correct.
- Probability all three are correct: .
- Probability exactly two are correct: .
- Majority is correct: .
The ensemble is right 78.4% of the time, against 70% for any single member. The gain comes entirely from independence. If the three classifiers always erred together, the majority would be right 70% of the time, the same as one of them.
Five regression models each have prediction variance , and every pair has correlation .
- Floor from correlation: .
- Variance of the average with : .
- Standard deviation of the average: , down from for a single model.
- With : . Going from 5 to 50 models buys only a little.
- If the same five models were uncorrelated (), the variance would be .
Interpretation: decorrelation is worth more than extra members here. A random forest that drops from 0.25 to 0.05 gets a floor of 0.2 instead of 1.0.
Tradeoffs and failure modes
| Situation | Problem | Better choice |
|---|---|---|
| Single model overfits badly, data is plentiful | High variance | Bagging or random forest |
| Single model underfits, bias dominates | Averaging will not fix it | Boosting, or a more flexible model |
| Members are nearly identical (same data, same features) | Correlation near 1, no gain | Add randomness to data or features |
| Latency or memory budget is tight | Many members cost time and space | Distil the ensemble into one model (Knowledge Distillation) |
| Boosting on noisy labels | Weights chase mislabelled points | Bagging, or boosting with a robust loss |
| Interpretability is required | An average of hundreds of trees is opaque | One tree, or a simpler linear model |
Ensembles also cost more to train and serve, and they can hide errors: a wrong but confident majority is still wrong. Always check the ensemble against a held-out split, not against the members' training scores.
History
The idea that pooled judgement beats individual judgement is old. Galton's 1907 ox-weight observation is the usual example. In machine learning, Wolpert described stacking, which learns how to combine member predictions, in 1992. Breiman introduced bagging in 1996, and he later described random forests in 2001 as a method that adds feature randomness to bagged trees.
Boosting came from a theoretical question: could a collection of weak learners, each only slightly better than guessing, be combined into a strong one? Schapire showed in the early 1990s that the answer is yes. Freund and Schapire then produced AdaBoost, which was practical and fast, in the mid-1990s. Friedman's gradient boosting in the early 2000s extended it to general losses.
Ensembles became standard in practice because they were reliable. They rarely needed careful tuning, they handled messy tabular data well, and they regularly won benchmark competitions. Deep learning later adopted the same idea in cheaper forms, such as averaging checkpoints and training several networks with different seeds.
Check yourself
QuestionIn one sentence, what does an ensemble do to variance, and what does it not do to bias?Show answer
Averaging the predictions of several models reduces the variance of the combined prediction, because individual models' training-specific errors partly cancel. It does not reduce bias on its own: if every member has the same expected prediction, the average has that expected prediction too.
QuestionThree independent classifiers are each right with probability 0.6. What is the probability that the majority vote is right?Show answer
Majority is right when at least two of three are right. Exactly three: . Exactly two: . Total: . The vote is right 64.8% of the time, against 60% for one member.
QuestionWhy does adding more members stop helping once the number of models is large, if their pairwise correlation is ?Show answer
From , the term that shrinks with is , and the term does not depend on . Once is large, the correlated part dominates and no number of extra members can push the variance below . Reducing is the only way to lower that floor.
QuestionA bootstrap sample has draws from 1000 points. Roughly how many distinct original points does it contain, and why?Show answer
Each point is missed by all draws with probability . So about 63.2% of points appear, which is about 632 distinct points. The other 368 slots are repeats, and that repetition is what makes bagged members differ from one another.
QuestionYou are building a fraud detector. Your gradient-boosted ensemble scores 99% on the training set and 81% on the held-out set. Which step would you take first, and why?Show answer
The gap points to overfitting: the ensemble has memorised training-set quirks. First, check the depth, learning rate, and number of trees, and use early stopping on a validation split so that the number of boosting rounds is chosen from held-out data, not training data. Adding more boosting rounds would not close the gap and can widen it. Also confirm that no training features leak the label.