Skip to content

Fix shap with vector intercept.#11764

Merged
trivialfis merged 4 commits into
dmlc:masterfrom
trivialfis:fix-shap
Oct 21, 2025
Merged

Fix shap with vector intercept.#11764
trivialfis merged 4 commits into
dmlc:masterfrom
trivialfis:fix-shap

Conversation

@trivialfis

Copy link
Copy Markdown
Member

No description provided.

@trivialfis trivialfis mentioned this pull request Oct 20, 2025
3 tasks
@trivialfis

Copy link
Copy Markdown
Member Author

cc @rongou

@trivialfis
trivialfis requested a review from Copilot October 21, 2025 00:35

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes SHAP value computation when using a vector intercept (base_score) instead of a scalar value. The changes ensure that multi-class classification models correctly use per-class base scores during SHAP contribution calculations.

Key Changes:

  • Updated GPU and CPU predictors to properly index vector base_score values using group/class indices
  • Added test coverage for multi-class SHAP computation with vector base_score
  • Fixed accessor parameter passing to use move semantics instead of references

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.

File Description
src/predictor/gpu_predictor.cu Fixed SHAP computation to use per-class base scores by properly indexing with group ID
src/predictor/cpu_predictor.cc Updated CPU predictor to use per-class base scores and changed accessor parameters to value types with move semantics
tests/python-gpu/test_gpu_prediction.py Added test case verifying SHAP values are consistent between GPU/CPU with vector base_score
tests/cpp/predictor/test_predictor.cc Updated C++ test to use vector base_score format

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

Comment thread src/predictor/cpu_predictor.cc Outdated
@trivialfis
trivialfis merged commit c2d06bd into dmlc:master Oct 21, 2025
63 checks passed
@trivialfis
trivialfis deleted the fix-shap branch October 21, 2025 01:31
trivialfis added a commit to trivialfis/xgboost that referenced this pull request Oct 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants