PriorPenalized
- class pmrf.objectives.problems.PriorPenalized(problem: AbstractProblem)
Bases:
AbstractProblemA problem penalized by the negative log prior of its parameters, in declared space.
Minimizing a penalized problem gives the maximum a posteriori estimate, where the problem alone gives the maximum likelihood estimate. Priors are extracted over the whole problem, so the terms’ own hyper-parameters are covered alongside the model’s parameters. The density is
pmrf.log_prior()withspace='declared', which differs from the physical density by a constant and so has the same mode.Priors are metadata and are stripped by unwrapping, so they are extracted once on construction while the problem is still wrapped.
- Parameters:
problem (pmrf.objectives.problems.AbstractProblem) – The problem to penalize.
- __call__(*args, **kwargs) Array
Evaluate the problem.
- whitened_residual(*args, **kwargs) Array
Returns the problem’s whitened residual with the prior residuals of the model’s parameters appended.
Half its squared norm is the negative log posterior, up to terms constant in the model parameters (ADR-0009). The prior residual is computed from each distribution, in the space it is over, rather than read from raw space:
a
NormalorTruncatedNormal, including a normal truncated to a validity, gives \((\theta - \mu)/\sigma\); its truncation is the box edges instead, and its normaliser is constant;a joint multivariate normal over declared or physical space, including one attached with
truncate='unnormalised', gives \(L_0^{-1}(\theta - \mu)\) over its vector, with \(\Sigma_0 = L_0 L_0^\top\); its truncation is each parameter’s validity, already the box edges;a
Uniform, or no prior, gives none.
Only the parameters of
modelcontribute. The priors of the terms’ hyperparameters are constant here; a hyperparameter step takes them.- Raises:
NotImplementedError – If a parameter of the model has any other prior, including a joint prior over raw space, or a term has no whitened residual.
- distributions: Any
The prior distributions of the problem’s parameters, over physical values.
- property inner: AbstractProblem
The problem itself, or the one it wraps, looking through any nesting.
- log_scale: Any
the sum of n log|scale| over scaled parameters with a prior.
- Type:
The constant taking the physical log density to the declared one
- property model: PyTree
- problem: AbstractProblem
The problem being penalized.