Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Add Array API compatibility to MaxAbsScaler #27110

Merged
merged 10 commits into from Aug 23, 2023

Conversation

EdAbati
Copy link
Contributor

@EdAbati EdAbati commented Aug 19, 2023

Reference Issues/PRs

Towards #26024

What does this implement/fix? Explain your changes.

It makes the MaxAbsScaler implementation compatible with the Array API.

Any other comments?

I had to make a small adjustment to _nanmax and _nanmin, because mps complained that those +/-inf arrays were not on the same (mps) device.

@github-actions
Copy link

github-actions bot commented Aug 19, 2023

✔️ Linting Passed

All linting checks passed. Your pull request is in excellent shape! ☀️

Generated for commit: 3fb8d5a. Link to the linter CI: here

@EdAbati
Copy link
Contributor Author

EdAbati commented Aug 20, 2023

Should we add somewhere in the docs that sparse arrays are not supported by the Array API?

@ogrisel
Copy link
Member

ogrisel commented Aug 21, 2023

Should we add somewhere in the docs that sparse arrays are not supported by the Array API?

As far as I know, no library implementing the Array API specification implement sparse memory layouts. But in theory, nothing prevents someone to write such a library as far as I know. If that would be the case, there should not be anything to change at the scikit-learn level.

Copy link
Member

@ogrisel ogrisel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR @EdAbati, this LGTM! Just a quick suggestion to merge the scaler tests together.

sklearn/preprocessing/tests/test_data.py Outdated Show resolved Hide resolved
@ogrisel
Copy link
Member

ogrisel commented Aug 21, 2023

BTW, I tested with the PyTorch / MPS backend on my laptop and this PR tests pass.

Copy link
Member

@betatim betatim left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, just some nits

@betatim betatim merged commit 2efe3f3 into scikit-learn:main Aug 23, 2023
27 checks passed
@betatim
Copy link
Member

betatim commented Aug 23, 2023

Thanks a lot!

@EdAbati EdAbati deleted the move-maxabsscaler-to-array-api branch August 23, 2023 15:59
akaashpatelmns pushed a commit to akaashp2000/scikit-learn that referenced this pull request Aug 25, 2023
glemaitre pushed a commit to glemaitre/scikit-learn that referenced this pull request Aug 29, 2023
REDVM pushed a commit to REDVM/scikit-learn that referenced this pull request Nov 16, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants