Repository navigation
Fix log_loss and d2_log_loss_score type promotion mismatch - #33022
Conversation
|
|
||
| import numpy as np | ||
| from scipy.sparse import coo_matrix, csr_matrix, issparse | ||
| from scipy.special import xlogy |
There was a problem hiding this comment.
scipy's xlogy support array API but has a bug related to setting the right device on arrays it creates. Maybe only is scipy 1.15.2?
|
Indeed, if I upgrade to scipy 1.16 the problem goes away. Not sure if this means we should or should not fix it? |
virchan
left a comment
There was a problem hiding this comment.
Thank you for the PR, @betatim!
I can confirm the same behaviour locally. Running
pytest -k "array_api and array_api_strict"raises errors with 1.15.2 <= scipy < 1.16.0, and passes with scipy >= 1.16.0 on the main branch. I also have array-api-strict==2.4.1 installed locally.
Co-authored-by: Virgil Chan <[email protected]>
There was a problem hiding this comment.
Indeed, if I upgrade to scipy 1.16 the problem goes away. Not sure if this means we should or should not fix it?
Since we already have _xlogy in our code base, let's use it consistently for now.
But I would also be fine with a follow-up PR that removes _xlogy from our code base and uses scipy.special.xlogy everywhere (and therefore impose using the latest scipy version for people needing array API support).
|
I think this is (was) due to #32552 I noticed it too: #32422 (comment) |
There was some comment somewhere that was pointing to a regression in scipy 1.16 I think? #32552 (comment) I ran a poll #32552 (comment) a couple of months ago where nobody had strong opinions. |
…t-learn#33022) Co-authored-by: Olivier Grisel <[email protected]> Co-authored-by: Virgil Chan <[email protected]>
…t-learn#33022) Co-authored-by: Olivier Grisel <[email protected]> Co-authored-by: Virgil Chan <[email protected]>
What does this implement/fix? Explain your changes.
I was running
pytest -k "array_api and array_api_strict"after updatingmainto check things were working. This came up with a group of failures likeFull traceback for one test
AI usage disclosure
I used AI assistance for:
Any other comments?
I am not sure why this doesn't happen in our CI. I use the same version of
array_api_strictlocally (2.4.1). Maybe it is because I use scipy 1.15.2 locally? This puzzles me.