-
Notifications
You must be signed in to change notification settings - Fork 780
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
Uplift tree/forest: add feature importance and parallelize forest #220
Conversation
|
||
all_importances = [tree.feature_importances_ for tree in self.uplift_forest] | ||
self.feature_importances_ = np.mean(all_importances, axis=0) | ||
self.feature_importances_ /= self.feature_importances_.sum() # normalize to add to 1 |
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.
Do we need a self.feature_importances_.sum() > 0
check here as shown in your compute_feature_importances()
reference to avoid dividing by zero (e.g., when root is pure)? This might be an extreme edge case though
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.
Good callout- I left it out because it should be the rare extreme case (also, if the root is pure, the user is not using uplift trees correctly)
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.
But yeah if we want to prevent an error from raising, we can add the condition
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.
agree your point that it's minor and more of an user error, thanks for confirming!
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!
Looks like the build is failing here (https://travis-ci.com/github/uber/causalml/jobs/366341859) - anyone seen this kind of error before? @jeongyoonlee @ppstacy @paullo0106 |
Never mind, I just re-ran the build and it's passing. |
Uplift tree/forest: add feature importance and parallelize forest
Add feature importance
examples
Parallelize Forest