BayesianModelSelectionResult#

class gammapy.modeling.BayesianModelSelectionResult[source]#

Bases: object

Container for results of multiple Bayesian model sampling.

Provides utilities to compare models and compute differences in statistical metrics.

Parameters:
results_dictdict

Dictionary of InferenceResult objects with key matching model name.

Attributes Summary

elpds

Expected log predictive density using PSIS-LOO-CV.

models_names

Methods Summary

compare(**kwargs)

Compare models using ArviZ's model comparison utilities.

prior_sensitivity_table()

Display prior and likelihood sensitivity table computed from power scaling for each model.

stats_difference_table(reference_models_name)

Compute difference in statistics relative to a reference model.

stats_table([format])

Statistics summary table for all models.

Attributes Documentation

elpds#

Expected log predictive density using PSIS-LOO-CV.

models_names#

Methods Documentation

compare(**kwargs)[source]#

Compare models using ArviZ’s model comparison utilities.

This method extracts the LOO-CV expected log predictive densities (ELPDs) from each model result and passes them to arviz.compare for statistical comparison. By default, the method is set to ‘BB-pseudo-BMA’ which performs a Bayesian bootstrap to compute standard errors, and weights.

Parameters:
**kwargsdict

Additional keyword arguments passed to arviz.compare.

Returns:
comparisonDataFrame

A data frame with model comparison metrics such as ELPD differences, standard errors, and weights.

prior_sensitivity_table()[source]#

Display prior and likelihood sensitivity table computed from power scaling for each model.

stats_difference_table(reference_models_name)[source]#

Compute difference in statistics relative to a reference model.

This table contains a set of information criteria and diagnostics used to evaluate and compare statistical models. The columns are defined as follows:

  • Model (prior) : the model identifier, including its prior specification.

  • -2logz : negative twice the log Bayesian evidence.

  • -2logl : negative twice the maximum log-likelihood.

  • AIC : Akaike Information Criterion.

  • elpd : expected log predictive density estimated via LOO-CV.

  • dof : estimated number of effective degrees of freedom.

  • eff. dof : effective number of parameters computed from LOO.

Parameters:
reference_models_namestr

Name of the model to use as reference (H0).

Returns:
tableTable

Table with differences in statistics (H0 - H1).

stats_table(format='.3f')[source]#

Statistics summary table for all models.

This table contains a set of information criteria and diagnostics used to evaluate and compare statistical models. The columns are defined as follows:

  • Model (prior) : the model identifier, including its prior specification.

  • -2logz : negative twice the log Bayesian evidence.

  • -2logl : negative twice the maximum log-likelihood.

  • AIC : Akaike Information Criterion.

  • elpd : expected log predictive density estimated via LOO-CV.

  • dof : estimated number of effective degrees of freedom.

  • eff. dof : effective number of parameters computed from LOO.

  • logz error : uncertainty on the log Bayesian evidence.

  • elpd error : standard error of the LOO-based ELPD estimate.

  • good Pareto k fraction : fraction of pixels with Pareto k ≤ 0.7, indicating reliable LOO estimates.

Parameters:
formatstr, optional

Format string for numerical columns Default is “.3f”

Returns:
tableTable

Table with statistics for each model.

__init__(results_dict)[source]#
classmethod __new__(*args, **kwargs)#