8000 Should we consider moving from legacy numpy `RandomState` to `Random.Generator`? · Issue #27008 · scikit-learn/scikit-learn · GitHub
[go: up one dir, main page]

Skip to content
Should we consider moving from legacy numpy RandomState to Random.Generator? #27008
Closed
@lucyleeow

Description

@lucyleeow

Numpy RandomState is now legacy ("This generator is considered frozen and will have no further improvement") and the documentation advises against using it:

This class should only be used if it is essential to have randoms that are identical to what would have been produced by previous versions of NumPy.

However, it sounds like RandomState will always work:

It is guaranteed to produce the same values as the final point release of NumPy v1.16.

NEP19 also says

All current usages of RandomState will continue to work in perpetuity, though some may be discouraged through documentation.

numpy.random.Generator was introduced in version 1.17 (specifically this PR) - our min dep is higher than this.

I don't have enough knowledge to know in what way the new generator is better (except for performance) but just asking as it is advised to not use the old one.

(Edit: for context saw this while working on #26958)

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0