Additivity check fails with XGBoost
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Bug
- Clarity
- Needs clarification
- Activity status
- Stale
- Tech stack
- python
- Domain
- machine-learning
Research direction
Start by running the reported XGBRegressor example with xgboost 1.7.6, shap 0.41.0, and fasttreeshap 0.1.6, then compare it with the native SHAP and LightGBM cases. Inspect fasttreeshap.TreeExplainer's additivity-check path and its XGBoost handling, including the linked issue, to identify why the check fails. Done means the XGBoost example completes without the additivity exception while the check remains valid.
Written by the indexing model from the issue text.
Description
Hi,
when using XGB, the additivity check fails, while it does not when using native shap or lightgbm
Using xgboost 1.7.6, shap 0.41.0 and fasttreeshap 0.1.6
could it be linked to https://github.com/linkedin/FastTreeSHAP/issues/15 ?
example (changing algorithm or feature_perturbation lead to the same error):
from sklearn.datasets import make_regression
from xgboost import XGBRegressor
from lightgbm import LGBMRegressor
from fasttreeshap import TreeExplainer as FastTreeExplainer
X, y = make_regression(n_samples=1000, n_features=10, n_informative=8, noise=1, random_state=8)
model = XGBRegressor() #LGBMRegressor()
model.fit(X, y)
explainer = FastTreeExplainer(model, algorithm="auto", shortcut=False, feature_perturbation="tree_path_dependent")
shap_matrix = explainer.shap_values(X)
Exception: Additivity check failed in TreeExplainer! Please ensure [...]
The following runs fine
explainer = shap.TreeExplainer(model, feature_perturbation="tree_path_dependent")
shap_values = explainer.shap_values(X)
Thanks
- Dominant language
- Python
- Stars
- 566
- Forks
- 38
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from linkedin/FastTreeSHAP
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
linkedin/FastTreeSHAP#37 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 48/100
linkedin/FastTreeSHAP#36 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 35/100
linkedin/FastTreeSHAP#35 · 1 comment ·
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
linkedin/FastTreeSHAP#34 ·
-
Difficulty 3/5 1-2 days Newbie friendliness 30/100
linkedin/FastTreeSHAP#33 · 2 comments ·
All issues in linkedin/FastTreeSHAP
Similar issues
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
use-agent-os/agent-os#3314 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 75/100
BasedHardware/omi#15662 · 1 comment ·
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
AiursoftWeb/AnduinOS-2#19 ·