Posterior
posterior
¶
Components for setting up a Log-posterior model from sub-components.
This module provides different components that can be combined into a log-posterior model. Each of them mimics the UM-Bridge interface.
Classes:
Name | Description |
---|---|
GaussianLLFromPTOMap |
Gaussian log-likelihood from parameter-to-observable map |
LogPosterior |
Wrapper for combining log-prior and log-likelihood into a log-posterior |
mtmlda.components.posterior.GaussianLLFromPTOMap
¶
Gaussian Log-Likelihood.
This components creates a Gaussian log-likelihood from an UM-Bridge model that constitute a parameter-to-observable (PTO) map.
Methods:
Name | Description |
---|---|
__call__ |
UM-Bridge-like call interface for the log-likelihood. |
__init__
¶
Constructor.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
umbridge_pto_map
|
ub.Model
|
UM-Bridge-server resembling the parameter-to-observable map. |
required |
data
|
np.ndarray
|
Observable data to compute the misfit with, compared to the PTO output |
required |
covariance
|
np.ndarray
|
Covariance for waiting of the misfit vector in Gaussian likelihood |
required |
Raises:
Type | Description |
---|---|
ValueError
|
Checks if the sizes of the data vector and the output of the PTO map match |
ValueError
|
Checks if the covariance matrix has the same shape as the data vector |
__call__
¶
UMbridge-like call interface for log-likelihood.
Note that input- and output-formats of this method resemble exactly those in UM-Bridge.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameter
|
list[list[float]]
|
Parameter candidate |
required |
config
|
dict[str, Any]
|
Configuration dictionary to be passed on to UM-Bridge server |
required |
Returns:
Type | Description |
---|---|
list[list[float]]
|
list[list[float]]: Log-likelihood value |
mtmlda.components.posterior.LogPosterior
¶
__init__
¶
Wrapper for computing the log posterior from a log-likelihood and a log-prior component.
log-likelihood and log-prior can be anything, but need to be callable according to the UM-Bridge call interface.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
log_prior
|
Any
|
Log-prior component |
required |
log_likelihood
|
Any
|
Log-likelihood component |
required |
__call__
¶
UMbridge-like call interface for log-posterior.
Simply returns the sum of log-likelihood and log-prior values. Note that input- and output-formats of this method resemble exactly those in UM-Bridge. If the log-prior evaluates to -inf, meaning it doesn't have support for the current parameter candidate, likelihood evaluation is not conducted, and -inf returned immediately for the log-posterior.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
parameter
|
list[list[float]]
|
Parameter candidate |
required |
Returns:
Type | Description |
---|---|
list[list[float]]
|
list[list[float]]: Log-posterior value |