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

Add docstring for `TruncExponentialRV`

上级 25ceb3d2
...@@ -1171,12 +1171,45 @@ wald = WaldRV() ...@@ -1171,12 +1171,45 @@ wald = WaldRV()
class TruncExponentialRV(ScipyRandomVariable): class TruncExponentialRV(ScipyRandomVariable):
r"""A truncated exponential continuous random variable.
The probability density function for `truncexp` in terms of its shape
parameter :math:`b`, location parameter :math:`\alpha` and scale
parameter :math:`\beta` is:
.. math::
f(x; b, \alpha, \beta) = \frac{\exp(-(x-\alpha)/\beta)}{\beta (1-\exp(-b))}
for :math:`0 \leq x \leq b` and :math:`\beta > 0`.
"""
name = "truncexpon" name = "truncexpon"
ndim_supp = 0 ndim_supp = 0
ndims_params = [0, 0, 0] ndims_params = [0, 0, 0]
dtype = "floatX" dtype = "floatX"
_print_name = ("TruncExp", "\\operatorname{TruncExp}") _print_name = ("TruncExp", "\\operatorname{TruncExp}")
def __call__(self, b, loc=0.0, scale=1.0, size=None, **kwargs):
r"""Draw samples from a truncated exponential distribution.
Parameters
----------
b
Shape parameter :math:`b` of the distribution. Must be positive.
loc
Location parameter :math:`\alpha` of the distribution.
scale
Scale parameter :math:`\beta` of the distribution. Must be
positive.
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__(b, loc, scale, size=size, **kwargs)
@classmethod @classmethod
def rng_fn_scipy(cls, rng, b, loc, scale, size): def rng_fn_scipy(cls, rng, b, loc, scale, size):
return stats.truncexpon.rvs( return stats.truncexpon.rvs(
......
...@@ -106,6 +106,9 @@ Aesara can produce :class:`RandomVariable`\s that draw samples from many differe ...@@ -106,6 +106,9 @@ Aesara can produce :class:`RandomVariable`\s that draw samples from many differe
.. autoclass:: aesara.tensor.random.basic.TriangularRV .. autoclass:: aesara.tensor.random.basic.TriangularRV
:members: __call__ :members: __call__
.. autoclass:: aesara.tensor.random.basic.TruncExponentialRV
:members: __call__
.. autoclass:: aesara.tensor.random.basic.UniformRV .. autoclass:: aesara.tensor.random.basic.UniformRV
:members: __call__ :members: __call__
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论