Fix shap with vector intercept.#11764
Merged
Merged
Conversation
Member
Author
|
cc @rongou |
Contributor
There was a problem hiding this comment.
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.
rongou
approved these changes
Oct 21, 2025
trivialfis
added a commit
to trivialfis/xgboost
that referenced
this pull request
Oct 21, 2025
trivialfis
added a commit
that referenced
this pull request
Oct 21, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.