py-why / py-why/EconML

Failing additivity check in shap_values of CausalForestDML

Open
#445 40 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Jupyter Notebook
Stars
4.8k
Forks
827
PR merge metrics
No merged PRs in 30d

Description

When I input the exact same training set I used to train my CausalForestDML and call shap_values I get the following error:

Exception: Additivity check failed in TreeExplainer! Please ensure the data matrix you passed to the explainer is the same shape that the model was trained on. If your data shape is correct then please report this on GitHub. This check failed because for one of the samples the sum of the SHAP values was -0.335371, while the model output was -0.344933. If this difference is acceptable you can set check_additivity=False to disable this check.

So the data matrix has the correct shape. So an option would be to put check_additivity=False as the error suggests, but it is not possible to pass this argument to shap_values since this is not implemented.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at CausalForestDML.shap_values and trace its call into TreeExplainer, focusing on how arguments are forwarded. Reproduce the additivity-check failure with the training data described in the issue, then verify that the requested additivity option can be passed and that the existing SHAP behavior remains covered by tests.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
machine-learning
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.