diff options
author | Warren Weckesser <warren.weckesser@gmail.com> | 2019-10-18 04:12:24 -0400 |
---|---|---|
committer | Warren Weckesser <warren.weckesser@gmail.com> | 2019-10-18 04:12:24 -0400 |
commit | 8634b18abdb30629b4b869f0c81bb7a350832baa (patch) | |
tree | 81ded688d97dcca235c9e6eded5210d7d94b5919 /numpy/polynomial/polyutils.py | |
parent | 9ee262b5bf89e8c866a507e4d62b78532361adc2 (diff) | |
download | numpy-8634b18abdb30629b4b869f0c81bb7a350832baa.tar.gz |
ENH: random: Add the multivariate hypergeometric distribution
The new method
multivariate_hypergeometric(self, object colors, object nsample,
size=None, method='marginals')
of the class numpy.random.Generator implements the multivariate
hypergeometric distribution; see
https://en.wikipedia.org/wiki/Hypergeometric_distribution,
specifically the section "Multivariate hypergeometric distribution".
Two algorithms are implemented. The user selects which algorithm
to use with the `method` parameter. The default, `method='marginals'`,
is based on repeated calls of the univariate hypergeometric
distribution function. The other algorithm, selected with
`method='count'`, is a brute-force method that allocates an
internal array of length ``sum(colors)``. It should only be used
when that value is small, but it can be much faster than the
"marginals" algorithm in that case.
The C implementations of the two methods are in the files
random_mvhg_count.c and random_mvhg_marginals.c in
numpy/random/src/distributions.
Diffstat (limited to 'numpy/polynomial/polyutils.py')
0 files changed, 0 insertions, 0 deletions