-
-
Notifications
You must be signed in to change notification settings - Fork 18.4k
PERF: use numpy.random.Generator #28440
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
Comments
There should already be |
We’ll need to discuss what API guarantees we make about the seeds. I don’t think the output should change when a use provides an integer seed, for example.
What happens now if the user passes a new random Generator instance?
… On Sep 15, 2019, at 21:41, William Ayd ***@***.***> wrote:
There should already be _np_version_under1p17 from NumPy compat which you can use internally
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub, or mute the thread.
|
|
Guarantee-wise, it would be probably be best to match NEP 19 If you just replace |
Our sample APIs take numpy random generators now so closing |
Numpy 1.17 introduced a new random module with faster PRNGs, and which drops the strict reproducibility of random streams guarantee, which allows some algorithmic improvements. In particular, the choice method is now a lot faster in the replace=False case. Would it make sense for
random_state
to return a np.random.Generator instead of a np.random.RandomState when numpy version >= 1.17 here: https://github.com/pandas-dev/pandas/blob/master/pandas/core/common.py#L408. This would automatically speed up the DataFrame.sample method for instance.I can write a PR, but I'm not sure how to handle the different numpy versions. Should I just do the tests inside
random_state
or is something that needs to go inside numpy.compat?The text was updated successfully, but these errors were encountered: