arviz.loo(data, pointwise=False, reff=None, scale='deviance')[source]

Pareto-smoothed importance sampling leave-one-out cross-validation.

Calculates leave-one-out (LOO) cross-validation for out of sample predictive model fit, following Vehtari et al. (2017). Cross-validation is computed using Pareto-smoothed importance sampling (PSIS).

data : result of MCMC run
pointwise: bool, optional

if True the pointwise predictive accuracy will be returned. Defaults to False

reff : float, optional

Relative MCMC efficiency, effective_n / n i.e. number of effective samples divided by the number of actual samples. Computed from trace by default.

scale : str

Output scale for loo. Available options are:

  • deviance : (default) -2 * (log-score)
  • log : 1 * log-score (after Vehtari et al. (2017))
  • negative_log : -1 * (log-score)
pandas.Series with the following columns:
loo: approximated Leave-one-out cross-validation
loo_se: standard error of loo
p_loo: effective number of parameters
shape_warn: 1 if the estimated shape parameter of

Pareto distribution is greater than 0.7 for one or more samples

loo_i: array of pointwise predictive accuracy, only if pointwise True
pareto_k: array of Pareto shape values, only if pointwise True
loo_scale: scale of the loo results