Unify DART SHAP forwarding#12073
Merged
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR is groundwork toward treating DART as a weighted GBTree by removing DART-specific SHAP forwarding overrides and routing SHAP contribution/interaction prediction through the shared GBTree path, with DART supplying per-tree weights via a shared accessor.
Changes:
- Add a
GBTree::TreeWeights()virtual accessor and pass it into predictor contribution/interaction APIs. - Remove DART overrides for SHAP forwarding and instead provide DART weights via
TreeWeights(). - Add CPU/GPU tests that exercise SHAP contributions/interactions for a DART-trained model.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tests/cpp/predictor/test_shap.h | Exposes CheckDartShapOutput helper for both CPU and GPU test TUs. |
| tests/cpp/predictor/test_shap.cc | Implements CheckDartShapOutput and adds a CPU unit test for DART SHAP additivity. |
| tests/cpp/predictor/test_shap.cu | Adds a GPU unit test for DART SHAP additivity. |
| src/gbm/gbtree.h | Routes SHAP contribution/interaction prediction through shared path and passes TreeWeights(). |
| src/gbm/gbtree.cc | Removes DART SHAP forwarding overrides; supplies DART weights through TreeWeights(). |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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.
This PR is another small step toward the follow-up work to remove
GBDartas a separate booster and treat DART as weightedGBTreeprediction/training behavior. It removes the DART-specific SHAP forwarding overrides and routes contribution and interaction prediction through the sharedGBTreepath, with DART supplying tree weights through a shared accessor. The scope here is intentionally limited to SHAP forwarding; serialization, training behavior, and booster identity are unchanged. This is groundwork for the larger PR that removesGBDart.