Skip to content

META extend array API support to important estimators that already have partial support #35439

Description

@ogrisel

Warning

This issue is not yet ready for a PR. If you are interested in contributing to scikit-learn, please have a look at our contributing guidelines, and in particular the sections for new contributors and the "Needs triage" label.

Here is a review of popular/important estimators for which we already have partial array API support or for which underlying code already have significant array API coverage. Before extending support to entirely new estimators, it might be important to put some priority in making those estimators fully compliant to reduce user friction and simplify array API adoption as a result and grab low hanging fruits.

  • Ridge, RidgeClassifier
  • LogisticRegression, PoissonRegressor
  • GammaRegressor / TweedieRegressor
    • Missing setting: array API not supported yet but shares a lot of common code with PoissonRegressor
    • Difficulty: Low once previous items are addressed (incremental change).
    • User value: Medium (less commonly used than LogisticRegression or Ridge but useful in several industrial settings as demonstrated in our example gallery).
  • LogisticRegression
    • Missing setting: newton-cd / newton-cd-gram (what auto picks when l1_ratio > 0)
    • Difficulty: High. Inner step is Cython coordinate descent but the X.T @ h_diag @ X sandwich product in newton-cd-gram would likely benefit from a tiled array API implementation even if the rest of the update is written in Cython. For the newton-cd solver that relies on a sequence of matvecs involving X, so I am not so sure if array API support can help in this case. It would require some investigation.
    • User value: Medium (only if you need L1 or elastic-net). The L2 default already works.
    • Tracking: No issue.
  • CalibratedClassifierCV
    • Missing setting: method="sigmoid" (the default).
    • Difficulty: Medium. Platt scaling is a two-scalar L-BFGS fit that still uses NumPy.
    • User value: High. The default method fails under array API dispatch.
    • Tracking:
      • Issue #31869. Temperature is done.
      • No PR for sigmoid.
    • Note: method="isotonic" is implemented in Cython and not likely to be efficiently implemented via array API.
  • GaussianMixture
    • Missing setting: init_params="kmeans" (the default) and "k-means++"
    • Difficulty: High. Both call NumPy KMeans; Lloyd is Cython.
    • User value: High. The default constructor is rejected. The quality of GMM fit can be degraded when using a random init.
    • Tracking:
      • No GMM issue for array API support of the init.
      • Depends on array API support for KMeans and kmeans_plusplus: RFC #35238 and draft PR #35382.
  • GaussianMixture
  • KernelRidge
    • Missing setting: no array API support yet but the bottleneck (kernel computation and linear algebra operations) already have array API compliant implementations.
    • User value: Low to Medium. not so commonly used but I suppose a GPU implementation might be make it more popular given the expected speed-ups.
    • Tracking:
      • No issue/PR yet.
  • EmpiricalCovariance
    • Missing setting: no array API support for this covariance estimator but related classes in the same module already have it.
    • User value: Medium. Used by a scientific downstream library that depends on scikit-learn and started to adopt array API support for covariance estimation to benefit from GPU acceleration.
    • Tracking:

Activity

  1. added
    Meta-issue
    on Nov 17, 2026
  2. added theissue type on Nov 17, 2026
  3. ogrisel commented on Nov 17, 2026

    @ogrisel
    MemberAuthor

    Note that some of the above plan overlaps with:

  4. added
    Needs Decision
    High Priority
    on Nov 17, 2026
  5. github-actions commented on Nov 17, 2026

    @github-actions

    Thanks for the work you've done so far. The goal of this comment is to set expectations.

    Deciding on new features or substantial changes is a lengthy process. It frequently happens that no maintainer is available to take on this task right now.

    Please do not create a Pull Request before a decision has been made regarding the proposed work. Making this decision can often take a significant amount of time and effort.

  6. ogrisel commented on Nov 17, 2026

    @ogrisel
    MemberAuthor

    I labeled this a High Priority because making progress on array API adoption and hardware acceleration is important for several financial supporters of scikit-learn (NVidia, Intel, Probabl and NASA ROSES) and, I hope, also for future scikit-learn users once array API dispatch is enabled by default.

    I labeled as "Need decision" because the priority statements and ordering of those items are mostly mine augmented by feedback by participants to the bi-weekly array API meeting.

  7. moved this to In Progress in Array APIon Nov 17, 2026
  8. lcrmorin commented on Nov 22, 2026

    @lcrmorin

    I'd like to contribute.

    • On logistic regression, I've started prototyping solvers locally (AI-assisted), with some promising stuff. How would this best proceed ?
    • On logistic regression, I had in mind more recent papers Saran and Nar’s Fast Binary Logistic Regression. If the objective is run time would it be possible to consider it as part of this API approach ? (Note: local implementation seems awful).
    • You split the topics, but aren't some of them reusable ? (Newton-Cholesky port across linear models, binomial stuff for platt scaling, k-means ++ across clustering and mixture init ?)
  9. ogrisel commented on Nov 23, 2026

    @ogrisel
    MemberAuthor

    On logistic regression, I've started prototyping solvers locally (AI-assisted), with some promising stuff. How would this best proceed ?

    Do you mean add array API support to existing solvers as described in the issue? Or prototyping alternative solvers?

    If the former, check that nobody has already opened the PR you have in mind. Try to keep the PRs focussed on one particular solver and make sure to update the existing estimator-specific array API compliance tests and add a new "check_array_api_input"-keyed entry with the new solver to the PER_ESTIMATOR_CHECK_PARAMS dict to get the common test to run that check with that solver.

    Which particular solver do you have in mind. I think "newton-cholesky" can be targeted next since #35418 was recently merged in main and we can reuse some of its handling of xp.linalg.solve exceptions, unless @lorentzenchr had already planned to work on it (see #33537).

    On logistic regression, I had in mind more recent papers Saran and Nar’s Fast Binary Logistic Regression. If the objective is run time would it be possible to consider it as part of this API approach ? (Note: local implementation seems awful).

    I would like to decouple adding the support of array API for existing solvers from adding a new way to fit logreg models. Adding new methods is subject to the inclusion criteria but it could be considered for inclusion if this solves the same objective function much better than existing alternatives in scikit-learn on relevant problems.

    You split the topics, but aren't some of them reusable?

    Sure, there are dependencies between some of the above items. But better write smaller more focussed PRs to have a better chance of getting them reviewed and merged in a timely manner. I would rather not open a PR for something that depends on the merge of another PR. Rather explain in the description of the first small PR that you have a plan for a possible follow-up once the first is merged.

  10. lcrmorin commented on Nov 24, 2026

    @lcrmorin

    Hi Olivier,

    For context, I was benchmarking different stuff, aiming at faster auto / new models. Not to be used here, but it might be worth a mention. I think my newton-cholesky and newton-cd-gram can be reused here.

    • The newton-cholesky branch reuses Ridge’s Array API solve helper from ENH Ridge: support solver="cholesky" for array API inputs #35418 and preserves the L-BFGS fallback.

    • The newton-cd-gram branch builds the weighted Gram matrix in tiles on the device and reuses the existing Cython coordinate-descent step on CPU. Currently it relies on the hessian handling of newton-cholesky.

    Does this stagging make sense ? would you prefer to have the path better separated ?

    • On cpu there seems to be a small gain of cholesky on large L2 (500k rows, 80 columns). On Kaggle infra the run on GPU T4 are 5x faster than on single threaded cpu. No such gain observed on mac mps. The tiling improve memory (-84% overhead).

    Do these make sense ? Isn't there something that can be done for mac users ?

    How can we embark these changes in benchmark / CI ?

    • PoissonRegressor can reuse the shared Newton solver once its estimator integration is in place.

    I'll work on my two PRs to match the testing standard you mentionned. But maybe it is worth having in mind already where the stuff can be reused.

  11. betatim commented on Nov 24, 2026

    @betatim
    Member

    The best way to discuss proposed implementation(s) is to open a PR. You can mark it as draft to indicate that it is still work in progress. I'd open one targeted PR and put effort into the description of the change. This helps increase the chances of people taking the time to review it swiftly

  12. lcrmorin commented on Nov 27, 2026

    @lcrmorin

    Ok there was a bit of a semantic issue (the issue still warns about it being not ready for a PR), but I went for it. The topics of discussion are noted in the description.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Array APIHigh PriorityMeta-issueNeeds Decision

    Projects

    • Status
      In Progress

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions