Repository navigation
ENH add newton-cg Array API to PoissonRegressor - #35050
Conversation
f8874b7 to
95de737
Compare
95de737 to
6b34caa
Compare
6b34caa to
559a98b
Compare
559a98b to
d6d93ed
Compare
|
@betatim This could interest you. The solver newton-cg has the advantage over lbfgs that it can compute 100% within Array API whereas lbfgs needs to hold certain arrays in numpy. |
cakedev0
left a comment
There was a problem hiding this comment.
I was looking at the 1.10 milestone and I saw this one: it's small and valuable, so let's get it merged! Thanks for the PR!
Small findings, but easy to fix.
doc/modules/array_api.rst also needs an update at the PoissonRegressor line (add newton-cg).
| else: | ||
| # Needs to be F-contiguous which only numpy provides. We init a | ||
| # ravelled array instead. | ||
| coef = xp.zeros(shape=(n_classes * n_dof), dtype=dtype, device=device) |
There was a problem hiding this comment.
Is this branch needed? The only non-test caller of init_zero_coef is glm.py, which is never multiclass, and no test reaches this branch. It also returns a shape that the docstring doesn't list, (n_classes * n_dof,).
Let's drop it?
There was a problem hiding this comment.
It does not really matter. I find it cleaner to keep it, even when untested.
There was a problem hiding this comment.
Ok, sounds reasonable. And it's well commented so 👍
|
@virchan @OmarManzoor Maybe you have time and are interested to give the final +1. Should land in 1.10, IMO. |
virchan
left a comment
There was a problem hiding this comment.
Thank you for the PR, @lorentzenchr.
We should also add the estimator to doc/modules/array_api.rst.
I also have a minor question for my own understanding.
Otherwise, LGTM.
….rst Co-authored-by: Copilot <[email protected]>
virchan
left a comment
There was a problem hiding this comment.
Thank you everyone for your time!
CUDA CI is green: https://github.com/scikit-learn/scikit-learn/actions/runs/42832582951
Intel CI is green, with float32 skipped: https://github.com/probabl-ai/scikit-learn-intel-workflow/actions/runs/42832807746
The rendered doc looks fine to me as well.
Merging.
Reference Issues/PRs
Continuation of #33348 and #34412.
What does this implement/fix? Explain your changes.
This PR makes
PoissonRegressor(solver="newton-cg")array API compatible (same asLogisticRegressionin #34412)AI usage disclosure
I used AI assistance for:
Any other comments?