glearn.priors.Prior.log_pdf#
- Prior.log_pdf(hyperparam)#
Logarithm of the 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 logarithm of probability density function of the input hyperparameter(s).
Notes
This function returns \(\log p(\theta)\).
Multiple hyperparameters:
When an array of hyperparameters \(\boldsymbol{\theta} = (\theta_, \dots, \theta_n)\) are given, it is assumed that prior for each hyperparameter is independent of others. The output of this function is then the sum of all log-probabilities
\[\sum_{i=1}^n \log p(\theta_i).\]Using Log Scale:
If the attribute
use_log_scale
is True, it is assumed that the input argument \(\theta\) is the log of the hyperparameter, so to convert back to the original hyperparameter, the transformation below is performed\[\theta \gets 10^{\theta}.\]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 log-PDF >>> prior.log_pdf(t) -17.15935597045384