FIX PoissonRegressor mixed namespace/device array API inputs - #34480
Merged
virchan merged 1 commit intoJul 24, 2026
Merged
Conversation
|
Thank you for opening your first pull request to scikit-learn! 🎉 To help get your contribution reviewed, please make sure that:
|
aminehd
force-pushed
the
poissonregressor-mixed-array-api-inputs
branch
from
July 15, 2026 03:19
12df4ae to
dd3b48c
Compare
OmarManzoor
reviewed
Jul 22, 2026
OmarManzoor
left a comment
Contributor
There was a problem hiding this comment.
Thank you for the PR @aminehd. There are some conflicts that might need to be resolved.
aminehd
force-pushed
the
poissonregressor-mixed-array-api-inputs
branch
from
July 22, 2026 17:24
51c1bcb to
f0dc92c
Compare
Contributor
Author
|
Hi @OmarManzoor , Thanks for the review, applied all comments and resolved merge conflict. |
OmarManzoor
approved these changes
Jul 22, 2026
OmarManzoor
left a comment
Contributor
There was a problem hiding this comment.
LGTM. Thank you @aminehd
Contributor
|
CC: @lucyleeow @virchan for a second review |
aminehd
force-pushed
the
poissonregressor-mixed-array-api-inputs
branch
from
July 22, 2026 18:23
71c9b88 to
d1480ce
Compare
`_GeneralizedLinearRegressor.fit` and `score` moved `y` and `sample_weight` onto `X`'s namespace/device only after the dtype-coupled validation (`check_array` / `_check_sample_weight`), which uses `X`'s dtype. With `y` or `sample_weight` in a different array API namespace/device than `X` this raised (e.g. `array_api_strict.isdtype` receiving a `torch.dtype`). Move `y` and `sample_weight` before that validation in both methods, and drop the `check_array_api_mixed_inputs` XFAIL for `PoissonRegressor`. `move_to` is a no-op in the same-namespace path. Towards scikit-learn#28668
aminehd
force-pushed
the
poissonregressor-mixed-array-api-inputs
branch
from
July 22, 2026 18:25
d1480ce to
c45845a
Compare
Contributor
Author
|
Thanks @OmarManzoor . I changed the document file name. |
virchan
approved these changes
Jul 24, 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
Towards #28668
What does this implement/fix?
PoissonRegressor(via_GeneralizedLinearRegressor) already calledmove_toon
yandsample_weightinfitandscore, but only after thedtype-coupled validation (
check_array/_check_sample_weight), which usesX's dtype. Wheny/sample_weightcame from a different array APInamespace/device than
X, this raised before the move(
array_api_strict.isdtypereceiving atorch.dtype).This moves
yandsample_weightontoX's namespace/device before thatvalidation in both methods, and removes the
check_array_api_mixed_inputsXFAIL for
PoissonRegressor.move_tois a no-op in the same-namespace path.Testing
SCIPY_ARRAY_API=1 pytest -k "array_api_mixed_inputs and PoissonRegressor",on CPU and on GPU (NVIDIA RTX 4060 Ti, torch 2.13.0+cu126):
TypeError: 'dtype' must be a dtype, not torch.dtype)y→ GPU-torchX); 3 skipped (cupy / mpsbackends absent)
No regressions:
test_glm.py406 passed; the one pre-existing PoissonRegressorfailure (
check_array_api_input[array_api_strict, device1, float32]) also failson unmodified
main.AI usage disclosure
I used AI assistance (Claude) for:
check_array/_check_sample_weightto the misplacedmove_to.move_toreorder infitandscore.I reviewed and verified all of it myself and take responsibility for its correctness.