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
ENH add importance_getter to RFE* and SelectFromModel #15361
Conversation
Update upstream
Scoring clf looe
Thanks. We could also consider the user specifying an attribute name/path
(implemented with attrgetter)
|
Thanks for the pointers. I have added these options now. |
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 it is clearer if we don't add the attribute path support, and just handle 'auto' and callable? Maybe I shouldn't have suggested the additional option...
Nop. I think including param/path support would be user-friendly. |
I will have a look at it. I am running behind all my late review ;P |
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.
OK a couple of comments. Basically, this is fine but I think that we can avoid some code duplicate.
def test_w_target_transform(importance_getter, model): | ||
n_features = 10 | ||
X, y = make_friedman1(n_samples=50, n_features=10, random_state=0) | ||
estimator = SVR(kernel="linear") |
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.
yes LinearSVR
sorry for the wrong pointer.
sklearn/feature_selection/_rfe.py
Outdated
@@ -8,6 +8,7 @@ | |||
|
|||
import numpy as np | |||
from joblib import Parallel, delayed, effective_n_jobs | |||
from operator import attrgetter |
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.
Once the refactoring done, you will not need this import ;)
removing attrgetter in docstring
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.
Almost there. Only nitpicks. I would add a bit of documentation and I think that we are good to go.
renaming expected_features to expected_n_features
Do you think, we need to add the Also, would it be helpful if we add one example, which uses the |
Good remark. Yes, we need it.
We can let it for now. I think that with the user guide it should be enough. |
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.
Just 2 quick changes and the version added and we are good to merge.
Even the user guide is not updated as well. Also there is no reference for user guide in documentation |
Thanks @venkyyuvy!! Nice work! |
Reference Issues/PRs
Fixes #15312
What does this implement/fix? Explain your changes.
Any other comments?