Euler Maruyama issue

For the simple SIR logprob, PyMC inference fails for two quaint reasons:

  1. We don’t support transformations of discrete variables yet. So stuff like Binomial + const won’t work, although Normal + const works. We are working on expanding this functionality
  2. We don’t support logp that are conditioned on the transformation of other inferred RVs. We can boil this limitation to the following example:
import pymc as pm

prev_I = 0.5
prev_R = 0.5

new_I = pm.Normal.dist()
new_R = pm.Normal.dist()

I = prev_I + new_I - new_R
R = prev_R + new_R

I.name = "I"
R.name = "R"
        
pm.logprob.conditional_logp({I: I.clone(), R: R.clone()})
# RuntimeError: The logprob terms of the following value variables could not be derived: {I}

There is nothing challenging about the logp of I, but we don’t have the mechanism to tell it that instead of new_R it can count on R - prev_R. All it sees is an expression that depends on two “RVs” which is not supported.

If the EulerMuryama doesn’t support multivariate processes, I think you have to fallback to implementing your own logp by hand. You can still use CustomDist and pass a logp=logp_fn kwarg.

2 Likes