-
-
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
See latest changes to address your comments |
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'd need more opinions on this to see if we'd like to include it.
cc @scikit-learn/core-devs
cloned_estimator = clone(self.estimator) | ||
|
||
return 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.
cloned_estimator = clone(self.estimator) | |
return 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() | |
return cross_val_score( | |
clone(self.estimator), | |
X_new, | |
y, | |
cv=cv, | |
scoring=self.scoring, | |
n_jobs=self.n_jobs, | |
params=params if _routing_enabled() else None, | |
) |
cv=cv, | ||
scoring=self.scoring, | ||
n_jobs=self.n_jobs, | ||
params=params if _routing_enabled() else None, |
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.
there should be a _raise_for_params
for this.
check_is_fitted(self) | ||
|
||
X_new = X[:, self.support_] | ||
cv = check_cv(self.cv, y, classifier=is_classifier(self.estimator)) |
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.
we could have a self._get_cv()
to not repeat this line.
score : float | ||
The mean cross-validation score of the selected feature set. |
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.
we might want to return raw values instead.
doc/whats_new/upcoming_changes/sklearn.feature_selection/31483.feature.rst
Outdated
Show resolved
Hide resolved
….feature.rst update based on PR suggestions Co-authored-by: Adrin Jalali <adrin.jalali@gmail.com>
Reference Issues/PRs
What does this implement/fix? Explain your changes.