Voting: combine predictions directly
In hard voting, each classifier casts a class vote and the majority wins. In soft voting, the classifier probabilities are averaged, then the largest average determines the class. Soft voting can use confidence information, but it assumes those probabilities are meaningfully comparable; calibration may matter.
Voting helps when models make complementary errors. If every model makes the same wrong predictions, a vote cannot correct them. Adding a weak or highly correlated model can leave the result unchanged or make it worse.
Stacking: learn the combination
Stacking treats base-model predictions as features for a second model, called the meta-learner. For example, the meta-learner might learn to trust a linear classifier in one region and a tree in another.
The meta-learner must be trained on out-of-fold predictions. Split the training data into folds; for each fold, fit each base model on the other folds and predict the held-out fold. Combine those held-out predictions to train the meta-learner. This prevents the meta-model from learning from base-model predictions made on examples the base models already fitted. Afterward, refit base models on all training data for prediction. Use a separate validation or test procedure to evaluate the entire stack.
Explore how models combine
The visualiser shows three base classifiers with different decision boundaries. Adjust Stump on a: threshold, Stump on b: threshold, and Radius rule: threshold to see how their errors overlap. A useful combination needs models that are individually informative and do not fail on exactly the same cases.
Compare the combined result with its strongest single model. If the ensemble does not improve the relevant validation metric enough to justify added cost and complexity, keep the simpler model.
Choosing among the approaches
| Method | How it combines | Main requirement |
|---|
| Hard voting | Majority class vote | Base models should make useful, complementary predictions. |
| Soft voting | Mean of class probabilities | Scores should be comparable; check calibration and tune weights on validation data. |
| Stacking | A learned meta-model over base predictions | Train on out-of-fold predictions and validate the whole pipeline. |
Ensembling can improve accuracy, but it increases training, serving and debugging costs. The best score on the training data is not evidence of better generalisation. Use cross-validation for model selection and keep the test set for the final comparison.