Skip to content
Quantoros

Why does XGBoost predcontribs return one more value than the number of input features?

Classic MLLevel: IntermediateXGBoost · Prediction

Why does XGBoost pred_contribs return one more value than the number of input features?

Hints
  • Local contributions need a reference value.
  • Reconstruction includes that baseline.

Answer

The extra component is the bias/base contribution. Include it when reconstructing the margin from contributions, and preserve class/group axes for multiclass outputs; do not report it as an extra input feature.

Source and licence: XGBoost · Prediction · Apache-2.0 · answer: Quantoros editorial

Related questions