"log_likelihood" not found in InferenceData

which versions of pymc and arviz are you using?

Yes, when converting to InferenceData the log likelihood data is automatically computed and included in the resulting InferenceData if possible. I think there should be a warning printed if that fails, but I might be wrong. You can see that this works in most of the example notebooks, for example: https://pymc-examples.readthedocs.io/en/latest/diagnostics_and_criticism/model_comparison.html

That being the default also means that using idata_kwargs={"log_likelihood": True} is equivalent to not using any arguments.

If either of these options has worked, then it seems like the auto conversion should work too, provided you have relatively new versions of both pymc and arviz. If so, could you share a minimal example in which it fails?

Here you are wrong, which is not strange given the actual change and large updates happening to the codebase as version 4.x approaches.

The to_inference_data you mention is a method of the converter class, not a function. The function that is actually called from the sample method in the 2nd link you provided is a few lines below that. And it does have keyword arguments. However, those are only used for >=4 versions, which you’ll only have if you have installed from github as it has not been released yet. You can also see how in the methods above there is code similar to the answers you shared above that automatically store pointwise log likelihood values.

If you are using pymc3 installed from pip or from conda, the conversion is then being done with an ArviZ function instead of with this one, which is why you originally found that info in the ArviZ docs. Both are similar and both store log likelihood by default, but there are some important differences.

1 Like