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
sample_posterior_predictive is susceptible to "bad" ordering of var_names.
The problem arises only when using theano.shared vars for observed RVs.
It seems that when sample_posterior_predictive is given var_names in an order in which a Deterministic RV is placed before the RV(s) it is based on, the samples will contain wrong values for that deterministic variable.
Namely - the values for the deterministic rv in the ppc trace will be values based on the "original" theano.shared values.
One possible fix is reordering var_names inside sample_posterior_predictive to be consistent with
free_RVs+observed_RVs+deterministics
As far as I tested this ordering works, but this might be just a workaround hiding a deeper problem. Not sure.
If the reordering solution is the right way to go, better to topologically order the rvs, though I didn't find a way in the API to retrieve their dependencies.
Thanks for reporting @uri-datorama. This highlights a problem in draw_values. In particular, in how the output from pymc3.model.get_named_nodes_and_relations is handled. I'll work on a fix later today.
* Fixed leaf_nodes computation
* Refactored get_named_nodes_and_relations to make it consistent with theano naming
* Added test for #3643
* Added release notes
* Fixed float32 error
* Applied changes suggested by @rpgoldman
* Fixed ignored nodes bug
* Modify docstrings for numpy style.
Noticed @junpenglao's comment and modified for numpy formatting.
* Changed leaves to leaf_dict as per @junpeglao's suggestion
Co-authored-by: rpgoldman <rpgoldman@goldman-tribe.org>
sample_posterior_predictive is susceptible to "bad" ordering of var_names.
The problem arises only when using theano.shared vars for observed RVs.
It seems that when sample_posterior_predictive is given var_names in an order in which a Deterministic RV is placed before the RV(s) it is based on, the samples will contain wrong values for that deterministic variable.
Namely - the values for the deterministic rv in the ppc trace will be values based on the "original" theano.shared values.
One possible fix is reordering var_names inside sample_posterior_predictive to be consistent with
As far as I tested this ordering works, but this might be just a workaround hiding a deeper problem. Not sure.
If the reordering solution is the right way to go, better to topologically order the rvs, though I didn't find a way in the API to retrieve their dependencies.
See reproduction below.
The text was updated successfully, but these errors were encountered: