-
Notifications
You must be signed in to change notification settings - Fork 776
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 update #522
Causal trees update #522
Conversation
Thanks @alexander-pv for your much needed contribution. We will review the PR soon. |
Hi, @alexander-pv, Sorry for my late review. I thought that I left comments earlier but turned out that I didn't submit them and my review was somehow left pending. Code looks good and thanks for the sample notebook and test code which are very comprehensive. One ask is: let's remove Thanks! |
Hi, @jeongyoonlee , Thanks for the review, I pushed necessary changes. I faced the thing that |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM. Thanks again for your contribution. I really appreciate it!
Hi @alexander-pv, Py 3.7 test failed with the error as follows: Could you please check? If it's something that needs more time, we can merge this PR first and investigate it in a separate thread. |
Hi, @jeongyoonlee, It seems that now everything is fixed 👌. |
Merged! 👍🏻 |
Proposed changes
This PR is mainly about causal trees support.
BaseCausalDecisionTree
inherits everything is needed from scikit-learnBaseDecisionTree
and modifiesfit()
method that stores only appropriate checks for causal trees.CausalTreeRegressor
now hasRegressorMixin
andBaseCausalDecisionTree
parent classes which makes it fully compatible with scikit-learn.criterion.pyx
whereCausalRegressionCriterion
inherits methods from scikit-learnRegressionCriterion
and implementsnode_value()
to save the average of treatment effect for each node.CausalMSE
now is a concrete class with impurity computations for causal trees. I also addedStandardMSE
concrete class which is actually standard MSE criterion from scikit-learn with modifiednode_value()
method. So, now it is easy to add new criteria and see the influence of each criteria on a causal tree fit .CausalTreeRegressor
now has multiprocessing support.CausalTreeRegressor
with standard scikit-learn function.CausalTreeRegressor
can calculate the number of treatment and control observations in each leaf,_leaves_groups_cnt
low-level attribute. Additionally,plot_dist_tree_leaves_values
function gives the distribution of ATE in a tree leaves.CausalRandomForestRegressor
based on scikit-learn withCausalTreeRegressor
asbase_estimator
.calculate_error
inCausalRandomForestRegressor
calculates unbiased sampling variance. Source.causal_trees_with_synthetic_data.ipynb
withCausalTreeRegressor
andCausalRandomForestRegressor
models.test_causal_trees.py
Makefile
contains install, build, test, clean. Now you can simply typemake test
. Cython code compilation is under the hood.setup()
function insetup.py
now knows aboutrequirements-test.txt
dependencies thanks totests_require
parameter. No need to install them manually.Types of changes
What types of changes does your code introduce to CausalML?
Put an
x
in the boxes that applyChecklist
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.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.