I would like to visualize the EM steps taken in a GMM model but don't know how I would go about doing that.
I've generated some synthetic data and fitted a model:
a = np.random.normal(loc=[2,2,2], scale=1.0, size=(100,3))
b = np.random.normal(loc=[5,5,5], scale=1.0, size=(100,3))
c = np.random.normal(loc = [7,7,7], scale = 1.0, size = (100,3))
data = np.concatenate((a,b,c), axis = 0)
df = pd.DataFrame(data, columns=['x', 'y', 'z'])
gm = GaussianMixture(n_components = 3, random_state = 213).fit(df)
res = gm.fit_predict(df)
I've used graspologic (package for graph statistics) to visualize the end result but would like to see how the EM algorithm iterates through the data.
Any thoughts on how I can implement this?