-
-
Notifications
You must be signed in to change notification settings - Fork 25.9k
FEA return final cross-validation score in SequentialFeatureSelector #31483
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
base: main
Are you sure you want to change the base?
Conversation
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 PR @cboseak
doc/whats_new/upcoming_changes/sklearn.feature_selection/31483.feature.rst
Outdated
Show resolved
Hide resolved
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 @cboseak
final_cv_score_ : float | ||
The mean cross-validation score of the selected feature set. | ||
.. versionadded:: 1.6 |
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.
.. versionadded:: 1.6 | |
.. versionadded:: 1.8 |
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.
see latest commit
X_new = X[:, self.support_] | ||
self.final_cv_score_ = cross_val_score( | ||
cloned_estimator, | ||
X_new, | ||
y, | ||
cv=cv, | ||
scoring=self.scoring, | ||
n_jobs=self.n_jobs, | ||
params=params if _routing_enabled() else None, | ||
).mean() |
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.
This is adding quite a bit of compute time to fit
time and the user cannot disable it. Ideally, we should only store things which we can compute as the process normally computes things, and if necessary, have a way to calculate this cv score if the user wants it.
I wouldn't be opposed to adding a method to this class which would run this cv and return the cv results along the mean instead of always computing it.
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 point. See latest commit. I moved it to a separate method in the class
Reference Issues/PRs
What does this implement/fix? Explain your changes.