-
-
Notifications
You must be signed in to change notification settings - Fork 25.6k
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
Using rng=
keyword argument for NumPy randomness
#29315
Comments
For 2, the primary reason around using rng instead of random_state is that it is a "better name" for NumPy's [3]Random Generator. I am okay with keeping random_state and not have users go the pain of changing their code.
+1
It was interesting to me to witness the reactions to numpy 2.0. Senior and visible people who had been vocal to criticize historical choices in numpy and slowness of numpy to move forward where also the same to complain about breakage across their stacks and environments.
|
Oh well, I guess it's not that easy to make people happy 😝 |
The I personally don't mind renaming I also wouldn't deprecate |
I agree that we should provide a benefit to the user if we make them change from I like the idea of using the switch from
Thomas, is this a proposal to add |
rng=
kwargs for NumPy randomnessrng=
keyword argument for NumPy randomness
No. That proposal is to not use |
This means we'd also accept a random generator as argument to That seems like a good enough reason to allow people to pass a generator as |
To be quite clear, in NEP 19, I am very much staking the ground that
SPEC7 does not recommend a name change just because we are dealing with The deprecation lifecycle proposed by SPEC7 has an intermediate state that is somewhat along the lines of "allow people to pass a
Yes, this is the case. As for what features using |
In SPEC7 scientific-python/specs#180, has two goals:
RandomState
andnp.random.seed
rng
for setting seeding.For 1, according to NEP19, I do not think NumPy wants to deprecate
np.random.seed
because they see valid use cases.For 2, the primary reason around using
rng
instead ofrandom_state
is that it is a "better name" for NumPy's Random Generator. I am okay with keepingrandom_state
and not have users go the pain of changing their code.Currently, scikit-learn does not support generators because we tied it to scikit-learn/enhancement_proposals#88. We wanted to use generators to cleanly switch to a different RNG behavior compared to RandomState. For me, I think they can be decoupled. If we tackle scikit-learn/enhancement_proposals#88, we can fix it for both RandomState and Generators.
@scikit-learn/core-devs What do you think of SPEC7's proposal?
The text was updated successfully, but these errors were encountered: