Skip to content

parts of the random API missing from intersphinx #14359

Closed

Description

@rgommers

detected in a couple of doc build issues/PRs in SciPy now, see scipy/scipy#10540 (comment)

The numpy.random refactor somehow has caused entries in the intersphinx numpy output to go missing. at least numpy.random.RandomState and numpy.random.weibull, so probably the whole older API is missing (and perhaps the new one as well).

The tracking issue for the workaround in SciPy (explicitly referencing random.mtrand.<object> is scipy/scipy#10545

Activity

  1. rgommers commented on Aug 25, 2019

    @rgommers
    MemberAuthor

    okay there's quite a few other issues in the numpy.random docs, I'll see if I can send a fix today.

  2. added a commit that references this issue on Aug 25, 2019
    d882d39
  3. deleted a comment from Aa88s on Sep 1, 2019
  4. rgommers commented on Sep 1, 2019

    @rgommers
    MemberAuthor

    gh-14360 doesn't address everything yet, I just discovered that all np.random.<funcname> functions are missing from the docs.

  5. rgommers commented on Sep 7, 2019

    @rgommers
    MemberAuthor

    Left to decide: there's still two namespaces left that look private:

    • numpy.random.entropy (contains random_entropy and seed_by_array, unclear if those need to be public)
    • numpy.random.bit_generator (contains only BitGenerator as a public object I think)

    Left to do:

    doc/source/reference/random/index.rst is missing links to numpy.random.<function> (e.g. np.random.seed, np.random.randn). They are completely missing from the docs.

  6. bashtage commented on Sep 13, 2019

    @bashtage
    Contributor
    • numpy.random.entropy (contains random_entropy and seed_by_array, unclear if those need to be public)

    I'm not sure these are used anymore after moving to SeedSeq. They might be removable. The only advantage is that random_entropy ready system entropy to an ndarray. It predates Python 3.x only and so was needed since there wasn't a good way to universally ready entropy. IIRC entropy is read from random now.

  7. mattip commented on Sep 13, 2019

    @mattip
    Member

    entropy.random_entropy is still used by mt19937.pyx. SeedSequence uses randbits. Should we move entropy to _entropy or replace it with randbits SeedSequence().generate_state(RK_STATE_LEN) (mt19967 is legacy, but this is for the case where no seed is provided)?

    Edit: use SeedSequence(), not randbits directly.

  8. bashtage commented on Sep 13, 2019

    @bashtage
    Contributor

    With that one change, then it could be removed.

  9. added a commit that references this issue on Sep 14, 2019
    307c679
  10. added this to the 1.18.0 release milestone on Sep 15, 2019
  11. mattip commented on Oct 15, 2019

    @mattip
    Member

    numpy.random.random_integers and friends are documented via RandomState, i.e. via numpy.random.RandomState.random_integers. Since we would like to encourage people not to use these functions directly, I think this is preferable.

  12. bashtage commented on Oct 16, 2019

    @bashtage
    Contributor

    entropy.random_entropy is still used by mt19937.pyx. SeedSequence uses randbits. Should we move entropy to _entropy or replace it with randbits SeedSequence().generate_state(RK_STATE_LEN) (mt19967 is legacy, but this is for the case where no seed is provided)?

    I think SS is the right idea here. Empty to not reproducible so might as well DRY here and remove entropy.

  13. mattip commented on Nov 22, 2019

    @mattip
    Member

    Is there a way to check that gh-14948 fixes scipy/scipy#10545?

  14. rgommers commented on Nov 24, 2019

    @rgommers
    MemberAuthor

    Is there a way to check that gh-14948 fixes scipy/scipy#10545?

    discussed with @mattip: this will fix it, let's just merge and then update SciPy after to use inter-sphinx links for the random functions again.

    The Cython changes are the more interesting ones in this PR.

  15. charris commented on Nov 25, 2019

    @charris
    Member

    Going to close this as the fix has a 1.18 milestone.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions