From 9c3151f818a88ba260956220c5d4e9d0294f03cd Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Wed, 13 Mar 2019 18:49:03 -0400 Subject: DOC: Fix #12050 by updating numpy.random.hypergeometric docs - Add backticks for some parameters in the body - Address the wording changes in the issue --- numpy/random/mtrand/mtrand.pyx | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'numpy') diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx index 856198f24..4be77c49c 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 ---------- @@ -4226,7 +4226,7 @@ cdef class RandomState: Returns ------- out : ndarray or scalar - Drawn samples from the parameterized hypergeometric distribution. + Number of drawn good samples from the parameterized hypergeometric distribution. See Also -------- @@ -4241,11 +4241,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. -- cgit v1.2.1 From ced4a500d81163afe1ae0c2aaa1ac5b776500e28 Mon Sep 17 00:00:00 2001 From: Katharine Hyatt Date: Thu, 14 Mar 2019 10:12:10 -0400 Subject: Fix backticks, expand out docstring, improve consistency --- numpy/random/mtrand/mtrand.pyx | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) (limited to 'numpy') diff --git a/numpy/random/mtrand/mtrand.pyx b/numpy/random/mtrand/mtrand.pyx index 4be77c49c..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 - Number of drawn good 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 -------- @@ -4242,10 +4244,10 @@ 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`` good results in the drawn sample, - g = ``ngood``, b = ``nbad``, and n = ``nsample``. + g = `ngood`, b = `nbad`, and n = `nsample`. - 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 + 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. -- cgit v1.2.1