threeML.bayesian.bayesian_analysis module¶
-
class
threeML.bayesian.bayesian_analysis.
BayesianAnalysis
(likelihood_model: astromodels.core.model.Model, data_list: threeML.data_list.DataList, **kwargs)[source]¶ Bases:
object
-
property
analysis_type
¶
-
convergence_plots
(n_samples_in_each_subset, n_subsets)[source]¶ Compute the mean and variance for subsets of the samples, and plot them. They should all be around the same values if the MCMC has converged to the posterior distribution.
The subsamples are taken with two different strategies: the first is to slide a fixed-size window, the second is to take random samples from the chain (bootstrap)
- Parameters
n_samples_in_each_subset – number of samples in each subset
n_subsets – number of subsets to take for each strategy
- Returns
a matplotlib.figure instance
-
property
data_list
¶ data list for this analysis
- Type
return
-
property
likelihood_model
¶ likelihood model (a Model instance)
- Type
return
-
property
log_like_values
¶ Returns the value of the log_likelihood 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. like values
-
property
log_marginal_likelihood
¶ Return the log marginal likelihood (evidence ) if computed
- return
-
property
log_probability_values
¶ 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
-
plot_chains
(thin=None)[source]¶ Produce a plot of the series of samples for each parameter
- Parameters
thin – use only one sample every ‘thin’ samples
- Returns
a matplotlib.figure instance
-
property
raw_samples
¶ 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
-
property
results
¶
-
property
sampler
¶ Access the instance of the sampler used to sample the posterior distribution :return: an instance of the sampler
-
property
samples
¶ 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
-
property