You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Adding array API support to sklearn.covariance #33584
Please refer to this issue when opening a PR to tackle something from this list. Use Towards #33584 to refer to this issue, do not use "closes" or "fixes" (that would close this issue when merging your PR).
After the LedoitWolf and OAS PRs are merged we will consider opening this issue for a wider audience of contributors.
The next thing to work out is in which order items should be tackled. This will require looking at the existing PR for LedoitWolf and investigating how the other estimator classes depend on each other. If you investigate this and find out an order that makes sense please post in this issue.
I think, in this context, the best strategy is to focus on the empirical covariance first, and then a breadth-first search should solve the rest, maybe the order should be:
I can start the ShruckCovariance or OAS. I feel we should include the functionality and the classes in the PR. I can do the empirical_covariance() + EmpiricalCovariance too!
I like your suggested order. Doing one class and the corresponding function in one PR is good. I think beyond that we risk getting big diffs which are hard to review (review hardness probably scales quadratically or exponentially with diff size).
I'm starting the empirical covariance branch, and I think the best strategy is to build it on top of your PR. You end up modifying some functions that are necessary for empirical covariance.
I think if you need it, maybe @agramfort can help with the review.
Many thanks for your work with #33573. Now that the PR is almost merged, I would like to ask if it would be okay if I create a PR for the fast mcd, or even the other covariances, and request your review. As this aligns with my research agenda at Pyriemman, I can contribute my time and dedication to help convert all the covariances by the next release in 2 months.
Do you think this would work for you?
I would also be happy to accommodate any other request that might help or facilitate this integration.
Hi! I'd like to work on ShrunkCovariance and the shrunk_covariance function, following the pattern established in #33573 and the OAS conversion.
One thing I want to flag before starting: shrunk_covariance currently accepts n-dimensional input (allow_nd=True, with axis1=-2, axis2=-1 on the trace), so it supports stacks of covariance matrices rather than just a single 2-D one. I'll check whether the existing array API helpers handle the batched case and will follow up here if it turns out to need a design decision rather than a straight port.
Activity
bruAristimunha commentedon Mar 19, 2026
hey @betatim!
I generate the graph dependency in the covariance classes:
pyreverse -o png -p covariance sklearn/covariance/*.pyI think, in this context, the best strategy is to focus on the empirical covariance first, and then a breadth-first search should solve the rest, maybe the order should be:
LedoitWolfestimator array API compatible #33573, and empirical covariance.ShrunkCovariance+OAS+shrunk_covariance()+oas()GraphicalLasso+GraphicalLassoCV+graphical_lasso()MinCovDetEllipticEnvelopeI can start the ShruckCovariance or OAS. I feel we should include the functionality and the classes in the PR. I can do the empirical_covariance() + EmpiricalCovariance too!
betatim commentedon Mar 19, 2026
I like your suggested order. Doing one class and the corresponding function in one PR is good. I think beyond that we risk getting big diffs which are hard to review (review hardness probably scales quadratically or exponentially with diff size).
TIL about
pyreverse!bruAristimunha commentedon Mar 20, 2026
I'm starting the empirical covariance branch, and I think the best strategy is to build it on top of your PR. You end up modifying some functions that are necessary for empirical covariance.
I think if you need it, maybe @agramfort can help with the review.
bruAristimunha commentedon Mar 20, 2026
you are super close to fix the empirical covariance too, so i just comment the last point: #33573 (review)
bruAristimunha commentedon Apr 2, 2026
Hey @betatim,
Many thanks for your work with #33573. Now that the PR is almost merged, I would like to ask if it would be okay if I create a PR for the fast mcd, or even the other covariances, and request your review. As this aligns with my research agenda at Pyriemman, I can contribute my time and dedication to help convert all the covariances by the next release in 2 months.
Do you think this would work for you?
I would also be happy to accommodate any other request that might help or facilitate this integration.
Again, many thanks for your time on this 🙏🏽
betatim commentedon Apr 14, 2026
Yes I think that makes sense. Apologies for the very very delayed reply.
AbdulAliMamnun commentedon Sep 4, 2026
Hi! I'd like to work on
ShrunkCovarianceand theshrunk_covariancefunction, following the pattern established in #33573 and the OAS conversion.One thing I want to flag before starting:
shrunk_covariancecurrently accepts n-dimensional input (allow_nd=True, withaxis1=-2, axis2=-1on the trace), so it supports stacks of covariance matrices rather than just a single 2-D one. I'll check whether the existing array API helpers handle the batched case and will follow up here if it turns out to need a design decision rather than a straight port.