Model averaging: ensembles, bagging and boosting
10 questions on averaging models, why errors cancel, bootstrap samples, bagging, boosting, correlated errors and the cost of ensembles.
- 10 questions
- Stopwatch
- Instant feedback
Sample questions
Play now ↑Answers stay hidden. Start the quiz to play them.
Sample 1
Five models make errors that have zero mean and are completely uncorrelated, and each has an average squared error of 10. What is the expected squared error of their average?
- 2
- 10
- 50
How it works
- One question per screen. An answer is final once sent.
- You see right away whether you were right, with a short explanation.
- The stopwatch runs: on equal scores, the faster player ranks first.
- Only your best attempt counts, so replaying is never risky.
About this quiz
Ask one friend to guess the number of sweets in a jar and the guess may be far off. Ask a hundred friends and average their guesses, and the result is often remarkably close. The individual errors point in different directions, so they largely cancel. Machine learning has used the same idea for decades: instead of searching for the single best model, train several and combine their predictions. Such groups are called committees or ensembles, and they are among the most dependable ways of squeezing extra accuracy out of a modelling problem.
This quiz explains why averaging works and what limits it. You will see how the averaging of predicted distributions is done, and how the argument from the bias-variance trade-off predicts a reduction in error. You will work through a striking calculation in which averaging several models with independent errors divides the error by the number of models, and then see why the result is much more modest in practice, because real models tend to make the same mistakes. You will also see a guarantee that holds regardless: the committee is never worse than the average of its members.
A second thread is about where the variety comes from, since in practice there is only one data set. The best-known trick, the bootstrap, builds new data sets by drawing from the original with replacement, and training one model on each and averaging gives bagging. A very different idea, boosting, trains models one after another, each concentrating on the examples the previous ones got wrong, and combines them by weighted voting. The questions probe how these differ, and the quiz closes by asking about the price paid for all this extra power.
Common misunderstandings include thinking that an ensemble must beat its best member, that models in a committee have to be trained independently, and that averaging is only useful for classifiers. Another is expecting the ideal reduction in error from models that are all trained on the same data in much the same way. Ensembles are also a good lens on how prediction quality and cost trade against each other. A modest committee often gives a bigger improvement than months of tuning a single model, and many winning entries in prediction contests are blends of several. At the same time, a committee that is too costly to run is no use in a product with strict response times, which is why researchers look for cheaper ways of getting a similar effect, including one that the next quiz covers, in which a single network is trained as if it were many.
The quiz suits learners who know the bias-variance trade-off and want to see it put to work, and practitioners who build ensembles by habit. It involves only simple arithmetic. There are 10 questions, each with an explanation, and it takes about four minutes.
Questions and answers
›How long does the quiz take?
About 3 to 4 minutes for 10 questions, at roughly 20 seconds each. An explanation follows every answer, so the quiz works as a quick refresher on ensembles.
›What is a committee or ensemble of models?
It is a group of models trained to solve the same problem whose predictions are combined, instead of picking a single winner. For models that output probabilities, the combined prediction is the average of the individual distributions. For regression, it is the average of the predicted values. The aim is better generalisation than any single member can offer.
›Why does averaging reduce error?
Each model's prediction is the true value plus an error, and when the errors of different models are not perfectly aligned, they partly cancel in the average. In the language of the bias-variance trade-off, averaging reduces the contribution from variance, because the fluctuations that come from the particular training sample are smoothed out.
›What is the bootstrap?
It is a way of making new data sets from an existing one. To build one, you draw as many examples as the original contains, one at a time, putting each back after it is drawn. As a result, some examples occur several times and others not at all. Repeating the process gives as many different data sets as you like.
›What is bagging?
Bagging, short for bootstrap aggregation, trains one model on each bootstrap data set and averages their predictions. The variation between the data sets creates variation between the models, which is what makes averaging worthwhile. Another way of forming an ensemble is to train models with different architectures on the original data.
›How does boosting differ from bagging?
Bagging trains its members independently, while boosting trains them in sequence. Each new classifier is trained on a version of the data in which examples that earlier classifiers got wrong carry a larger weight, and the final prediction is a weighted majority vote. Boosting can turn base classifiers that are only slightly better than guessing into a strong committee.
›Why is the improvement smaller than the ideal calculation suggests?
The ideal reduction assumes that the errors of the models are uncorrelated. Models trained on similar data in similar ways tend to make similar errors, so the errors are strongly correlated and cancel only a little. The guaranteed result is only that the committee's error does not exceed the average error of its members.
›What is the main drawback of ensembles?
Cost. Several models must be trained, and every prediction needs all of them to be evaluated, so the demand for computation and memory grows in proportion to the number of members. How serious that is depends on the application, since a delay that is acceptable for a nightly job may not be for a live service.