`log_likelihood` missing in `Approximation.sample`

When running this code:

with model:
    fit = pm.fit(method="advi")
trace = fit.trace()

The resulting trace inference data object is missing the log_likelihood group.

The option to create this group is explicitly set to False in this line:

At first glance, setting this option to True seems to work and arviz is able to compute az.loo(trace) with a result that looks reasonable to me.

So what am I missing here? What’s the reason behind excluding log_likelihood from these samples?

CC @ferrine @fonnesbeck

No idea, but there was some recent discussion of this here.

1 Like