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

Add docstring for `NegBinomialRV`

上级 330dc5ed
......@@ -1350,12 +1350,40 @@ binomial = BinomialRV()
class NegBinomialRV(ScipyRandomVariable):
r"""A negative binomial discrete random variable.
The probability mass function for `nbinom` for the number :math:`k` of draws
before observing the :math:`n`\th success in terms of the probability of
success :math:`p` of a single trial is:
.. math::
f(k; p, n) = {k+n-1 \choose n-1} p^n (1-p)^{k}
"""
name = "nbinom"
ndim_supp = 0
ndims_params = [0, 0]
dtype = "int64"
_print_name = ("NB", "\\operatorname{NB}")
def __call__(self, n, p, size=None, **kwargs):
r"""Draw samples from a negative binomial distribution.
Parameters
----------
n
Number of successes :math:`n`. Must be a positive integer.
p
Probability of success :math:`p` of a single trial.
size
Sample shape. If the given size is `(m, n, k)`, then `m * n * k`
independent, identically distributed samples are returned. Default
is `None` in which case a single sample is returned.
"""
return super().__call__(n, p, size=size, **kwargs)
@classmethod
def rng_fn_scipy(cls, rng, n, p, size):
return stats.nbinom.rvs(n, p, size=size, random_state=rng)
......
......@@ -100,6 +100,9 @@ Aesara can produce :class:`RandomVariable`\s that draw samples from many differe
.. autoclass:: aesara.tensor.random.basic.LogNormalRV
:members: __call__
.. autoclass:: aesara.tensor.random.basic.NegBinomialRV
:members: __call__
.. autoclass:: aesara.tensor.random.basic.NormalRV
:members: __call__
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论