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

Add docstring for `PoissonRV`

上级 4c7389b0
...@@ -533,6 +533,18 @@ dirichlet = DirichletRV() ...@@ -533,6 +533,18 @@ dirichlet = DirichletRV()
class PoissonRV(RandomVariable): class PoissonRV(RandomVariable):
r"""A poisson discrete random variable.
The probability mass function for `poisson` in terms of the expected number
of events :math:`\lambda` is:
.. math::
f(k; \lambda) = \frac{\lambda^k e^{-\lambda}}{k!}
for :math:`\lambda > 0`.
"""
name = "poisson" name = "poisson"
ndim_supp = 0 ndim_supp = 0
ndims_params = [0] ndims_params = [0]
...@@ -540,6 +552,19 @@ class PoissonRV(RandomVariable): ...@@ -540,6 +552,19 @@ class PoissonRV(RandomVariable):
_print_name = ("Pois", "\\operatorname{Pois}") _print_name = ("Pois", "\\operatorname{Pois}")
def __call__(self, lam=1.0, size=None, **kwargs): def __call__(self, lam=1.0, size=None, **kwargs):
r"""Draw samples from a poisson distribution.
Parameters
----------
lam
Expected number of events :math:`\lambda`. Must be positive.
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.
"""
return super().__call__(lam, size=size, **kwargs) return super().__call__(lam, size=size, **kwargs)
......
...@@ -63,3 +63,6 @@ Aesara can produce :class:`RandomVariable`\s that draw samples from many differe ...@@ -63,3 +63,6 @@ Aesara can produce :class:`RandomVariable`\s that draw samples from many differe
.. autoclass:: aesara.tensor.random.basic.LogNormalRV .. autoclass:: aesara.tensor.random.basic.LogNormalRV
:members: __call__ :members: __call__
.. autoclass:: aesara.tensor.random.basic.PoissonRV
:members: __call__
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论