How do you determine the optimal weights for a weighted-average ensemble?

Quick Overview

Asks how to choose the weights for a weighted-average ensemble of machine learning models. It tests whether you fit the weights on the right data, optimize them against the real metric with sensible constraints, and keep them from overfitting.

How do you determine the optimal weights for a weighted-average ensemble?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How do you determine the optimal weights for a weighted-average ensemble? You have several trained models whose predictions are combined as a weighted average, and you need to choose the weights. ```hint Which predictions to fit on The weights are parameters fitted to data. Think about which set of predictions gives an honest picture of how each model behaves on rows it has not seen. ``` ```hint Treat it as a small optimization problem Write the ensemble's loss as a function of the weight vector, then ask which constraints keep the weights sensible and how few data points are really behind them. ``` ### What a Strong Answer Covers - Which predictions the weights are fitted on, and why training-set predictions mislead - How the weights are optimized against the target metric, and which constraints apply - Alternatives to direct optimization and when each one fits (few models, non-differentiable metrics) - How to stop the weights from overfitting and how to validate them - How correlation between models affects the fitted weights ### Follow-up Questions - When would you move from a weighted average to a stacking meta-model? - How would you fit the weights when the target metric is AUC, which is not differentiable in the weights? - Two of your models have predictions that are 0.98 correlated. What happens to their weights, and what would you do about it? - Should the weights be allowed to differ across segments of the data, and how would you check whether that helps?

Overview: Asks how to choose the weights for a weighted-average ensemble of machine learning models. It tests whether you fit the weights on the right data, optimize them against the real metric with sensible constraints, and keep them from overfitting.

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

How do you determine the optimal weights for a weighted-average ensemble?

You have several trained models whose predictions are combined as a weighted average, and you need to choose the weights.

What a Strong Answer Covers Guidance

  • Which predictions the weights are fitted on, and why training-set predictions mislead
  • How the weights are optimized against the target metric, and which constraints apply
  • Alternatives to direct optimization and when each one fits (few models, non-differentiable metrics)
  • How to stop the weights from overfitting and how to validate them
  • How correlation between models affects the fitted weights

Follow-up Questions Guidance

  • When would you move from a weighted average to a stacking meta-model?
  • How would you fit the weights when the target metric is AUC, which is not differentiable in the weights?
  • Two of your models have predictions that are 0.98 correlated. What happens to their weights, and what would you do about it?
  • Should the weights be allowed to differ across segments of the data, and how would you check whether that helps?