glearn.priors.Cauchy.pdf#

Cauchy.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 \theta_0, \gamma) = \frac{1}{\pi \gamma} \frac{1}{z}.\]

where

\[z = 1 + \left( \frac{\theta - \theta_0}{\gamma}\right)^2.\]

If half is True, the above function is doubled.

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

Examples

Create the Cauchy distribution with median \(\theta_0 = 1\) and scale \(\gamma=2\).

>>> from glearn import priors
>>> prior = priors.Cauchy(1, 2)

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