BayesianModelSelection#
- class gammapy.modeling.BayesianModelSelection[source]#
Bases:
objectBayesian inference for a set of alternative models.
This class automates the workflow of evaluating several alternative statistical models on the same datasets, extracting posterior and prior information, and computing predictive accuracy metrics such as WAIC and PSIS‑LOO. The results for each model are stored in
InferenceResultobjects and collected into aBayesianModelSelectionResult.The run method loops over a dictionary of candidate models, runs the sampler for each one, and computes summaries of parameter estimates and model‑comparison statistics. These summaries include log‑evidence, AIC, WAIC, LOO, effective degrees of freedom, and Pareto‑k diagnostics. Progress, parameter tables, and statistical summaries are emitted using the Python logging system at the
INFOlevel.- Parameters:
- sampler
Sampler Sampler instance specifying the backend and options.
- posterior_downsample_factorint, optional
Factor to downsample posterior samples for efficiency. Default is 4.
- n_prior_samplesint, optional
Number of prior samples to display on the results. If None, no prior samples are added. Default is 1000.
- sampler
Methods Summary
run(datasets, alternative_models)Run Bayesian inference for a set of alternative models.
Methods Documentation
- run(datasets, alternative_models)[source]#
Run Bayesian inference for a set of alternative models.
- Parameters:
- datasets
Datasets The datasets on which to perform the model fitting.
- alternative_modelsdict
Dictionary of model names and corresponding
Modelsobjects.
- datasets
- Returns:
- result
BayesianModelSelectionResult Object containing the results of the model comparisons.
- result
- classmethod __new__(*args, **kwargs)#