-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
[MRG] Fast PDP for DecisionTreeRegressor and RandomForestRegressor #15864
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
Conversation
…rtial_dep_decision_tree
Codecov is red because of |
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.
I think this is good. I am just wondering about duck-typing the estimator supporting the recursion. It could be handy.
@@ -351,19 +339,25 @@ def partial_dependence(estimator, X, features, response_method='auto', | |||
if (isinstance(estimator, BaseGradientBoosting) and | |||
estimator.init is None): | |||
method = 'recursion' | |||
elif isinstance(estimator, BaseHistGradientBoosting): | |||
elif isinstance(estimator, (BaseHistGradientBoosting, |
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 you think that it would make sense to avoid this isinstance
and check for hasattr(estimator, 'compute_partial_dependence')
or a method that could be shared across all these estimators?
I could think that library as xgboost or lightgbm or tree base could expose the same method without us checking for type.
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.
that's a nice idea but that means we need to support a new public API, i.e. the interface of _compute_partial_dependence_recursion
would now be fixed
We would also still need to hardcoded list of supported estimators for the error message.
Maybe we can keep that in mind for later?
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.
Yep we could check how other libraries are exposing this and put all these info in an issue
Does this have your +1 @glemaitre ? I think all comments were addressed |
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 @NicolasHug |
This PR implements the fast 'recursion' method for DecisionTreeRegressor and RandomForestRegressor
Need to merge #16114 first
We're only exposing the method which already exists for the gradient boosting estimators.