Ensemble learning

Ensemble learning combines the predictions of several machine learning models, by voting, averaging or training them in sequence, to get better results than any one of them would alone.

The idea is the wisdom of a panel. Different models make different mistakes, and when their answers are combined some of those mistakes cancel out. Ensemble methods use several learning algorithms, or several copies of one algorithm trained differently, and merge their outputs into a single prediction.

There are three main recipes. Bagging, described by Leo Breiman in 1996, trains each model on a random sample of the data drawn with replacement and then lets them vote or averages their outputs; random forests extend it by also letting each tree choose from a random subset of features at every split. Boosting trains models one after another, each concentrating on the examples its predecessors got wrong, as in AdaBoost and gradient boosting. Stacking, described by Wolpert in 1992, trains a further model to learn how best to combine the others' predictions.

The recipes suit different ingredients. The scikit-learn documentation notes that bagging works best with strong, complex models such as fully grown decision trees, mainly by reducing how much their predictions swing with the data, while boosting usually works best with weak, simple models. Voting can be hard, taking the majority answer, or soft, averaging the models' probabilities.

Ensembles have a long record of winning competitions. The two leading teams in the Netflix Prize, the film recommendation contest, both blended the predictions of many models. The catch is cost: running many models instead of one multiplies the computing bill. Geoffrey Hinton and colleagues opened their 2015 paper on distillation with exactly this problem, and distillation is one answer to it, compressing an ensemble's knowledge into a single model that is cheaper to deploy.

Ensembles should not be confused with mixture of experts, the design used in many large language models. An ensemble runs separate models and combines all their outputs. A mixture of experts model is one network that sends each input to a few of its specialised parts. For tables of structured data, ensembles of decision trees such as random forests and gradient-boosted trees remain among the strongest everyday tools.

Common questions

What are the main types of ensemble learning?

Bagging trains models in parallel on random samples of the data and combines them by voting or averaging. Boosting trains them in sequence, each correcting the previous ones. Stacking trains an extra model to combine the others' predictions.

Is a random forest an ensemble method?

Yes. A random forest is a bagging ensemble of decision trees, where each tree sees a random sample of the data and a random subset of features at each split. Its prediction is the vote or average of all the trees.

Why do ensembles work better than single models?

Individual models make partly independent errors, so combining them cancels some of those errors out: averaging mainly reduces variance, while boosting also reduces bias. The gain is largest when the models are reasonably accurate but different from each other. Combining near-identical models adds cost without much benefit.

What are the downsides of ensemble learning?

Ensembles cost more to train and to run, since every prediction needs several models. They are also harder to explain than a single simple model. Distillation is sometimes used to compress an ensemble back into one model for deployment.

Finding more

Search for "bagging vs boosting", "stacking ensemble" or "random forest" to see the main methods in use. Reliable sources include the documentation of machine learning libraries such as scikit-learn, statistics and machine learning textbooks, and encyclopedia articles that cite the original papers. Competition write-ups are useful for practical tips, but their gains often come from heavy tuning that may not carry over to production systems.

Working out what this means for your business?

Aileron Shift builds the systems behind this site: AI newsrooms that research, write and publish on their own, marketing automation and WordPress hosting for companies that need to move faster than their competitors.