How does stacking (stacked generalization) work?

Quick Overview

Asks how stacking, also called stacked generalization, combines several base models through a second-level model. Tests the out-of-fold training procedure, inference with refit base models, choices for the meta-learner, and how stacking differs from voting and blending.

How does stacking (stacked generalization) work?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: easy

Interview Round: Other

How does stacking (stacked generalization) work? Describe how a stacked ensemble is trained and how it makes predictions on new data. ```hint Where the second model's features come from Ask what the combining model would learn if it saw each base model's predictions on the same rows that base model was trained on. ``` ### What a Strong Answer Covers - The two levels: base models, and a meta-learner trained to combine their predictions - The K-fold out-of-fold procedure that builds the meta-learner's training features, and how inference works afterward - Why in-sample base-model predictions would mislead the meta-learner - Reasonable choices for the base models and the meta-learner - How stacking differs from voting and from blending ### Follow-up Questions - Why does stacking five gradient-boosted models with slightly different settings usually gain little? - When would you pass the original features through to the meta-learner, and what is the risk? - For a regression stack, why might you constrain the meta-learner's weights to be non-negative? - How would you measure whether the stack is better than its best base model?

Overview: Asks how stacking, also called stacked generalization, combines several base models through a second-level model. Tests the out-of-fold training procedure, inference with refit base models, choices for the meta-learner, and how stacking differs from voting and blending.

PracHub logo
General
Nov 25, 2026
easyMachine Learning EngineerOtherMachine Learning
0
0

How does stacking (stacked generalization) work?

Describe how a stacked ensemble is trained and how it makes predictions on new data.

What a Strong Answer Covers Guidance

  • The two levels: base models, and a meta-learner trained to combine their predictions
  • The K-fold out-of-fold procedure that builds the meta-learner's training features, and how inference works afterward
  • Why in-sample base-model predictions would mislead the meta-learner
  • Reasonable choices for the base models and the meta-learner
  • How stacking differs from voting and from blending

Follow-up Questions Guidance

  • Why does stacking five gradient-boosted models with slightly different settings usually gain little?
  • When would you pass the original features through to the meta-learner, and what is the risk?
  • For a regression stack, why might you constrain the meta-learner's weights to be non-negative?
  • How would you measure whether the stack is better than its best base model?