Thanks to visit codestin.com
Credit goes to github.com

Skip to content

MNT Replaces numpy alias with builtin typse #17687

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

Merged

Conversation

thomasjpfan
Copy link
Member

This PR was generated by:

$ find . -name "*.py" -print0 | xargs -0 sed -i "s/\bnp.int\b/int/g"
$ find . -name "*.py" -print0 | xargs -0 sed -i "s/\bnp.float\b/float/g"
$ find . -name "*.py" -print0 | xargs -0 sed -i "s/\bnp.bool\b/bool/g"

Numpy alias to python builtins are deprecated in 1.20

CC: @adrinjalali I hear you like the command line :)

Copy link
Member

@glemaitre glemaitre left a comment

Choose a reason for hiding this comment

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

LGTM. What is the reason to make this change?

@rth
Copy link
Member

rth commented Jun 24, 2020

A similar fix was done to numpy earlier numpy/numpy#14901 and they mostly use np.int_ etc. versions. Personally I think it's better to use np.float32 or np.float64 explicitly rather than float. Not sure if np.int_ is better than int or not.

@alfaro96
Copy link
Member

LGTM. What is the reason to make this change?

Now that the numpy and scipy wheels are fetched from the Anaconda index (see PR #17672), numpy==1.20.dev0 is used for the CRON jobs (travis and Linux_Nightly pylatest_pip_scipy_dev). Since numpy aliases are deprecated from this version, this will raise to the CRON jobs to fail.

For instance, see this job.

@glemaitre
Copy link
Member

Thanks @alfaro96 it makes sense then.

Copy link
Member

@adrinjalali adrinjalali left a comment

Choose a reason for hiding this comment

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

I agree that np.float32 or np.float64 are much better, but that's more of another thread of issues and improvements that's going on, and I think deserve their own PRs. I'm happy with this one as is.

@adrinjalali adrinjalali merged commit 7cc0177 into scikit-learn:master Jun 24, 2020
rubywerman pushed a commit to MLH-Fellowship/scikit-learn that referenced this pull request Jun 24, 2020
* MNT Replaces numpy alias with builtin typse

* STY Lint error
@eric-wieser
Copy link

xref numpy/numpy#14882

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants