glearn.priors.InverseGamma.pdf#

InverseGamma.pdf(x)#

Probability density function of the prior distribution.

Parameters:
xfloat or array_like[float]

Input hyperparameter or an array of hyperparameters.

Returns:
pdffloat or array_like[float]

The probability density function of the input hyperparameter(s).

Notes

The probability density function is

\[p(\theta \vert \alpha, \beta) = \frac{\beta^{\alpha}}{\Gamma{\alpha}} \theta^{-(\alpha+1)} e^{-\frac{\beta}{\theta}},\]

where \(\Gamma\) is the Gamma function.

When an array of hyperparameters are given, it is assumed that prior for each hyperparameter is independent of others.

Examples

Create the inverse Gamma distribution with the shape parameter \(\alpha=4\) and rate parameter \(\beta=2\).

>>> from glearn import priors
>>> prior = priors.InverseGamma(4, 2)

>>> # Evaluate PDF function at multiple locations
>>> t = [0, 0.5, 1]
>>> prior.pdf(t)
array([       nan, 1.56293452, 0.36089409])