causalml icon indicating copy to clipboard operation
causalml copied to clipboard

SHAP Tree_Explainer failed in notebook

Open vincewu51 opened this issue 1 year ago • 8 comments

Describe the bug A clear and concise description of what the bug is. The SHAP Tree Explainer function doesn't support causal ml causaltree It is related to issue Issue 3273 To Reproduce Steps to reproduce the behavior: Run notebook Expected behavior A clear and concise description of what you expected to happen. Model type should be supported by TreeExplainer class

Screenshots If applicable, add screenshots to help explain your problem. Screenshot 2023-12-08 at 10 10 16 AM

Environment (please complete the following information):

  • OS: [macOS]
  • Python Version: [3.9]

Additional context Add any other context about the problem here.

vincewu51 avatar Dec 08 '23 18:12 vincewu51

@alexander-pv Hi Alexander, I believe this is related to the PR you submitted to SHAP. We are creating this issue so we can track the progress. Do we have a workaround to run this before they merge the PR?

vincewu51 avatar Dec 08 '23 18:12 vincewu51

Hi, @vincewu51! For now, perhaps, the only way is to install this fork from source. I believe causalml support in shap will be added soon enough. I've just closed my debt there.

alexander-pv avatar Dec 08 '23 23:12 alexander-pv

Ive installed the fork youve mentioned but am still getting InvalidModelError: Model type not yet supported by TreeExplainer: <class 'causalml.inference.tree.causal.causaltree.CausalTreeRegressor'>

Anything i can do about it?

AlanGanem avatar Dec 27 '23 23:12 AlanGanem

Hi @AlanGanem, the fork should be working. If not, SHAP package will merge the PR soon. You can track it here:Issue 3273

vincewu51 avatar Jan 05 '24 18:01 vincewu51

I have created an issue that similar to your problem => https://github.com/uber/causalml/issues/735

Also I have found a way to plot shap values based on uplift_model.get_shap_values function but I am not clear how to define base_value that SHAP local plots requires. Any ideas ?

seyidcemkarakas avatar Jan 28 '24 17:01 seyidcemkarakas

Hi @AlanGanem, the fork should be working. If not, SHAP package will merge the PR soon. You can track it here:Issue 3273

@alexander-pv, can you follow up on this with the SHAP team? Thanks.

jeongyoonlee avatar Apr 19 '24 16:04 jeongyoonlee

Hi, all! Over the past few months, there have been over a hundred commits in shap project, so I updated https://github.com/shap/shap/pull/3273 to speedup the process. The PR is expected to be in the next 0.46.0 shap release according to the milestone.

alexander-pv avatar Apr 21 '24 11:04 alexander-pv