Repository navigation
TST Add array API scorer and cross_validate integration tests - #34824
OmarManzoor merged 8 commits into
Conversation
Port the integration tests from scikit-learn#32873 onto current main. The library fixes from that PR appear to already be covered by later main changes, so this only adds the tests (with small adaptations for current helpers and a numpy-baseline y_np fix in the regression scorer test). Co-authored-by: Olivier Grisel <[email protected]>
Remove the standalone test added from scikit-learn#32873 and assert that an invalid pos_label is ignored on the existing multiclass _get_response_values coverage. Co-authored-by: Olivier Grisel <[email protected]>
Replace the XXX in test_cross_validate_array_api_pipeline with the policy already used by LinearClassifierMixin and the common Array API checks: string class labels stay NumPy on CPU; integer class ids follow X. Also compare predict outputs to the NumPy baseline. Co-authored-by: Olivier Grisel <[email protected]>
|
The new tests pass on CUDA GPU. I just started an Intel GPU run at: |
| ) | ||
| assert pos_label_invalid == "invalid" | ||
| assert predictions_invalid.shape == (X.shape[0], len(estimator.classes_)) | ||
| assert_allclose(predictions_invalid, predictions) |
There was a problem hiding this comment.
This new test case is not directly related to array API but it was discovered while originally working on the array API integration tests before the metrics function refactoring. I think it's good to keep it as a non-regression test.
virchan
left a comment
There was a problem hiding this comment.
Thank you for the PR, @ogrisel!
I just have one minor comment about the device_ variable. Otherwise, LGTM!
Also, a friendly ping to @lucyleeow and @OmarManzoor for a second review.
| ( | ||
| RidgeClassifier(solver="svd"), | ||
| "accuracy", | ||
| ), # TODO: add "roc_auc" when supported |
There was a problem hiding this comment.
Ping me to address that TODO if #33200 gets merged first. Otherwise we can do a follow-up PR.
|
Gentle ping @betatim @virchan. Also @StefanieSenger @OmarManzoor. |
OmarManzoor
left a comment
There was a problem hiding this comment.
LGTM. Thank you @ogrisel
|
#34854 removed the import of |
Towards: #33444.
This is an extraction from the previously stalled #32873 PR.
The purpose is to complement the existing unit tests for array API compliance (for estimators and metrics) to check that everything still works as expected when all used in conjunction (e.g. when wrapped in cross-validation pipelines that exercise the scoring infrastructure).