Evaluating the posterior

midas.posterior.log_probability(theta)

Calculate the posterior log-probability for a given set of model parameters.

Parameters:

theta (ndarray) – The model parameter values as a 1D array.

Returns:

The posterior log-probability.

Return type:

float

midas.posterior.gradient(theta)

Calculate the gradient of posterior log-probability with respect to the model parameters.

Parameters:

theta (ndarray) – The model parameter values as a 1D array.

Returns:

The gradient of the posterior log-probability as a 1D array.

Return type:

ndarray

midas.posterior.cost(theta)

Calculate the ‘cost’ (the negative posterior log-probability) for a given set of model parameters.

Parameters:

theta (ndarray) – The model parameter values as a 1D array.

Returns:

The negative posterior log-probability.

Return type:

float

midas.posterior.cost_gradient(theta)

Calculate the gradient of the ‘cost’ (the negative posterior log-probability) with respect to the model parameters.

Parameters:

theta (ndarray) – The model parameter values as a 1D array.

Returns:

The gradient of the negative posterior log-probability as a 1D array.

Return type:

ndarray

midas.posterior.component_log_probabilities(theta)

Calculate the log-probability of each component of the posterior (i.e. each individual diagnostic likelihood and prior distribution).

Parameters:

theta (ndarray) – The model parameter values as a 1D array.

Returns:

A dictionary mapping the name of each posterior component to its corresponding log-probability.

Return type:

dict[str, float]

midas.posterior.get_model_predictions(theta)

Calculate the predictions of the forward-model associated with each DiagnosticLikelihood component in the posterior distribution.

Parameters:

theta (ndarray) – The model parameter values as a 1D array.

Returns:

A dictionary mapping the name of each DiagnosticLikelihood to its corresponding forward-model predictions as a 1D array.

Return type:

dict[str, ndarray]

midas.posterior.sample_model_predictions(parameter_samples)

Calculate the predictions of the forward-model associated with each DiagnosticLikelihood component in the posterior distribution.

Parameters:

parameter_samples (ndarray) – The model parameter samples as a 2D array with shape (n_samples, n_parameters).

Returns:

A dictionary mapping the name of each DiagnosticLikelihood to its corresponding forward-model predictions for each sample as a 2D array.

Return type:

dict[str, ndarray]