Skip to content

TST Add Array API scorer and cross_validate integration tests - #22

Closed
ogrisel wants to merge 865 commits into
mainfrom
cursor/array-api-integration-tests-26c5
Closed

ogrisel wants to merge 865 commits into
mainfrom
cursor/array-api-integration-tests-26c5

Conversation

@ogrisel

@ogrisel ogrisel commented Aug 27, 2026

Copy link
Copy Markdown
Owner

Reference Issues/PRs

See also scikit-learn#32873.

This extracts the integration tests from scikit-learn#32873 onto current main. The library changes from that PR are not re-applied: mixed-namespace handling in Ridge, LDA, and _check_reg_targets already landed independently, and the new tests pass without those diffs.

What does this implement/fix? Explain your changes.

Adds Array API integration tests for composing estimators, scorers, and cross_validate:

  • test_classification_scorer_array_api_compliance and test_regression_scorer_array_api_compliance exercise check_scoring / _Scorer with Array API X (and mixed y namespaces / string labels). Common estimator and metric Array API checks do not cover this scorer path (predict / predict_proba / decision_function → _get_response_values → metric).
  • test_cross_validate_array_api_pipeline checks the usual “only X is moved onto device” pipeline pattern (FunctionTransformer + estimator), multi-scorer CV, numeric agreement with NumPy, and device/dtype of returned estimators’ predictions. Existing cross_validate Array API coverage is a mixed-input smoke test on LogisticRegression only.

The narrower _get_response_values multiclass pos_label check from scikit-learn#32873 is folded into test_get_response_values_multiclass (invalid pos_label is ignored, predictions unchanged).

Introduce yourself

Follow-up from scikit-learn#32873 (ogrisel).

AI usage disclosure

I used AI assistance for:

  • Test/benchmark generation
  • Research and understanding

This pull request includes code written with the assistance of AI.
The code has not yet been reviewed by a human.

Any other comments?

No changelog entry: tests only.

Locally, with the pylatest_conda_forge_mkl lockfile env and SCIPY_ARRAY_API=1: 188 passed, 250 skipped (unavailable devices/namespaces such as CUDA/CuPy/dpnp).

Open in Web Open in Cursor 

scikit-learn-bot and others added 30 commits June 2, 2026 23:35
Co-authored-by: Lock file bot <[email protected]>
Co-authored-by: Olivier Grisel <[email protected]>
Co-authored-by: Jérémie du Boisberranger <[email protected]>
jeremiedbb and others added 29 commits August 19, 2026 07:18
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]>
@ogrisel ogrisel closed this Aug 27, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.