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

Add docstring for `GeometricRV`

上级 00c9d5cc
......@@ -876,12 +876,42 @@ poisson = PoissonRV()
class GeometricRV(RandomVariable):
r"""A geometric discrete random variable.
The probability mass function for `geometric` for the number of successes :math:`k`
before the first failure in terms of the probability of success :math:`p` of a single
trial is:
.. math::
f(k; p) = p^{k-1}(1-p)
for :math:`0 \geq p \geq 1`.
"""
name = "geometric"
ndim_supp = 0
ndims_params = [0]
dtype = "int64"
_print_name = ("Geom", "\\operatorname{Geom}")
def __call__(self, p, size=None, **kwargs):
r"""Draw samples from a geometric distribution.
Parameters
----------
p
Probability of success :math:`p` of an individual trial.
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 `p` is a scalar. Otherwise `np.array(p).size` samples
are drawn.
"""
return super().__call__(p, size=size, **kwargs)
geometric = GeometricRV()
......
......@@ -61,6 +61,9 @@ Aesara can produce :class:`RandomVariable`\s that draw samples from many differe
.. autoclass:: aesara.tensor.random.basic.GammaRV
:members: __call__
.. autoclass:: aesara.tensor.random.basic.GeometricRV
:members: __call__
.. autoclass:: aesara.tensor.random.basic.GumbelRV
:members: __call__
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论