Hi. When a categorical variable is sampler is assigned automatically as CategoricalGibbsMetropolis it seems to behave differently to when specified as a keyword argument.
E.g.
n = 10
X = np.random.rand(n)
K = 1+np.arange(n)*0.1
Y = K[3]*X + np.random.randn(n)*0.01
with pm.Model() as model:
ind = pm.Categorical('ind', p=np.ones(n)/n)
k = t.shared(K)
mu = k[ind]*X
y = pm.Normal('y', mu=mu, sd=0.01, observed=Y,shape=n)
trace = pm.sample(10000)
outind = trace.get_values(ind)
will return the correctly sampled posterior in the trace.
Whereas specifying the same sampler explicitly with:
step = pm.CategoricalGibbsMetropolis([ind])
trace = pm.sample(10000, step=[step])
the trace instead returns the prior distribution.
Why is the prior distribution being returned here? Or am I misunderstanding the step keyword?