Skip to content

parts of the random API missing from intersphinx #14359

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

Closed
rgommers opened this issue Aug 25, 2019 · 11 comments
Closed

parts of the random API missing from intersphinx #14359

rgommers opened this issue Aug 25, 2019 · 11 comments

Comments

@rgommers
Copy link
Member

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

@rgommers
Copy link
Member Author

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

@rgommers
Copy link
Member Author

rgommers commented Sep 1, 2019

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

@rgommers
Copy link
Member Author

rgommers commented Sep 7, 2019

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.

@bashtage
Copy link
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.

@mattip
Copy link
Member

mattip commented Sep 13, 2019

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.

@bashtage
Copy link
Contributor

With that one change, then it could be removed.

@mattip
Copy link
Member

mattip commented Oct 15, 2019

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.

@bashtage
Copy link
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.

@mattip
Copy link
Member

mattip commented Nov 22, 2019

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

@rgommers
Copy link
Member Author

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.

@charris
Copy link
Member

charris commented Nov 25, 2019

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
Projects
None yet
Development

No branches or pull requests

4 participants