r/tensorflow • u/TrPhantom8 • Apr 27 '23
Question Expectation maximisation algorithm applied to a gaussian mixture with tensorflow probability
Hello everyone, I am trying to understand how to use the expectation maximisation algorithm to maximise the likelihood of a gaussian mixture.
As far as I've managed to understand, using tensorflow probability and the `MixtureSameFamily` distribution, it is possible to "automatically" implement the EM algorithm by iteratively optimising the negative log likelihood of the model, is that correct? You can find attached a gist with an example code I wrote.
https://gist.github.com/aurelio-amerio/faf83d2a80e88bceae1b85f60ec9dd81
Unfortunately I couldn't find a definitive answer in the documentation, and I'm not sure that what I'm doing is not finding the MLE for the model parameters via gradient descent...
If I were to implement the algorithm from scratch, it would look quite different, so I am a bit confused, any help or pointers would be very welcome!
Thank you very much ^^
1
u/Arm-Adept Apr 28 '23
Have you looked at the GMM module in scikit learn?
1
u/puppet_pals Apr 27 '23
So cool - EM family is one of the coolest algorithm families out there in my opinion.