提交 00c9d5cc authored 作者: Rémi Louf's avatar Rémi Louf 提交者: Brandon T. Willard

Add docstring for `HyperGeometricRV`

上级 b1bf7874
...@@ -887,12 +887,45 @@ geometric = GeometricRV() ...@@ -887,12 +887,45 @@ geometric = GeometricRV()
class HyperGeometricRV(RandomVariable): class HyperGeometricRV(RandomVariable):
r"""A hypergeometric discrete random variable.
The probability mass function for `hypergeometric` for the number of
successes :math:`k` in :math:`n` draws without replacement, from a
finite population of size :math:`N` with :math:`K` desired items is:
.. math::
f(k; n, N, K) = \frac{{K \choose k} {N-K \choose n-k}}{{N \choose n}}
"""
name = "hypergeometric" name = "hypergeometric"
ndim_supp = 0 ndim_supp = 0
ndims_params = [0, 0, 0] ndims_params = [0, 0, 0]
dtype = "int64" dtype = "int64"
_print_name = ("HyperGeom", "\\operatorname{HyperGeom}") _print_name = ("HyperGeom", "\\operatorname{HyperGeom}")
def __call__(self, ngood, nbad, nsample, size=None, **kwargs):
r"""Draw samples from a geometric distribution.
Parameters
----------
ngood
Number :math:`K` of desirable items in the population.
nbad
Number :math:`N-K` of undesirable items in the population.
nsample
Number :math:`n` of items sampled. Must be less than :math:`N`,
i.e. `ngood + nbad`.`
size
Sample shape. If the given size is, e.g. `(m, n, k)` then `m * n * k`
independent, identically distributed random variables are
returned. Default is `None` in which case a single random variable
is returned if `ngood`, `nbad` and `nsample` are all scalars.
Otherwise `np.broadcast(ngood, nbad, nsample).size` samples are drawn.
"""
return super().__call__(ngood, nbad, nsample, size=size, **kwargs)
hypergeometric = HyperGeometricRV() hypergeometric = HyperGeometricRV()
......
...@@ -67,6 +67,9 @@ Aesara can produce :class:`RandomVariable`\s that draw samples from many differe ...@@ -67,6 +67,9 @@ Aesara can produce :class:`RandomVariable`\s that draw samples from many differe
.. autoclass:: aesara.tensor.random.basic.HalfNormalRV .. autoclass:: aesara.tensor.random.basic.HalfNormalRV
:members: __call__ :members: __call__
.. autoclass:: aesara.tensor.random.basic.HyperGeometricRV
:members: __call__
.. autoclass:: aesara.tensor.random.basic.LogisticRV .. autoclass:: aesara.tensor.random.basic.LogisticRV
:members: __call__ :members: __call__
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论