uber / causalml

Uplift modeling and causal inference with machine learning algorithms
Other
4.87k stars 754 forks source link

SHAP Tree_Explainer failed in notebook #727

Open vincewu51 opened 6 months ago

vincewu51 commented 6 months ago

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):

Additional context Add any other context about the problem here.

vincewu51 commented 6 months ago

@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?

alexander-pv commented 6 months ago

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.

AlanGanem commented 6 months ago

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?

vincewu51 commented 5 months ago

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

seyidcemkarakas commented 5 months ago

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 ?

jeongyoonlee commented 2 months ago

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.

alexander-pv commented 2 months ago

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.