Hmmm I think there is some weird error in the default value, could you raise an issue on Github?
For now, you can make it work by specifying the shape and give it a test value:
In [17]: values_X = np.array([0,1,1])
...: with pm.Model() as model:
...: X = pm.Categorical("X", p=probs_X, observed=values_X)
...: Y = pm.Categorical("Y", p=probs_Y[X], shape=3,testval=np.asarray([0
...: ,1,2]))
...: print(model.check_test_point())
...:
Y -3.19
X -2.08
OK, done! You are right that the problem disappears is the test value is changed. But I really don’t get why the default value of the Y variable turns out to be 5 in this case. I checked the code, and it seems to come from the tag.test_value attribute of the mode tensor variable from Theano. How is that computed?