Skip to content

[WIP] Allowing the array api to work with covariance OAS#33600

Open
bruAristimunha wants to merge 27 commits into
scikit-learn:mainfrom
bruAristimunha:array-api-oas
Open

[WIP] Allowing the array api to work with covariance OAS#33600
bruAristimunha wants to merge 27 commits into
scikit-learn:mainfrom
bruAristimunha:array-api-oas

Conversation

@bruAristimunha

@bruAristimunha bruAristimunha commented Mar 22, 2026

Copy link
Copy Markdown
Contributor

Reference Issues/PRs

Towards #33584, the sub-issue about OAS and oas.

What does this implement/fix? Explain your changes.

Basically, allow the methods Covariance OAS and oas to work with the api array contract.

AI usage disclosure

I used AI assistance for:

  • Code generation (e.g., when writing an implementation or fixing a bug)
  • Test/benchmark generation
  • Documentation (including examples)
  • Research and understanding

Any other comments?

It is built on top of #33573, so it is necessary to merge #33573 first.

betatim and others added 10 commits March 17, 2026 18:08
The tests were written as part of a TDD approach during development,
they cover things that the common tests also cover. So removing them to
reduce the amount of duplication.
In some cases it returns flaot64 for float32 input. There are users who
rely on this behaviour.
@bruAristimunha bruAristimunha marked this pull request as draft March 22, 2026 14:54
@bruAristimunha bruAristimunha changed the title Array api oas [WIP] Allowing the array api to work with covariance OAS Mar 22, 2026
@bruAristimunha

Copy link
Copy Markdown
Contributor Author

Just to let you know, I created the draft PR @betatim, @agramfort, @qbarthelemy. If there's anything I can help with or assist with, please let me know, and thank you again for your attention to this matter 🙏

If we flag it as supporting array API all the classes that inherit from
it also get marked as supporting array API. This doesn't work, so we
need to do this at the end when all estimators support array API.
betatim and others added 9 commits April 7, 2026 16:11
Co-authored-by: Olivier Grisel <olivier.grisel@ensta.org>
This avoids shifting X and let's us share the implementation with PCA.
Co-authored-by: Quentin Barthélemy <q.barthelemy@gmail.com>
Convert _oas() and OAS.fit() to use array API compatible operations,
following the same pattern as LedoitWolf from PR scikit-learn#33573.
Vendor array_api_extra from bruAristimunha/array-api-extra#690 which
renames the cov() kwarg from 'bias' to 'correction'. Rename the
changelog entry to 33600 (Bru's PR number) and update its content to
mention only OAS (since EmpiricalCovariance support was reverted in
Tim's branch).
@bruAristimunha bruAristimunha marked this pull request as ready for review June 3, 2026 17:22
@bruAristimunha

Copy link
Copy Markdown
Contributor Author

@betatim, minimal PR now that #33584 is merged! Can you please review? 🙏🏽

@ogrisel ogrisel moved this to In Progress in Array API Jun 22, 2026
@github-actions github-actions Bot removed the CUDA CI label Jun 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

5 participants