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

Add docstring for `UniformRV`

上级 c42d4fb8
...@@ -70,6 +70,19 @@ class ScipyRandomVariable(RandomVariable): ...@@ -70,6 +70,19 @@ class ScipyRandomVariable(RandomVariable):
class UniformRV(RandomVariable): class UniformRV(RandomVariable):
r"""A uniform continuous random variable.
The probability density function for `uniform` within the interval :math:`[l, h)` is:
.. math::
\begin{split}
f(x; l, h) = \begin{cases}
\frac{1}{h-l}\quad \text{for $l \leq x \leq h$},\\
0\quad \text{otherwise}.
\end{cases}
\end{split}
"""
name = "uniform" name = "uniform"
ndim_supp = 0 ndim_supp = 0
ndims_params = [0, 0] ndims_params = [0, 0]
...@@ -77,6 +90,25 @@ class UniformRV(RandomVariable): ...@@ -77,6 +90,25 @@ class UniformRV(RandomVariable):
_print_name = ("U", "\\operatorname{U}") _print_name = ("U", "\\operatorname{U}")
def __call__(self, low=0.0, high=1.0, size=None, **kwargs): def __call__(self, low=0.0, high=1.0, size=None, **kwargs):
r"""Draw samples from a uniform distribution.
The results are undefined when `high < low`.
Parameters
----------
low
Lower boundary :math:`l` of the output interval; all values generated
will be greater than or equal to `low`.
high
Upper boundary :math:`h` of the output interval; all values generated
will be less than or equal to `high`.
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__(low, high, size=size, **kwargs) return super().__call__(low, high, size=size, **kwargs)
......
...@@ -49,6 +49,9 @@ Distributions ...@@ -49,6 +49,9 @@ Distributions
Aesara can produce :class:`RandomVariable`\s that draw samples from many different statistical distributions, using the following :class:`Op`\s. Aesara can produce :class:`RandomVariable`\s that draw samples from many different statistical distributions, using the following :class:`Op`\s.
.. autoclass:: aesara.tensor.random.basic.UniformRV
:members: __call__
.. autoclass:: aesara.tensor.random.basic.GammaRV .. autoclass:: aesara.tensor.random.basic.GammaRV
:members: __call__ :members: __call__
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论