Hi, I am playing with a Dirichlet Mixture model. I am trying to cluster the Iris dataset.
In one model I generate weights \pi from a Dirichlet Process and use this to find the number of clusters.
k = 30
m = pm.Model()
with m:
alpha = pm.HalfNormal('alpha', 1, shape=1)
beta = pm.Beta('beta', 1, alpha, shape=30)
pi = pm.Deterministic('pi', dirichlet_process(beta))
sd = pm.HalfNormal('sd', sd=1, shape=k)
mu = pm.Normal('mu', mu=0, sd=sd, shape=k)
obs = pm.NormalMixture('obs', w=pi, mu=mu, sd=sd, observed=df.values[3])
This works well.
I try to recreate the same good results with the pm.Dirichlet distribution (which is also a stick-breaking method).
However if I try this. The result is nothing like the first model.
k = 30
m = pm.Model()
with m:
alpha = pm.HalfNormal('alpha', 1, shape=1)
pi = pm.Dirichlet('pi', tt.ones(30) * alpha, shape=30)
sd = pm.HalfNormal('sd', sd=1, shape=k)
mu = pm.Normal('mu', mu=0, sd=sd, shape=k)
obs = pm.NormalMixture('obs', w=pi, mu=mu, sd=sd, observed=df.values[3])
Am I using the pm.Dirichlet distribution wrong?
N.B. I am trying to do something similar as done in this tutorial.
https://docs.pymc.io/notebooks/dp_mix.html