I am using a dataset to make 2 clusters using EM and then K-means. I already have implemented K-means and EM Algorithm separately. Now I am trying to derive k-means from my implementation of EM Algorithm to do clustering. I have 2 questions in mind.
K-means is viewed as a special case of the generalized EM algorithm. But what assumptions do we need to make to derive k-means from EM algorithm?
Also, in coding perspective, what changes do we need to make in implementation of EM algorithm so that it starts behaving exactly like k-means algorithm? I assume that we need to share same co-variance matrix between both clusters. Is that right to assume?
This is what I am getting using k-means.
This is clustering using EM.
K-means and EM clustering are very related, but not exactly the same. Two changes to EM would make it very, very similar to K-means:
I don't know how these "fixes" translate into your particular code.
I'm not 100% sure that under all circumstances, such an EM approach would converge to exactly the same clusters as K-means. I am confident that the two methods would produce very comparable results under most circumstances.