glearn.priors.StudentT.suggest_hyperparam#

StudentT.suggest_hyperparam(positive=False)#

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.

Note

This parameter is not used, rather, ignored in this function. This parameter is included for consistency this function with the other prior classes.

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.

Notes

For the Student’s t-distribution with the degrees of freedom \(\nu\), the suggested hyperparameter is the standard deviation of the distribution at \(\nu > 2\) is

\[\sigma = \sqrt{\frac{\nu}{\nu - 2}}.\]

If half is True, the stand deviation is

\[\sigma = \sqrt{\frac{2\nu}{\nu - 2}}.\]

Warning

If \(\nu \leq 2\), the Student’s t-distribution does not have mean and standard deviation. Hence, this function just returns the number 1 to be used as as initial guess.

The suggested hyperparameters can be used as initial guess for the optimization of the posterior functions when used with this prior.

Examples

Create the Student’ t-distribution with the degrees of freedom \(\nu=4\).

>>> from glearn import priors
>>> prior = priors.StudentT(4)

>>> # Find a feasible hyperparameter value
>>> prior.suggest_hyperparam()
array([1.41421356])

The above value is the standard deviation of the distribution.