- Introduced by
- Lam & Suen; Kuncheva, L. I. (systematic treatment)
- Year
- 1990s–2004
- Type
- Ensemble (combination of multiple classifiers by vote)
- Family
- Machine learning
What does it do?
A voting ensemble trains several classifiers independently and combines their predictions by a vote.
Hard voting selects the class chosen by the most models, while soft voting averages their class-probability estimates, optionally with per-model weights. Whether the combination beats its best member depends on the members being reasonably accurate and making different errors, and no further training is needed once the base models are fitted.
The intuition behind the method
Imagine asking five doctors for a diagnosis and going with the majority opinion. Each physician may err in different ways, but pooling their verdicts can cancel some idiosyncratic mistakes. A voting ensemble works the same way: if the models fail on different examples, their combined vote can be more reliable than any single model. Soft voting goes further by letting more confident models contribute proportionally more to the final decision through their probability scores.
History
Combining classifiers by voting has been studied in pattern recognition. In general terms, Kuncheva (2004) is a book-length treatment of combining pattern classifiers, and its combination rules include voting. Dietterich (2000) gives an overview of ensemble methods in machine learning. Soft voting is available in practice through scikit-learn's VotingClassifier, which allows different estimators to be combined in a single interface.
When to use it
Use a voting ensemble when you already have two or more trained classifiers that are reasonably accurate and differ in their error patterns, and you want a simple combination without training a meta-learner. Soft voting is appropriate when the base models output probabilities that are reasonably calibrated; otherwise hard voting is the safer choice. Do not use a voting ensemble when the members are weak or make largely the same errors, since combining them will not add much. To check diversity, compare the members on a held-out set: the share of examples on which two members disagree, or the correlation between their error indicators, should be low, while each member remains individually accurate. Avoid a voting ensemble when stakeholders or regulation require a single model that can be inspected directly, because the combined predictor is harder to explain than any one member. This page covers classification only; regression ensembles combine numeric predictions by averaging rather than voting and are outside its scope.
Limitations and considerations
- Gains are small or absent when base learners make highly correlated errors, because a majority vote then reproduces the same mistake.
- Soft voting assumes that the base learners' probability outputs are calibrated and comparable; uncalibrated scores can dominate the average for the wrong reasons.
- Inference cost grows linearly with the number of base learners, since every member must be evaluated for each new input.
- The combination rule is fixed in advance: unless weights are set manually, the ensemble cannot learn which member to trust on which kind of input, which a stacking meta-learner can do.
- Gains depend on conditions that should be checked on held-out data: members must be individually accurate, their errors must be weakly correlated rather than merely different in appearance, and for soft voting their probability outputs must be calibrated and on a comparable scale.
Source conditions do not replace independent scientific review or validation by an analysis engine.
Strengths
- Simple to implement: beyond fitting the base models, there is no meta-learner to train.
- Because the members can come from different model families, the ensemble can combine errors that differ in kind, for example a linear model and a tree-based model.
- Soft voting uses the full probability output of each member, so a confident member can carry more weight than an uncertain one.
- Members can be added or removed without retraining the other base models.
Applications
- Combining a logistic regression, a k-nearest-neighbours classifier and a decision tree trained on the same tabular features, as in the introductory example.
- Hard voting over classifiers that output only labels, where no reliable probabilities are available.
- Weighted soft voting in which each member's weight is set from its performance on a validation split.
- Building a simple ensemble baseline before trying more complex combinations such as stacking or boosting.
How it works
How it works
A set of K base learners, which may come from entirely different model families (for example a logistic regression, a k-nearest-neighbours classifier and a decision tree), are each trained independently on the training set or on their own tuned configuration. Diversity among the base learners matters: models that make the same errors add little when combined.
At inference time every base learner produces a prediction for the new input. For hard voting this is a class label. For soft voting each learner must output a vector of class probabilities, so all chosen base learners need to yield probability estimates that are meaningful and comparable.
In hard voting the ensemble counts how many models predicted each class and returns the label with the most votes. Ties are resolved by a fixed rule (for example, the lowest class index). This mode can be used when base learners do not produce reliable probabilities.
Formula
\hat{y} = \arg\max_c \sum_{k=1}^{K} \mathbf{1}[h_k(x)=c]In soft voting the ensemble averages the class-probability vectors across base learners, using either equal weights or weights w_k, and predicts the class with the highest averaged probability. Because soft voting uses probability magnitudes rather than only the winning labels, it can outperform hard voting when the base learners are well calibrated.
Formula
\hat{y} = \arg\max_c \sum_{k=1}^{K} w_k \, p_k(c \mid x)The ensemble returns the winning class label and, in soft-voting mode, the averaged probability vector, which can be used downstream for threshold adjustment, ranking or calibration checks. No additional training step is required once the base models are fitted.
Common pitfalls
- Tuning base learners on the same data used to estimate the ensemble's accuracy gives optimistic error estimates; keep a separate evaluation split or use cross-validation for both tuning and evaluation.
- Soft voting over uncalibrated scores, such as raw SVM decision values that are not on a probability scale, can produce a weaker result than hard voting.
- Choosing members that are variants of the same model family reduces diversity, so the ensemble adds computation without adding independent evidence.
- If the base learners are trained on imbalanced classes without correction, their votes tend to reinforce the majority-class prediction.
- Comparing the ensemble only against the average member, rather than against the best single member and a simpler baseline on the same held-out data, can overstate its benefit.
Frequently asked questions
How many base learners should I include?
There is no fixed rule. Start with a few diverse, individually accurate classifiers and add members only if they improve performance on a held-out evaluation. Each added member increases inference cost, and beyond a point the extra members tend to make correlated errors and bring little gain.
When should I prefer soft voting over hard voting?
Use soft voting when all base learners produce well-calibrated probability outputs, because it uses the full probability distribution rather than only the winning class. If probabilities are poorly calibrated or unavailable, hard voting is safer.
How do I choose the weights in weighted soft voting?
A simple approach is to weight each model by its accuracy or AUC on out-of-fold cross-validation predictions, so that no example is scored by a model trained on that example. Weights based on performance on the training data itself are biased toward members that overfit. Weights can also be fitted on a separate validation set, but this risks overfitting if that set is small.
How is a voting ensemble different from stacking?
A voting ensemble combines base model outputs with fixed rules (majority vote or average). Stacking trains a meta-learner on the base model outputs to learn the combination, which is more flexible but more complex and prone to data leakage if cross-validation is not used correctly.
Does diversity always improve the ensemble?
Diversity is necessary but not sufficient. Base learners must also be individually accurate; an ensemble of weak but diverse classifiers can still perform poorly. The aim is diverse errors among reasonably accurate models.
Related methods
Sources
Kuncheva, L. I. (2004). Combining Pattern Classifiers: Methods and Algorithms. Wiley-Interscience.
ISBN: 978-0-471-21078-8Dietterich, T. G. (2000). Ensemble Methods in Machine Learning. In J. Kittler & F. Roli (Eds.), Multiple Classifier Systems (MCS 2000), Lecture Notes in Computer Science, vol 1857, pp. 1–15. Springer.
Open DOI reference