-
-
Notifications
You must be signed in to change notification settings - Fork 11k
DOC: Draw more attention to which functions in random are convenience wrappers #13035
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
Conversation
This gives an error at least as far back as 1.12.x
d40cb74
to
277e7c4
Compare
tuple as the first argument, use `numpy.random.standard_normal` instead. | ||
If positive int_like arguments are provided, `randn` generates an array | ||
of shape ``(d0, d1, ..., dn)``, filled | ||
with random floats sampled from a univariate "normal" (Gaussian) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't need quotes around "normal".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inherited from the old docstring
This is a convenience function. If you want an interface that takes a | ||
tuple as the first argument, use `numpy.random.standard_normal` instead. | ||
If positive int_like arguments are provided, `randn` generates an array | ||
of shape ``(d0, d1, ..., dn)``, filled |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Might as well justify the text a bit more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes the diff noisier and the two commits harder to separate, would prefer not to
numpy/random/mtrand/mtrand.pyx
Outdated
|
||
Notes | ||
----- | ||
For random samples from :math:`N(\\mu, \\sigma^2)`, use either of:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
"one of::"?
277e7c4
to
1e96346
Compare
Good suggestions, clearly I'm out of practice at writing docs. |
Changes can be viewed at matlab for numpy, rand, randn They seem to render nicely. |
I was hoping that zeros and ones would be links, not italic. |
Try to add
|
@charris any more comments? The new material can be viewed at matlab for numpy, rand, randn, LGTM. |
@mattip: I'd like to fix those references, but haven't had a chance. Feel free to take over to do it, else I'll try in 10 hours or so. |
In response to twitter conversations that complain that `randn` is inconsistent with `zeros`, to which the answer is "that's because randn is a wrapper to make things look like matlab".
References updated |
1e96346
to
dac6fdc
Compare
The |
I've seen people complain in the past that
randn(M, N)
is inconsistent withzeros((M, N))
. They're right, but they're missing the point thatrandn
exists to be consistent with Matlab, not to be self-consistent with numpy.Let's point those users more obviously to the function they're looking for.