Practicing my Python on Multinomial Mixture Models

I just worked to revive a fun library in my good old Bayesian package, BayesPy, related to the multinomial mixture model in https://github.com/maxsklar/bayespy

Multinomial Mixture models are much simpler than LDA but can be run in lightning speed and can give you an idea of how or whether the data is clustered. It can be run on datasets of category-count data. I think of it as K-means on a probability simplex.

Just run:

python MultinomialMixture/writeSampleModel.py -A 0.3,0.3,0.3 -m 2,2 | python MultinomialMixture/writeSampleDataset.py -N 10000 -M 500 | python3 MultinomialMixture/inferMultinomialMixture.py -K 3 -C 2

It generates a random data set and attempts to figure out the multinomial mixture on the fly. Of course, inferMultinomialMixture.py can also be run on ANY applicable dataset.

There is I'm sure really short code on pymc3 that can accomplish this as well, but it's fun to revive the pure python approach every once in a while.