Ensemble
An approach in which the predictions of several models are combined by a single rule to produce a common answer. The models inside an ensemble are called base models.
What it consists of
- Base models each make their own prediction — a class or a number.
- An aggregation mechanism turns these predictions into the final answer.
The base models do not have to be different algorithms: they can be models of the same type trained on different samples or with different settings.
How predictions are combined
| Task | What the models predict | Combination method |
|---|---|---|
| Classification | classes or class probabilities | voting |
| Regression | numbers | averaging, weighted if needed |
With hard voting the class is chosen by majority: \(\hat y = \arg\max_c V(c)\), where \(V(c)\) is the number of votes for class \(c\). With soft voting the probabilities are averaged: \(P(c\mid x)=\frac1M\sum_{i=1}^{M}P_i(c\mid x)\). For regression the predictions are averaged: \(\hat y=\frac1M\sum_{i=1}^{M}\hat y_i\).
When an ensemble helps
The benefit depends on two conditions: the base models must give sufficiently good predictions, and their errors must not coincide completely. If the errors are independent and have the same variance, averaging reduces the variance by a factor of \(M\):
An ensemble does not improve the result automatically. With strongly correlated errors averaging changes almost nothing, weak models stay weak, and a systematic bias (bias) is not removed by averaging. In addition, the cost of computation and memory grows, and the final prediction is harder to explain.