Fix XGBoost categorical splits for CPU TreeExplainer with background - #1
Closed
04pallav wants to merge 2 commits into
Closed
Fix XGBoost categorical splits for CPU TreeExplainer with background#104pallav wants to merge 2 commits into
04pallav wants to merge 2 commits into
Conversation
04pallav
force-pushed
the
fix/xgboost-categorical-gpu
branch
from
August 2, 2026 16:54
29872d0 to
fdd1adc
Compare
Add threshold_types=2 for XGB bitmask routing, convert pandas category columns to codes before _cext, and test additivity against output_margin.
04pallav
force-pushed
the
fix/xgboost-categorical-gpu
branch
from
August 2, 2026 16:56
fdd1adc to
0cea3f8
Compare
Keep threshold_types=2 and cat-code conversion CPU-only until GPU track is validated.
Owner
Author
|
Renamed branch to fix/xgboost-categorical-cpu (CPU-only scope). |
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.
Summary
threshold_types=2for XGBoost categorical splits (2^catbitmask; in-set → right, not-in-set → left) intree_shap.hand loader.categorycolumns to integer codes before_cext(_convert_xgboost_categorical_array), so tree routing matches XGBoost training.TestExplainerXGBoostCategorical: background +tree_path_dependentadditivity vsoutput_margin.Fork-only PR — CPU path only. No
_cext_gpuchanges in this PR.Design notes:
contributor-notes/XGB_CATEGORICAL_FIX.mdon branchpersonal/notes.Not in this PR
NotImplementedError; needstree_shap_indepcategorical routing (shared LightGBM gap)_cext_gpu)pred_contribsoutput_marginTest plan
pytest tests/explainers/test_tree.py::TestExplainerXGBoostCategoricalTreeEnsemble.predictand SHAP sums vsoutput_margin(~1e-6)pred_contribs(no-background path)