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

Add docstring for `RandIntRV`

上级 0f7f9361
...@@ -1625,6 +1625,12 @@ categorical = CategoricalRV() ...@@ -1625,6 +1625,12 @@ categorical = CategoricalRV()
class RandIntRV(RandomVariable): class RandIntRV(RandomVariable):
r"""A discrete uniform random variable.
Only available for `RandomStateType`. Use `integers` with `RandomGeneratorType`\s.
"""
name = "randint" name = "randint"
ndim_supp = 0 ndim_supp = 0
ndims_params = [0, 0] ndims_params = [0, 0]
...@@ -1632,6 +1638,25 @@ class RandIntRV(RandomVariable): ...@@ -1632,6 +1638,25 @@ class RandIntRV(RandomVariable):
_print_name = ("randint", "\\operatorname{randint}") _print_name = ("randint", "\\operatorname{randint}")
def __call__(self, low, high=None, size=None, **kwargs): def __call__(self, low, high=None, size=None, **kwargs):
r"""Draw samples from a discrete uniform distribution.
Parameters
----------
low
Lower boundary of the output interval. All values generated will
be greater than or equal to `low`, unless `high=None`, in which case
all values generated are greater than or equal to `0` and
smaller than `low` (exclusive).
high
Upper boundary of the output interval. All values generated
will be smaller than `high` (exclusive).
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.
"""
if high is None: if high is None:
low, high = 0, low low, high = 0, low
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.RandIntRV
:members: __call__
.. autoclass:: aesara.tensor.random.basic.IntegersRV .. autoclass:: aesara.tensor.random.basic.IntegersRV
:members: __call__ :members: __call__
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论