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

Add docstring for `InvGammaRV`

上级 007e110a
...@@ -1081,12 +1081,46 @@ halfcauchy = HalfCauchyRV() ...@@ -1081,12 +1081,46 @@ halfcauchy = HalfCauchyRV()
class InvGammaRV(ScipyRandomVariable): class InvGammaRV(ScipyRandomVariable):
r"""An inverse-gamma continuous random variable.
The probability density function for `invgamma` in terms of its shape
parameter :math:`\alpha` and scale parameter :math:`\beta` is:
.. math::
f(x; \alpha, \beta) = \frac{\beta^\alpha}{\Gamma(\alpha)} x^{-(\alpha+1)} \exp\left(-\frac{\beta}{x}\right)
for :math:`x > 0`, where :math:`\alpha > 0` and :math:`\beta > 0`. :math:`Gamma` is the gamma function :
.. math::
\Gamma(x) = \int_0^{\infty} t^{x-1} e^{-t} \mathrm{d}t
"""
name = "invgamma" name = "invgamma"
ndim_supp = 0 ndim_supp = 0
ndims_params = [0, 0] ndims_params = [0, 0]
dtype = "floatX" dtype = "floatX"
_print_name = ("InvGamma", "\\operatorname{Gamma^{-1}}") _print_name = ("InvGamma", "\\operatorname{Gamma^{-1}}")
def __call__(self, shape, scale, size=None, **kwargs):
r"""Draw samples from an inverse-gamma distribution.
Parameters
----------
shape
Shape parameter :math:`\alpha` of the distribution. Must be positive.
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 sample are returned. Default is
`None`, in which case a single sample is returned.
"""
return super().__call__(shape, scale, size=size, **kwargs)
@classmethod @classmethod
def rng_fn_scipy(cls, rng, shape, scale, size): def rng_fn_scipy(cls, rng, shape, scale, size):
return stats.invgamma.rvs(shape, scale=scale, size=size, random_state=rng) return stats.invgamma.rvs(shape, scale=scale, size=size, random_state=rng)
......
...@@ -82,6 +82,9 @@ Aesara can produce :class:`RandomVariable`\s that draw samples from many differe ...@@ -82,6 +82,9 @@ Aesara can produce :class:`RandomVariable`\s that draw samples from many differe
.. autoclass:: aesara.tensor.random.basic.HyperGeometricRV .. autoclass:: aesara.tensor.random.basic.HyperGeometricRV
:members: __call__ :members: __call__
.. autoclass:: aesara.tensor.random.basic.InvGammaRV
:members: __call__
.. autoclass:: aesara.tensor.random.basic.LogisticRV .. autoclass:: aesara.tensor.random.basic.LogisticRV
:members: __call__ :members: __call__
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论