random
– Low-level random numbers#
Low-level random numbers#
The pytensor.tensor.random
module provides random-number drawing functionality
that closely resembles the numpy.random
module.
- 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.