5.4 Calculating predictive accuracy with ArviZ
Fortunately, calculating WAIC and LOO with ArviZ is very simple. We just need to be sure that the Inference Data has the log-likelihood group. When computing a posterior with PyMC, this can be achieved by doing pm.sample(idata_kwargs="log_likelihood": True)
. Now, let’s see how to compute LOO:
Code 5.3
az.loo(idata_l)
Computed from 8000 posterior samples and 33 observations log-likelihood matrix.
Estimate SE elpd_loo -14.31 2.67
p_loo 2.40 -
------
Pareto k diagnostic values:
Count...