Categorical from factors

I tried making a version of this (accessible here) by expressing the probability of assignment to a cluster as a logistic regression but I am getting lots of divergences. I think I am misusing the parameters of Mixture but I’m not sure how to fix it.