How does the scale_pos_weight hyperparameter modify the boosting objective for imbalanced datasets?

Quick Overview

Asks how the scale_pos_weight setting in gradient boosting changes the training objective on imbalanced binary data. It tests how per-class weights flow into gradients, hessians, split gains and leaf values, and how class weighting affects probability calibration.

How does the scale_pos_weight hyperparameter modify the boosting objective for imbalanced datasets?

Role: Machine Learning Engineer

Category: Machine Learning

Difficulty: medium

Interview Round: Other

How does the `scale_pos_weight` hyperparameter modify the boosting objective for imbalanced datasets? Assume a gradient-boosted tree model such as XGBoost or LightGBM trained with the binary logistic objective. ```hint Per-example quantities Write the gradient and hessian of the logistic loss for one example, then ask what multiplying that example's loss by a constant does to them. ``` ```hint After training Think about what the model's average predicted probability will be once the two classes carry equal total weight. ``` ### What a Strong Answer Covers - How the weight enters the loss, gradient and hessian of positive examples - Where the weight shows up in split gain, leaf values and the minimum child weight check - The usual starting value and why it is still tuned - The effect on predicted probabilities and calibration, and how to handle it - Library-specific limits and alternatives ### Follow-up Questions - How would you convert the weighted model's predictions back to probabilities at the true base rate? - How does `scale_pos_weight` compare with oversampling the minority class or moving the decision threshold? - Why can a large weight interact badly with `min_child_weight` and the size of each leaf update?

Overview: Asks how the scale_pos_weight setting in gradient boosting changes the training objective on imbalanced binary data. It tests how per-class weights flow into gradients, hessians, split gains and leaf values, and how class weighting affects probability calibration.

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

How does the scale_pos_weight hyperparameter modify the boosting objective for imbalanced datasets?

Assume a gradient-boosted tree model such as XGBoost or LightGBM trained with the binary logistic objective.

What a Strong Answer Covers Guidance

  • How the weight enters the loss, gradient and hessian of positive examples
  • Where the weight shows up in split gain, leaf values and the minimum child weight check
  • The usual starting value and why it is still tuned
  • The effect on predicted probabilities and calibration, and how to handle it
  • Library-specific limits and alternatives

Follow-up Questions Guidance

  • How would you convert the weighted model's predictions back to probabilities at the true base rate?
  • How does scale_pos_weight compare with oversampling the minority class or moving the decision threshold?
  • Why can a large weight interact badly with min_child_weight and the size of each leaf update?