summaryrefslogtreecommitdiff
path: root/numpy
diff options
context:
space:
mode:
authorMatti Picus <matti.picus@gmail.com>2019-03-16 19:14:06 +0200
committerGitHub <noreply@github.com>2019-03-16 19:14:06 +0200
commitbee436da4efb2240752eea751971aa6ea5a3bb48 (patch)
tree4c6083602829fc264d8d7583c5d80d7e439c409b /numpy
parentdf286d00bf6236f0158fc2cedd91dd3905fc05ca (diff)
parentced4a500d81163afe1ae0c2aaa1ac5b776500e28 (diff)
downloadnumpy-bee436da4efb2240752eea751971aa6ea5a3bb48.tar.gz
Merge pull request #13115 from kshyatt/ksh/hypergeom
DOC: Fix #12050 by updating numpy.random.hypergeometric docs
Diffstat (limited to 'numpy')
-rw-r--r--numpy/random/mtrand/mtrand.pyx20
1 files changed, 11 insertions, 9 deletions
diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx
index 856198f24..5d4dee8af 100644
--- a/numpy/random/mtrand/mtrand.pyx
+++ b/numpy/random/mtrand/mtrand.pyx
@@ -4203,9 +4203,9 @@ cdef class RandomState:
Draw samples from a Hypergeometric distribution.
Samples are drawn from a hypergeometric distribution with specified
- parameters, ngood (ways to make a good selection), nbad (ways to make
- a bad selection), and nsample = number of items sampled, which is less
- than or equal to the sum ngood + nbad.
+ parameters, `ngood` (ways to make a good selection), `nbad` (ways to make
+ a bad selection), and `nsample` (number of items sampled, which is less
+ than or equal to the sum ``ngood + nbad``).
Parameters
----------
@@ -4219,14 +4219,16 @@ cdef class RandomState:
size : int or tuple of ints, optional
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
``m * n * k`` samples are drawn. If size is ``None`` (default),
- a single value is returned if ``ngood``, ``nbad``, and ``nsample``
+ a single value is returned if `ngood`, `nbad`, and `nsample`
are all scalars. Otherwise, ``np.broadcast(ngood, nbad, nsample).size``
samples are drawn.
Returns
-------
out : ndarray or scalar
- Drawn samples from the parameterized hypergeometric distribution.
+ Drawn samples from the parameterized hypergeometric distribution. Each
+ sample is the number of good items within a randomly selected subset of
+ size `nsample` taken from a set of `ngood` good items and `nbad` bad items.
See Also
--------
@@ -4241,11 +4243,11 @@ cdef class RandomState:
where :math:`0 \\le x \\le n` and :math:`n-b \\le x \\le g`
- for P(x) the probability of x successes, g = ngood, b = nbad, and
- n = number of samples.
+ for P(x) the probability of ``x`` good results in the drawn sample,
+ g = `ngood`, b = `nbad`, and n = `nsample`.
- Consider an urn with black and white marbles in it, ngood of them
- black and nbad are white. If you draw nsample balls without
+ Consider an urn with black and white marbles in it, `ngood` of them
+ are black and `nbad` are white. If you draw `nsample` balls without
replacement, then the hypergeometric distribution describes the
distribution of black balls in the drawn sample.