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
When sampling with do operator, Deterministics are injected from the trace and do operation gives no effect
Reproduceable code example:
withpm.Model() asmodel:
a=pm.Normal("a")
b=pm.Deterministic("b", a+10)
c=pm.Deterministic("c", b*3)
d=pm.Normal("d", c, observed=0)
withmodel:
trace=pm.sample()
withpm.do(model, {"a": -100}):
trace1=pm.sample_posterior_predictive(trace, var_names=["c"])
# should raise an error since a is -100np.testing.assert_allclose(trace1.posterior_predictive["c"], trace.posterior["c"])
withpm.do(model, {"a": -100}):
trace1=pm.sample_posterior_predictive(trace, var_names=["c", "b"])
# raises an error since a is -100np.testing.assert_allclose(trace1.posterior_predictive["c"], trace.posterior["c"])
Error message:
...
PyMC version information:
5.9.1
Context for the issue:
No response
The text was updated successfully, but these errors were encountered:
That's really how posterior predictive works at the moment, it has nothing to do with the do operation.
If there's a variable with the same name in the trace that isn't being resampled it will be used in posterior predictive. In your case you need to include "b" in var_names
ricardoV94
changed the title
BUG: do operator and Deterministics work not as expected
Posterior predictive doesn't resample intermediate Deterministics of intervened variables
Oct 31, 2023
Describe the issue:
When sampling with do operator, Deterministics are injected from the trace and do operation gives no effect
Reproduceable code example:
Error message:
PyMC version information:
5.9.1
Context for the issue:
No response
The text was updated successfully, but these errors were encountered: