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

Add docstring for `ChiSquareRV`

上级 6131a25d
...@@ -432,12 +432,48 @@ gamma = GammaRV() ...@@ -432,12 +432,48 @@ gamma = GammaRV()
class ChiSquareRV(RandomVariable): class ChiSquareRV(RandomVariable):
r"""A chi square continuous random variable.
The probability density function for `chisquare` in terms of the number of degrees of
freedom :math:`k` is:
.. math::
f(x; k) = \frac{(1/2)^{k/2}}{\Gamma(k/2)} x^{k/2-1} e^{-x/2}
for :math:`k > 2`. :math:`\Gamma` is the gamma function:
.. math::
\Gamma(x) = \int_0^{\infty} t^{x-1} e^{-t} \mathrm{d}t
This variable is obtained by summing the squares :math:`k` independent, standard normally
distributed random variables.
"""
name = "chisquare" name = "chisquare"
ndim_supp = 0 ndim_supp = 0
ndims_params = [0] ndims_params = [0]
dtype = "floatX" dtype = "floatX"
_print_name = ("ChiSquare", "\\operatorname{ChiSquare}") _print_name = ("ChiSquare", "\\operatorname{ChiSquare}")
def __call__(self, df, size=None, **kwargs):
r"""Draw samples from a chisquare distribution.
Parameters
----------
df
The number :math:`k` of degrees of freedom. 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__(df, size=size, **kwargs)
chisquare = ChiSquareRV() chisquare = ChiSquareRV()
......
...@@ -61,6 +61,9 @@ Aesara can produce :class:`RandomVariable`\s that draw samples from many differe ...@@ -61,6 +61,9 @@ Aesara can produce :class:`RandomVariable`\s that draw samples from many differe
.. autoclass:: aesara.tensor.random.basic.GammaRV .. autoclass:: aesara.tensor.random.basic.GammaRV
:members: __call__ :members: __call__
.. autoclass:: aesara.tensor.random.basic.ChiSquareRV
:members: __call__
.. autoclass:: aesara.tensor.random.basic.NormalRV .. autoclass:: aesara.tensor.random.basic.NormalRV
:members: __call__ :members: __call__
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论