hyperparameter_posterior_covariance
- pmrf.stats.hyperparameter_posterior_covariance(linearization: Linearization, evaluator: MarginalLogLikelihood, space: Space = 'declared', prior_precision: Literal['moment_matched', 'hessian'] = 'moment_matched') Array
The linearised posterior covariance of an evaluator’s hyperparameters.
Mathematical Formulation
The linearised posterior over \([\theta; \psi]\) is block diagonal, since the \(\theta\)–\(\psi\) block of the Fisher matrix vanishes (see
pmrf.objectives.evaluators.MarginalLogLikelihood.linearize()). Its hyperparameter block is$$Sigma_{psi,text{post}} = (F_psi + Sigma_{psi,0}^{-1})^{-1},$$
with the prior precision \(\Sigma_{\psi,0}^{-1}\) taken from the evaluator’s hyperpriors by the prior_precision rule of
posterior_covariance_factor(). Both terms enter through symmetric square roots with negative eigenvalues clipped to zero, so withprior_precision='hessian'a log-convex hyperprior adds none. Unlike \(F_h\), \(F_\psi\) of different fits does not add, since the hyperparameters belong to one evaluator, so this takes one linearisation.- Parameters:
linearization (Linearization) – The linearisation of evaluator’s fit, in space.
evaluator (MarginalLogLikelihood) – The evaluator linearised, carrying the hyperpriors. Must still be wrapped.
space ({'declared', 'physical', 'raw'}, default='declared') – The space of the parameter values. See
pmrf.Param.prior_precision ({'moment_matched', 'hessian'}, default='moment_matched') – How the hyperpriors’ precision is taken, as for
posterior_covariance_factor().
- Returns:
The covariance with shape
(q, q)over the hyperparameters inpsi_namesorder.- Return type:
jax.Array
- Raises:
ValueError – If the linearisation is in another space, has no hyperparameters, or is over hyperparameters other than evaluator’s, or prior_precision is unknown.
NotImplementedError – With
prior_precision='moment_matched', if space is'raw', a hyperprior is over raw space, a hyperprior has novariance(), or a joint hyperprior is not a multivariate normal.