Skip to content

DOC: typo in docstring numpy.random.beta, shape parameters must be positive not non-negative #12347

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

Merged
merged 1 commit into from
Nov 7, 2018
Merged

DOC: typo in docstring numpy.random.beta, shape parameters must be positive not non-negative #12347

merged 1 commit into from
Nov 7, 2018

Conversation

guilgautier
Copy link
Contributor

Shape parameters of $\Beta(a,b)$ must be positive not non-negative.

See https://en.wikipedia.org/wiki/Beta_distribution

capture d ecran 2018-11-07 a 12 08 18

@mattip
Copy link
Member

mattip commented Nov 7, 2018

Does the code accept 0?

@guilgautier
Copy link
Contributor Author

My PR might not be clear enough, sorry for that @mattip.
Let me explain a bit further

Does the code accept 0?

No it doesn't.

That's why there is a mismatch between the docs saying

Alpha/Beta, non-negative i.e. >= 0

And the fact that when passing a,b=0 raises ValueError: a, b <= 0

a, b = 0, 1
np.random.beta(a, b)

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-21-97f175c35f60> in <module>
      1 a, b = 0, 1
----> 2 np.random.beta(a, b)

mtrand.pyx in mtrand.RandomState.beta()

ValueError: a <= 0
a, b = 1, 0
np.random.beta(a, b)

---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-22-76de2fb817e8> in <module>
      1 a, b = 1, 0
----> 2 np.random.beta(a, b)

mtrand.pyx in mtrand.RandomState.beta()

ValueError: b <= 0

Hence my tiny PR to fix

Alpha/Beta, non-negative i.e. >= 0
to
Alpha/Beta, positive (> 0)

@mattip mattip merged commit 8715400 into numpy:master Nov 7, 2018
@mattip
Copy link
Member

mattip commented Nov 7, 2018

Thanks @guilgautier

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants