Repository navigation
TST Make array API metric references explicit - #34317
Merged
ogrisel merged 5 commits intoJun 23, 2026
Merged
Conversation
|
Thank you for opening your first pull request to scikit-learn! 🎉 To help get your contribution reviewed, please make sure that:
|
betatim
reviewed
Jun 23, 2026
betatim
reviewed
Jun 23, 2026
betatim
reviewed
Jun 23, 2026
|
|
||
| n_job2_np = func(X_np, metric=metric, n_jobs=2, **kwds) | ||
| with config_context(array_api_dispatch=False): | ||
| n_job2_np = func(X_np, Y_np_val, metric=metric, n_jobs=2, **kwds) |
Member
There was a problem hiding this comment.
The original invocation only passes X_np
Suggested change
| n_job2_np = func(X_np, Y_np_val, metric=metric, n_jobs=2, **kwds) | |
| n_job2_np = func(X_np, metric=metric, n_jobs=2, **kwds) |
Contributor
Author
There was a problem hiding this comment.
Good point. I restored the original one-argument NumPy call for the Y=None case, while still passing Y_np for the explicit non-None Y branch.
betatim
approved these changes
Jun 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reference Issues/PRs
Fixes #34311.
What does this implement/fix? Explain your changes.
This makes the NumPy reference computations in metrics array API tests explicitly run with
array_api_dispatch=Falsebefore comparing them againstarray_api_dispatch=Trueresults. It also keeps theYbranch intest_pairwise_parallel_array_apifrom being skipped accidentally by using local loop variables.I used AI assistance to help inspect the relevant test paths and draft this PR, then reviewed and tested the changes locally.
Any other comments?
Local checks:
git diff --checkpython -m compileall sklearn/metrics/tests/test_common.py sklearn/metrics/tests/test_pairwise.pySCIPY_ARRAY_API=1 python -m pytest sklearn/metrics/tests/test_pairwise.py -k "array_api" -qSCIPY_ARRAY_API=1 python -m pytest sklearn/metrics/tests/test_common.py -k "test_array_api_compliance and pairwise_distances" -q