scikit-learn / scikit-learn/scikit-learn
Using `rng=` keyword argument for NumPy randomness
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 67.3k
- Forks
- 27.4k
- Avg merge
- 1d 15h
- Merged PRs (30d)
- 58
Description
In SPEC7 https://github.com/scientific-python/specs/pull/180, has two goals:
- Deprecate the use of
RandomStateandnp.random.seed - Standardize the usage of
rngfor 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 of random_state is that it is a "better name" for NumPy's Random Generator. I am okay with keeping random_state and not have users go the pain of changing their code.
Currently, scikit-learn does not support generators because we tied it to https://github.com/scikit-learn/enhancement_proposals/pull/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 https://github.com/scikit-learn/enhancement_proposals/pull/88, we can fix it for both RandomState and Generators.
@scikit-learn/core-devs What do you think of SPEC7's proposal?
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reading SPEC7, NEP19, and enhancement proposal 88, then review the seven comments for the unresolved position on RandomState, np.random.seed, and Generator support. The issue is complete only after the API direction and required scope are agreed; it does not identify files or tests to change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- machine-learning
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100