threeML.bayesian.sampler_base module

class threeML.bayesian.sampler_base.MCMCSampler(likelihood_model, data_list, **kwargs)[source]

Bases: SamplerBase

class threeML.bayesian.sampler_base.SamplerBase(likelihood_model: Model, data_list: DataList, **kwargs)[source]

Bases: object

get_posterior(trial_values) float[source]

Compute the posterior for the normal sampler

property log_like_values: ndarray | None

Returns the value of the log_likelihood found by the bayesian sampler while samplin g from the posterior. If you need to find the values of the parameters which generated a given value of the log. likelihood, remember that the samples accessible through the property .raw_samples are ordered in the same way as the vector returned by this method.

Returns:

a vector of log. like values

property log_marginal_likelihood: float | None

Return the log marginal likelihood (evidence) if computed :return:

property log_probability_values: ndarray | None

Returns the value of the log_probability (posterior) found by the bayesian sampler while sampling from the posterior. If you need to find the values of the parameters which generated a given value of the log. likelihood, remember that the samples accessible through the property .raw_samples are ordered in the same way as the vector returned by this method.

Returns:

a vector of log probabilty values

property raw_samples: ndarray | None

Access the samples from the posterior distribution generated by the selected sampler in raw form (i.e., in the format returned by the sampler)

Returns:

the samples as returned by the sampler

restore_MAP_fit() None[source]

Sets the model parameters to the MAP of the probability

restore_median_fit() None[source]

Sets the model parameters to the median of the log probability

property results: BayesianResults
abstract sample()[source]
property samples: Dict[str, ndarray] | None

Access the samples from the posterior distribution generated by the selected sampler

Returns:

a dictionary with the samples from the posterior distribution for each parameter

abstract setup() None[source]
class threeML.bayesian.sampler_base.UnitCubeSampler(likelihood_model, data_list, **kwargs)[source]

Bases: SamplerBase

threeML.bayesian.sampler_base.arg_median(a)[source]