Search code examples
pymc

TruncatedNormal bug or my error?


This simple example:

import numpy as np
import pymc as pm
init = 0.5; minv = 0.; maxv = 1.
A = pm.Uniform('A', value=init, lower=minv, upper=maxv)
B = pm.TruncatedNormal('B', value=init, mu=A, tau=1., a=minv, b=maxv)
C = pm.Normal('C', value=np.random.normal(init,1,10), mu=B, tau=1., observed=True)
model = pm.MCMC(pm.Model([A, B, C]))
model.sample(1000)

nearly always throws the following error (pymc2.3.3):

pymc.Node.ZeroProbability: Stochastic B's value is outside its support,
 or it forbids its parents' current values.

I believe this example is minimal since if I remove A or C it seems to work (at least, it works a lot more frequently).

Am I missing something? If not, I will post to github issue tracker.


Solution

  • It works 5 times in a row for me, but I'm still on PyMC version 2.3.2. I think you should post to the issue tracker.