Distributions#
- pytensor.tensor.random.basic.chisquare(df, size=None, **kwargs)[source]#
Draw samples from a chisquare distribution.
The probability density function for
chisquare
in terms of the number of degrees of freedom \(k\) is:\[f(x; k) = \frac{(1/2)^{k/2}}{\Gamma(k/2)} x^{k/2-1} e^{-x/2}\]for \(k > 2\). \(\Gamma\) is the gamma function:
\[\Gamma(x) = \int_0^{\infty} t^{x-1} e^{-t} \mathrm{d}t\]This variable is obtained by summing the squares \(k\) independent, standard normally distributed random variables.
Signature#
() -> ()
- param df:
The number \(k\) of degrees of freedom. Must be positive.
- param size:
Sample shape. If the given size is, e.g.
(m, n, k)
thenm * n * k
independent, identically distributed random variables are returned. Default isNone
in which case a single random variable is returned.
- pytensor.tensor.random.basic.choice(a, size=None, replace=True, p=None, rng=None)[source]#
Generate a random sample from an array.
- Parameters:
a – The array from which to randomly sample an element. If an int, a sample is generated from
pytensor.tensor.arange(a)
.p – The probabilities associated with each entry in
a
. If not given, all elements have equal probability.replace – When
True
, sampling is performed with replacement.size – Sample shape. If the given size is
(m, n, k)
, thenm * n * k
independent samples are returned. Default isNone
, in which case a single sample is returned.
- pytensor.tensor.random.basic.permutation(x, **kwargs)[source]#
Randomly permute a sequence or a range of values.
Signature#
() -> (x)
if x is a scalar,(*x) -> (*x)
otherwise- param x:
If
x
is an integer, randomly permutenp.arange(x)
. Ifx
is a sequence, shuffle its elements randomly.
- pytensor.tensor.random.basic.standard_normal(*, size=None, rng=None, dtype=None)[source]#
Draw samples from a standard normal distribution.
Signature#
nil -> ()
- param size:
Sample shape. If the given size is, e.g.
(m, n, k)
thenm * n * k
independent, identically distributed random variables are returned. Default isNone
in which case a single random variable is returned.