-
Notifications
You must be signed in to change notification settings - Fork 777
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
Add delta-delta-p (ddp) tree inference approach #327
Add delta-delta-p (ddp) tree inference approach #327
Conversation
causalml/inference/tree/models.py
Outdated
leftScore1 = evaluationFunction(leftNodeSummary, control_name=self.control_name) | ||
rightScore2 = evaluationFunction(rightNodeSummary, control_name=self.control_name) | ||
gain = np.abs(leftScore1 - rightScore2) | ||
gain_for_imp = (len(X_l) * leftScore1 - len(X_r) * rightScore2) |
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.
@jroessler I'm not familiar with this method, but just want to confirm if it's the case that gain
takes the absolute difference while gain_for_imp
doesn't
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.
@paullo0106 Thanks for the pointer! Actually it's a mistake! It should be the absolute value for gain_for_imp
as well. I'll fix it and resubmit.
…P is used with more than two treatment options
I added raising an exception if the DDP approach is used with more than two treatment options as mentioned here: Further, regarding the tests, I added a method called |
Thanks, @jroessler for the contribution. It looks good to me. @t-tte, could you check this PR? |
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.
Thanks for the contribution.
LGTM also.
Proposed changes
As suggested in #300 I implemented the delta-delta-p (in short: DDP) tree based inference method originally proposed in Hansotia and Rukstales: Incremental value modeling (2002). I simply added another evaluationFunction in causalml/inference/tree/models.py called 'DDP'.
Types of changes
Checklist
Further comments
There was no need to add an additional test for proving that the new tree based inference method works. You can simply use the test_uplift_trees.py test and provide evaluationFunction='DDP' when creating the UpliftRandomForestClassifier and UpliftTreeClassifier instances. I noticed that my test does not pass if N_SAMPLE = 1000 because the performance of random targeting was better than the DDP approach. However increasing IN_SAMPLE to, for example, 10.000 worked.
If you need additional information, don't hesitate to ask me!