arviz.bfmi#

arviz.bfmi(data)[source]#

Calculate the estimated Bayesian fraction of missing information (BFMI).

BFMI quantifies how well momentum resampling matches the marginal energy distribution. For more information on BFMI, see https://arxiv.org/pdf/1604.00695v1.pdf. The current advice is that values smaller than 0.3 indicate poor sampling. However, this threshold is provisional and may change. See pystan_workflow for more information.

Parameters
dataobj

Any object that can be converted to an arviz.InferenceData object. Refer to documentation of arviz.convert_to_dataset() for details. If InferenceData, energy variable needs to be found.

Returns
zarray

The Bayesian fraction of missing information of the model and trace. One element per chain in the trace.

See also

plot_energy

Plot energy transition distribution and marginal energy distribution in HMC algorithms.

Examples

Compute the BFMI of an InferenceData object

In [1]: import arviz as az
   ...: data = az.load_arviz_data('radon')
   ...: az.bfmi(data)
   ...: 
Out[1]: array([0.729448  , 0.67720456, 0.65528958, 0.71930902])