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

Add gufunc signature to `RandomVariable`\'s docstrings

上级 62326376
...@@ -94,6 +94,11 @@ class UniformRV(RandomVariable): ...@@ -94,6 +94,11 @@ class UniformRV(RandomVariable):
The results are undefined when `high < low`. The results are undefined when `high < low`.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
low low
...@@ -141,6 +146,11 @@ class TriangularRV(RandomVariable): ...@@ -141,6 +146,11 @@ class TriangularRV(RandomVariable):
def __call__(self, left, mode, right, size=None, **kwargs): def __call__(self, left, mode, right, size=None, **kwargs):
r"""Draw samples from a triangular distribution. r"""Draw samples from a triangular distribution.
Signature
---------
`(), (), () -> ()`
Parameters Parameters
---------- ----------
left left
...@@ -191,6 +201,11 @@ class BetaRV(RandomVariable): ...@@ -191,6 +201,11 @@ class BetaRV(RandomVariable):
def __call__(self, alpha, beta, size=None, **kwargs): def __call__(self, alpha, beta, size=None, **kwargs):
r"""Draw samples from a beta distribution. r"""Draw samples from a beta distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
alpha alpha
...@@ -232,6 +247,11 @@ class NormalRV(RandomVariable): ...@@ -232,6 +247,11 @@ class NormalRV(RandomVariable):
def __call__(self, loc=0.0, scale=1.0, size=None, **kwargs): def __call__(self, loc=0.0, scale=1.0, size=None, **kwargs):
r"""Draw samples from a normal distribution. r"""Draw samples from a normal distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
loc loc
...@@ -265,6 +285,11 @@ class StandardNormalRV(NormalRV): ...@@ -265,6 +285,11 @@ class StandardNormalRV(NormalRV):
def __call__(self, size=None, **kwargs): def __call__(self, size=None, **kwargs):
"""Draw samples from a standard normal distribution. """Draw samples from a standard normal distribution.
Signature
---------
`nil -> ()`
Parameters Parameters
---------- ----------
size size
...@@ -302,6 +327,11 @@ class HalfNormalRV(ScipyRandomVariable): ...@@ -302,6 +327,11 @@ class HalfNormalRV(ScipyRandomVariable):
def __call__(self, loc=0.0, scale=1.0, size=None, **kwargs): def __call__(self, loc=0.0, scale=1.0, size=None, **kwargs):
r"""Draw samples from a half-normal distribution. r"""Draw samples from a half-normal distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
loc loc
...@@ -362,6 +392,11 @@ class LogNormalRV(RandomVariable): ...@@ -362,6 +392,11 @@ class LogNormalRV(RandomVariable):
def __call__(self, mean=0.0, sigma=1.0, size=None, **kwargs): def __call__(self, mean=0.0, sigma=1.0, size=None, **kwargs):
r"""Draw sample from a lognormal distribution. r"""Draw sample from a lognormal distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
mean mean
...@@ -408,6 +443,11 @@ class GammaRV(ScipyRandomVariable): ...@@ -408,6 +443,11 @@ class GammaRV(ScipyRandomVariable):
def __call__(self, shape, rate, size=None, **kwargs): def __call__(self, shape, rate, size=None, **kwargs):
r"""Draw samples from a gamma distribution. r"""Draw samples from a gamma distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
shape shape
...@@ -461,6 +501,11 @@ class ChiSquareRV(RandomVariable): ...@@ -461,6 +501,11 @@ class ChiSquareRV(RandomVariable):
def __call__(self, df, size=None, **kwargs): def __call__(self, df, size=None, **kwargs):
r"""Draw samples from a chisquare distribution. r"""Draw samples from a chisquare distribution.
Signature
---------
`() -> ()`
Parameters Parameters
---------- ----------
df df
...@@ -500,6 +545,11 @@ class ParetoRV(ScipyRandomVariable): ...@@ -500,6 +545,11 @@ class ParetoRV(ScipyRandomVariable):
def __call__(self, b, scale=1.0, size=None, **kwargs): def __call__(self, b, scale=1.0, size=None, **kwargs):
r"""Draw samples from a pareto distribution. r"""Draw samples from a pareto distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
b b
...@@ -551,6 +601,11 @@ class GumbelRV(ScipyRandomVariable): ...@@ -551,6 +601,11 @@ class GumbelRV(ScipyRandomVariable):
) -> RandomVariable: ) -> RandomVariable:
r"""Draw samples from a gumbel distribution. r"""Draw samples from a gumbel distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
loc loc
...@@ -601,6 +656,11 @@ class ExponentialRV(RandomVariable): ...@@ -601,6 +656,11 @@ class ExponentialRV(RandomVariable):
def __call__(self, scale=1.0, size=None, **kwargs): def __call__(self, scale=1.0, size=None, **kwargs):
r"""Draw samples from an exponential distribution. r"""Draw samples from an exponential distribution.
Signature
---------
`() -> ()`
Parameters Parameters
---------- ----------
scale scale
...@@ -639,6 +699,11 @@ class WeibullRV(RandomVariable): ...@@ -639,6 +699,11 @@ class WeibullRV(RandomVariable):
def __call__(self, shape, size=None, **kwargs): def __call__(self, shape, size=None, **kwargs):
r"""Draw samples from a weibull distribution. r"""Draw samples from a weibull distribution.
Signature
---------
`() -> ()`
Parameters Parameters
---------- ----------
shape shape
...@@ -678,6 +743,12 @@ class LogisticRV(RandomVariable): ...@@ -678,6 +743,12 @@ class LogisticRV(RandomVariable):
def __call__(self, loc=0, scale=1, size=None, **kwargs): def __call__(self, loc=0, scale=1, size=None, **kwargs):
r"""Draw samples from a logistic distribution. r"""Draw samples from a logistic distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
loc loc
...@@ -720,6 +791,11 @@ class VonMisesRV(RandomVariable): ...@@ -720,6 +791,11 @@ class VonMisesRV(RandomVariable):
def __call__(self, mu, kappa, size=None, **kwargs): def __call__(self, mu, kappa, size=None, **kwargs):
r"""Draw samples from a von Mises distribution. r"""Draw samples from a von Mises distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
mu mu
...@@ -782,6 +858,11 @@ class MvNormalRV(RandomVariable): ...@@ -782,6 +858,11 @@ class MvNormalRV(RandomVariable):
def __call__(self, mean=None, cov=None, size=None, **kwargs): def __call__(self, mean=None, cov=None, size=None, **kwargs):
r""" "Draw samples from a multivariate normal distribution. r""" "Draw samples from a multivariate normal distribution.
Signature
---------
`(n), (n,n) -> (n)`
Parameters Parameters
---------- ----------
mean mean
...@@ -856,6 +937,11 @@ class DirichletRV(RandomVariable): ...@@ -856,6 +937,11 @@ class DirichletRV(RandomVariable):
def __call__(self, alphas, size=None, **kwargs): def __call__(self, alphas, size=None, **kwargs):
r"""Draw samples from a dirichlet distribution. r"""Draw samples from a dirichlet distribution.
Signature
---------
`(k) -> (k)`
Parameters Parameters
---------- ----------
alphas alphas
...@@ -916,6 +1002,11 @@ class PoissonRV(RandomVariable): ...@@ -916,6 +1002,11 @@ class PoissonRV(RandomVariable):
def __call__(self, lam=1.0, size=None, **kwargs): def __call__(self, lam=1.0, size=None, **kwargs):
r"""Draw samples from a poisson distribution. r"""Draw samples from a poisson distribution.
Signature
---------
`() -> ()`
Parameters Parameters
---------- ----------
lam lam
...@@ -956,6 +1047,11 @@ class GeometricRV(RandomVariable): ...@@ -956,6 +1047,11 @@ class GeometricRV(RandomVariable):
def __call__(self, p, size=None, **kwargs): def __call__(self, p, size=None, **kwargs):
r"""Draw samples from a geometric distribution. r"""Draw samples from a geometric distribution.
Signature
---------
`() -> ()`
Parameters Parameters
---------- ----------
p p
...@@ -993,6 +1089,11 @@ class HyperGeometricRV(RandomVariable): ...@@ -993,6 +1089,11 @@ class HyperGeometricRV(RandomVariable):
def __call__(self, ngood, nbad, nsample, size=None, **kwargs): def __call__(self, ngood, nbad, nsample, size=None, **kwargs):
r"""Draw samples from a geometric distribution. r"""Draw samples from a geometric distribution.
Signature
---------
`(), (), () -> ()`
Parameters Parameters
---------- ----------
ngood ngood
...@@ -1036,6 +1137,11 @@ class CauchyRV(ScipyRandomVariable): ...@@ -1036,6 +1137,11 @@ class CauchyRV(ScipyRandomVariable):
def __call__(self, loc=0.0, scale=1.0, size=None, **kwargs): def __call__(self, loc=0.0, scale=1.0, size=None, **kwargs):
r"""Draw samples from a Cauchy distribution. r"""Draw samples from a Cauchy distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
loc loc
...@@ -1081,6 +1187,11 @@ class HalfCauchyRV(ScipyRandomVariable): ...@@ -1081,6 +1187,11 @@ class HalfCauchyRV(ScipyRandomVariable):
def __call__(self, loc=0.0, scale=1.0, size=None, **kwargs): def __call__(self, loc=0.0, scale=1.0, size=None, **kwargs):
r"""Draw samples from a half-Cauchy distribution. r"""Draw samples from a half-Cauchy distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
loc loc
...@@ -1130,6 +1241,11 @@ class InvGammaRV(ScipyRandomVariable): ...@@ -1130,6 +1241,11 @@ class InvGammaRV(ScipyRandomVariable):
def __call__(self, shape, scale, size=None, **kwargs): def __call__(self, shape, scale, size=None, **kwargs):
r"""Draw samples from an inverse-gamma distribution. r"""Draw samples from an inverse-gamma distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
shape shape
...@@ -1175,6 +1291,11 @@ class WaldRV(RandomVariable): ...@@ -1175,6 +1291,11 @@ class WaldRV(RandomVariable):
def __call__(self, mean=1.0, scale=1.0, size=None, **kwargs): def __call__(self, mean=1.0, scale=1.0, size=None, **kwargs):
r"""Draw samples from a Wald distribution. r"""Draw samples from a Wald distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
mean mean
...@@ -1217,6 +1338,11 @@ class TruncExponentialRV(ScipyRandomVariable): ...@@ -1217,6 +1338,11 @@ class TruncExponentialRV(ScipyRandomVariable):
def __call__(self, b, loc=0.0, scale=1.0, size=None, **kwargs): def __call__(self, b, loc=0.0, scale=1.0, size=None, **kwargs):
r"""Draw samples from a truncated exponential distribution. r"""Draw samples from a truncated exponential distribution.
Signature
---------
`(), (), () -> ()`
Parameters Parameters
---------- ----------
b b
...@@ -1272,6 +1398,11 @@ class BernoulliRV(ScipyRandomVariable): ...@@ -1272,6 +1398,11 @@ class BernoulliRV(ScipyRandomVariable):
def __call__(self, p, size=None, **kwargs): def __call__(self, p, size=None, **kwargs):
r"""Draw samples from a Bernoulli distribution. r"""Draw samples from a Bernoulli distribution.
Signature
---------
`() -> ()`
Parameters Parameters
---------- ----------
p p
...@@ -1314,6 +1445,12 @@ class LaplaceRV(RandomVariable): ...@@ -1314,6 +1445,12 @@ class LaplaceRV(RandomVariable):
def __call__(self, loc=0.0, scale=1.0, size=None, **kwargs): def __call__(self, loc=0.0, scale=1.0, size=None, **kwargs):
r"""Draw samples from a Laplace distribution. r"""Draw samples from a Laplace distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
loc loc
...@@ -1354,6 +1491,11 @@ class BinomialRV(RandomVariable): ...@@ -1354,6 +1491,11 @@ class BinomialRV(RandomVariable):
def __call__(self, n, p, size=None, **kwargs): def __call__(self, n, p, size=None, **kwargs):
r"""Draw samples from a binomial distribution. r"""Draw samples from a binomial distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
n n
...@@ -1393,6 +1535,11 @@ class NegBinomialRV(ScipyRandomVariable): ...@@ -1393,6 +1535,11 @@ class NegBinomialRV(ScipyRandomVariable):
def __call__(self, n, p, size=None, **kwargs): def __call__(self, n, p, size=None, **kwargs):
r"""Draw samples from a negative binomial distribution. r"""Draw samples from a negative binomial distribution.
Signature
---------
`(), () -> ()`
Parameters Parameters
---------- ----------
n n
...@@ -1443,6 +1590,11 @@ class BetaBinomialRV(ScipyRandomVariable): ...@@ -1443,6 +1590,11 @@ class BetaBinomialRV(ScipyRandomVariable):
def __call__(self, n, a, b, size=None, **kwargs): def __call__(self, n, a, b, size=None, **kwargs):
r"""Draw samples from a beta-binomial distribution. r"""Draw samples from a beta-binomial distribution.
Signature
---------
`(), (), () -> ()`
Parameters Parameters
---------- ----------
n n
...@@ -1489,6 +1641,11 @@ class GenGammaRV(ScipyRandomVariable): ...@@ -1489,6 +1641,11 @@ class GenGammaRV(ScipyRandomVariable):
def __call__(self, alpha=1.0, p=1.0, lambd=1.0, size=None, **kwargs): def __call__(self, alpha=1.0, p=1.0, lambd=1.0, size=None, **kwargs):
r"""Draw samples from a generalized gamma distribution. r"""Draw samples from a generalized gamma distribution.
Signature
---------
`(), (), () -> ()`
Parameters Parameters
---------- ----------
alpha alpha
...@@ -1546,6 +1703,11 @@ class MultinomialRV(RandomVariable): ...@@ -1546,6 +1703,11 @@ class MultinomialRV(RandomVariable):
def __call__(self, n, p, size=None, **kwargs): def __call__(self, n, p, size=None, **kwargs):
r"""Draw samples from a discrete multinomial distribution. r"""Draw samples from a discrete multinomial distribution.
Signature
---------
`(), (n) -> (n)`
Parameters Parameters
---------- ----------
n n
...@@ -1613,6 +1775,11 @@ class CategoricalRV(RandomVariable): ...@@ -1613,6 +1775,11 @@ class CategoricalRV(RandomVariable):
def __call__(self, p, size=None, **kwargs): def __call__(self, p, size=None, **kwargs):
r"""Draw samples from a discrete categorical distribution. r"""Draw samples from a discrete categorical distribution.
Signature
---------
`(j) -> ()`
Parameters Parameters
---------- ----------
p p
...@@ -1664,6 +1831,11 @@ class RandIntRV(RandomVariable): ...@@ -1664,6 +1831,11 @@ class RandIntRV(RandomVariable):
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. r"""Draw samples from a discrete uniform distribution.
Signature
---------
`() -> ()`
Parameters Parameters
---------- ----------
low low
...@@ -1711,6 +1883,11 @@ class IntegersRV(RandomVariable): ...@@ -1711,6 +1883,11 @@ class IntegersRV(RandomVariable):
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. r"""Draw samples from a discrete uniform distribution.
Signature
---------
`() -> ()`
Parameters Parameters
---------- ----------
low low
...@@ -1771,6 +1948,11 @@ class ChoiceRV(RandomVariable): ...@@ -1771,6 +1948,11 @@ class ChoiceRV(RandomVariable):
def __call__(self, a, size=None, replace=True, p=None, **kwargs): def __call__(self, a, size=None, replace=True, p=None, **kwargs):
r"""Generate a random sample from an array. r"""Generate a random sample from an array.
Signature
---------
`(x) -> ()`
Parameters Parameters
---------- ----------
a a
...@@ -1781,7 +1963,7 @@ class ChoiceRV(RandomVariable): ...@@ -1781,7 +1963,7 @@ class ChoiceRV(RandomVariable):
k` independent samples are returned. Default is `None`, in k` independent samples are returned. Default is `None`, in
which case a single sample is returned. which case a single sample is returned.
replace replace
When ``True``, sampling is performed with replacement. When `True`, sampling is performed with replacement.
p p
The probabilities associated with each entry in `a`. If not The probabilities associated with each entry in `a`. If not
given, all elements have equal probability. given, all elements have equal probability.
...@@ -1831,6 +2013,11 @@ class PermutationRV(RandomVariable): ...@@ -1831,6 +2013,11 @@ class PermutationRV(RandomVariable):
def __call__(self, x, **kwargs): def __call__(self, x, **kwargs):
r"""Randomly permute a sequence or a range of values. r"""Randomly permute a sequence or a range of values.
Signature
---------
`(x) -> (x)`
Parameters Parameters
---------- ----------
x x
......
...@@ -47,7 +47,7 @@ Reference ...@@ -47,7 +47,7 @@ Reference
Distributions 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. The :class:`RandomVariable`\s behave similarly to NumPy's *Generalized Universal Functions* (or `gunfunc`): it supports "core" random variable :class:`Op`\s that map distinctly shaped inputs to potentially non-scalar outputs. We document this behavior in the following with `gufunc`-like signatures.
.. autoclass:: aesara.tensor.random.basic.UniformRV .. autoclass:: aesara.tensor.random.basic.UniformRV
:members: __call__ :members: __call__
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论