Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Causal trees interpretation example #536

Merged

Conversation

alexander-pv
Copy link
Collaborator

@alexander-pv alexander-pv commented Aug 21, 2022

Proposed changes

Hi, I included causal_trees_interpretation.ipynb with an example of sklearn feature importance and shap for causal trees.
The related PR of causal trees support in shap: shap/shap#2654

Additional minor changes:

  • Makefile update to prevent cython from compilation errors in case of missing cython or sklearn.
  • Basic Cython directives in builder.pyx to make cython compilation work as expected.

Types of changes

What types of changes does your code introduce to CausalML?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Checklist

Put an x in the boxes that apply. You can also fill these out after creating the PR. If you're unsure about any of them, don't hesitate to ask. We're here to help! This is simply a reminder of what we are going to look for before merging your code.

  • I have read the CONTRIBUTING doc
  • I have signed the CLA
  • Lint and unit tests pass locally with my changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have added necessary documentation (if appropriate)
  • Any dependent changes have been merged and published in downstream modules

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc. This PR template is adopted from appium.

Copy link
Collaborator

@jeongyoonlee jeongyoonlee left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Thanks!

@jeongyoonlee jeongyoonlee merged commit d7473d3 into uber:master Aug 22, 2022
@abdollahpouri
Copy link

Hi @alexander-pv
Thanks for the update. It seems there are some circular module dependencies in the file. I am getting
Cannot import name 'plot_dist_tree_leaves_valuess' from causalml.inferenece.tree....

@alexander-pv
Copy link
Collaborator Author

alexander-pv commented Aug 24, 2022

Hi, @himanData,
That's strange, I can't get the error in this notebook
Actually, row from causalml.inference.tree import plot_dist_tree_leaves_values, get_tree_leaves_mask is just a copy from the previous notebook about causal trees and can be ommited.

@abdollahpouri
Copy link

Thank you. I actually get the same error for CasualRandomForestRegressor
Cannot import name 'CasualRandomForestRegressor' from causalml.inferenece.tree....

@alexander-pv
Copy link
Collaborator Author

It seems that you just mistyped names. Please, check the names in the notebook.

You can also check whether your causalml package is up-to-date or not by looking into <your path to installed python packages>causalml/inference/tree/__init__.py.

@abdollahpouri
Copy link

I am using your .ipynb file.
The text I typed here I just typed it myself so maybe I mistyped it as I am using GitHub on a different laptop so I couldn't just copy and paste it.

Also, I did update the causalml and mine is the same version as the one shown on your notebook

@alexander-pv
Copy link
Collaborator Author

I see. Did you install the package from source?

@abdollahpouri
Copy link

I did it by !pip install casualml within the notebook

@alexander-pv
Copy link
Collaborator Author

alexander-pv commented Aug 24, 2022

The latest changes haven't been released in pypi/anaconda yet. Just install causalml from source.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants