Skip to content

Commit

Permalink
update em_1d_gmm.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mohitmajithia committed May 4, 2020
1 parent 9b5793b commit c4593eb
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions examples/undocumented/python/graphical/em_1d_gmm.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
from pylab import figure,show,connect,hist,plot,legend
from numpy import array, append, arange, empty, exp
from shogun import Gaussian, GMM
from shogun import RealFeatures
from shogun import sg
import util

util.set_title('EM for 1d GMM example')
Expand All @@ -12,7 +11,7 @@
min_change=1e-9

#setup the real GMM
real_gmm=GMM(3)
real_gmm=sg.GMM(3)

real_gmm.set_nth_mean(array([-2.0]), 0)
real_gmm.set_nth_mean(array([0.0]), 1)
Expand All @@ -29,10 +28,10 @@
for i in range(199):
generated=append(generated, array([real_gmm.sample()]), axis=1)

feat_train=RealFeatures(generated)
feat_train=sg.RealFeatures(generated)

#train GMM using EM
est_gmm=GMM(3)
est_gmm=sg.GMM(3)
est_gmm.train(feat_train)
est_gmm.train_em(min_cov, max_iter, min_change)

Expand Down

0 comments on commit c4593eb

Please sign in to comment.