-
-
Notifications
You must be signed in to change notification settings - Fork 25.8k
ENH Add Array API compatibility tests for *SearchCV
classes
#27096
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
Changes from all commits
6f74abb
28dcbae
cf8cc15
a5653dd
3c3a569
0e3c7d7
452a5e9
fcdd39d
214a41c
d0069c6
725d649
7618f4d
2b0cc89
aebb43e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2100,13 +2100,14 @@ def test_fit_and_score_failing(): | |
failing_clf = FailingClassifier(FailingClassifier.FAILING_PARAMETER) | ||
# dummy X data | ||
X = np.arange(1, 10) | ||
train, test = np.arange(0, 5), np.arange(5, 9) | ||
fit_and_score_args = dict( | ||
estimator=failing_clf, | ||
X=X, | ||
y=None, | ||
scorer=dict(), | ||
train=None, | ||
test=None, | ||
train=train, | ||
test=test, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Not sure why this did no fail in |
||
verbose=0, | ||
parameters=None, | ||
fit_params=None, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -330,7 +330,9 @@ def _generate_search_cv_instances(): | |
extra_params = ( | ||
{"min_resources": "smallest"} if "min_resources" in init_params else {} | ||
) | ||
search_cv = SearchCV(Estimator(), param_grid, cv=2, **extra_params) | ||
search_cv = SearchCV( | ||
Estimator(), param_grid, cv=2, error_score="raise", **extra_params | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Setting |
||
) | ||
set_random_state(search_cv) | ||
yield search_cv | ||
|
||
|
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.
Would it be possible to add a test to cover this?
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 we had coverage for it via the test I removed in the last commit. But I thought that we tested the same thing via a common test. So I am a bit puzzled why that doesn't happen :-/
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 understand what's going on:
LogisticRegression
andRidge
as base-estimator.LogisticRegression
test is skipped becauseLogisticRegression
does not have the array API estimator tag hence the wrapping search cv estimators ain't either;Ridge
-based common test does not cover it;LinearDiscriminantAnalysis
which is a classifier and supports array API, hence could cover this line.Since adding array API support to
LogisticRegression
might take a bit of time, I would be in favor of re-adding the previous non-common test that was removed from this PR.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.
Yeah that seems right. Thanks for the explanation! I think the test seems valid for now and not redundant.
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.
@ogrisel I added the test back. Can you have a look and then we can probably merge.