glearn.priors.BetaPrime.suggest_hyperparam#
- BetaPrime.suggest_hyperparam(positive=True)#
Find an initial guess for the hyperparameters based on the peaks of the prior distribution.
- Parameters:
- positivebool, default=False
If True, it suggests a positive hyperparameter. This is used for instance if the suggested hyperparameter is used for the scale parameter which should always be positive.
- Returns:
- hyperparamfloat or numpy.array[float]
A feasible guess for the hyperparameter. The output is either a scalar or an array of the same size as the input parameters of the distribution.
See also
Notes
For the beta prime distribution with shape parameter \(\alpha\) and rate parameter \(\beta\), the suggested hyperparameter is determined as follows:
If \(\beta > 1\), the suggested hyperparameter is the mean of the distribution
\[\mu = \frac{\alpha}{\beta - 1}.\]If \(\alpha > 1\), the suggested hyperparameter is the mod of the distribution
\[\mu' = \frac{\alpha-1}{\beta + 1}.\]Other than the above conditions, the number 1 is returned.
The suggested hyperparameters can be used as initial guess for the optimization of the posterior functions when used with this prior.
Examples
Create the beta prime distribution with the shape parameter \(\alpha=2\) and rate parameter \(\beta=4\).
>>> from glearn import priors >>> prior = priors.BetaPrime(2, 4) >>> # Find a feasible hyperparameter value >>> prior.suggest_hyperparam() array([0.6666666666666666])
The above value is the mean of the distribution.