Mixture of probabilities

Hi,

I am trying to formulate a mixture of Bernoulli for my task. I am unsure how pymc3 handles the p value for this.

My code snippet is:

with dir_model:

pi = pm.Dirichlet('pi', a = np.ones(K), shape = K)

dri = pm.Dirichlet('dri', a = np.ones((K, B)), shape = (K, B))

category_U = pm.Categorical('category_u', p = pi, shape = B)

vector_U = pm.Bernoulli('vec_u', p = dri[category_U], observed = Adj.toarray())

So here p value for vector_U will be of array shaped B for each observed value. So how will pymc3 handle this ? I think it will use it as mixture but I am not sure.

Help much appreciated.

Thanks

Correct. Since this is an observed variable, pymc3 will add the sum of logp to the model likelihood. The mixture concept is not particularly important here as pymc3 is not dealing with the parameterization directly (as it only care about the sum logp in this case).

So can I consider it as a mixture of Bernoulli?

Well it is equivalent to a mixture model and it is advice to rewrite it that way, but the way you wrote down above is not.