1. University MCA (AI/ML) Semester 2
  2. CAB212
  3. Unit 4

CAB212 · Unit 4: Ensemble learning

Voting and stacking

6 practice questions

Key points

  • Hard vote = majority; soft vote = mean probability
  • Stacking trains a meta-learner
  • Use out-of-fold predictions
  • Diversity matters

Other ways to combine models:

  • Hard voting: majority class among models. Soft voting: average predicted probabilities, then choose the largest (usually better when probabilities are reliable).
  • Stacking: a meta-learner is trained on the predictions of base models (often a different algorithm family, such as k-NN, SVM and trees). To avoid leakage, the meta-features are made with out-of-fold predictions.
  • Blending: like stacking but uses a single hold-out set.

Diverse, individually decent models with uncorrelated errors give the biggest ensemble gain.

Worked example: three classifiers output P(positive) = 0.9, 0.4, 0.4. Soft voting average = 0.567, so predict positive; hard voting gives 1 positive vs 2 negative, so predict negative.

Exam pitfall: if all base models make the same mistakes, combining them adds nothing.

Try two questions

Question 1 · Tier 3, Apply

In stacking, the meta-learner is trained on:

  1. Raw pixel values of the original images only
  2. Predictions of the base models
  3. The true labels of the test set
  4. Random noise features added for diversity
Show the answer

B. Base predictions become its input features.

Question 2 · Tier 2, Understand

For the same three models, hard voting (each thresholded at 0.5) predicts:

  1. Positive
  2. Negative
  3. Tie
  4. Positive with probability 0.9
Show the answer

B. Only one of three votes positive.