glearn.priors.Erlang.pdf#

Erlang.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{\theta^{\alpha-1} e^{-\beta \theta} \beta^{\alpha}}{(\alpha -1)!}.\]

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

Examples

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

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

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