Hi,
I have a weird error coming up while using DiscreteUniform distribution. My belief was that declaring a random variable with DiscreteUniform(lower=0, upper=n-1) distribution or with Categorical(p=[1/n, …, 1/n]) distribution will produce exactly the same result.
However, while model1 (specified below) has the expected behaviour, model2 (also specified below) produces errors at sampling (an index out of bound which seems to come from the declaration of mu).
model1 = pm.Model()
with model1:
X = pm.Categorical('X', p=[1/2, 1/2])
t = T.as_tensor_variable([1, 2])
mu = t[X]
Y = pm.Normal('Y', mu=mu, sd=0.01, observed=2)
model2 = pm.Model()
with model2:
X = pm.DiscreteUniform('X', lower=0, upper=1)
t = T.as_tensor_variable([1, 2])
mu = t[X]
Y = pm.Normal('Y', mu=mu, sd=0.01, observed=2)
Have I missed something in the definition of Categorical and DiscreteUniform distributions or should I open an issue on Github ? Thanks in advance !
I use PyMC3 (v3.2) and Theano (v1.0.1) with Python 3.6.4 on Mac OS X.