glearn.priors.InverseGamma.pdf_hessian#
- InverseGamma.pdf_hessian(x)#
Hessian of the probability density function of the prior distribution.
- Parameters:
- xfloat or array_like[float]
Input hyperparameter or an array of hyperparameters.
- Returns:
- hessfloat or array_like[float]
The Hessian of the probability density function of the input hyperparameter(s).
See also
Notes
The second derivative of the probability density function is
\[\frac{\mathrm{d}^2}{\mathrm{d}\theta^2} p(\theta \vert \alpha, \beta) = \frac{\theta^{\alpha-1} e^{-\beta \theta} \beta^{\alpha}}{\Gamma(\alpha)} \frac{\left(a^2 + a - 2ab - 2b + b^2 \right)}{\theta^2},\]where \(\Gamma\) is the Gamma function, \(a = \alpha+1\), and \(b = \frac{\beta}{\theta}\).
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 the Hessian of the PDF >>> t = [0, 0.5, 1] >>> prior.pdf_hessian(t) array([[ nan, 0. , 0. ], [ 0. , -12.50347615, 0. ], [ 0. , 0. , 3.60894089]])