You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Describe the bug
The arviz.from_numpyro method has an argument log_likelihood which seems to enable the user to provide a dictionary(?) of likelihoods for posterior samples. However, it seems to be entirely ignored in favour of likelihoods being computed from the provided model instead. (However, I may be using it wrongly as there appears to be no documentation of it; if so, please point that out to me).
Expected behavior idata.log_likelihood should have a single data variable xs_ys with the contents of samples['ll'], i.e., arviz.from_numpyro should use the values provided via the log_likelihood instead of re-computing the log-likelihoods from the model.
The log_likelihood parameter can only be a boolean (True or False, or None if you want the value in rcParams to be used). If you want custom values in the log likelihood group that differ from what is defined by the model you should either modify those after calling from_numpyro or use loglikelihood=False and then InferenceData.add_groups to create the group later on (as done for example in https://python.arviz.org/en/stable/user_guide/numpyro_refitting_xr_lik.html). Hope it helps.
The docstring needs updating though to include the log_likelihood parameter, its type info and description. Do you want to create a PR for this?
Alright, thanks for pointing that out. I will work around it like you suggested with the add_groups after creating the InferenceData object for now. I'm not sure I have the time currently to work on PRs, but I can see if I get around to it some time soon.
Describe the bug
The
arviz.from_numpyro
method has an argumentlog_likelihood
which seems to enable the user to provide a dictionary(?) of likelihoods for posterior samples. However, it seems to be entirely ignored in favour of likelihoods being computed from the provided model instead. (However, I may be using it wrongly as there appears to be no documentation of it; if so, please point that out to me).To Reproduce
Consider the following code snippet:
This prints
Expected behavior
idata.log_likelihood
should have a single data variablexs_ys
with the contents ofsamples['ll']
, i.e.,arviz.from_numpyro
should use the values provided via thelog_likelihood
instead of re-computing the log-likelihoods from the model.Additional context
The text was updated successfully, but these errors were encountered: