generated=array([real_gmm.sample()]) for i in range(199): generated=append(generated, array([real_gmm.sample()]), axis=1) feat_train=RealFeatures(generated) #train GMM using EM est_gmm=GMM(3) est_gmm.train(feat_train) est_gmm.train_em(min_cov, max_iter, min_change) #get and print estimated means and covariances est_mean1=est_gmm.get_nth_mean(0) est_mean2=est_gmm.get_nth_mean(1) est_mean3=est_gmm.get_nth_mean(2) est_cov1=est_gmm.get_nth_cov(0) est_cov2=est_gmm.get_nth_cov(1) est_cov3=est_gmm.get_nth_cov(2) est_coef=est_gmm.get_coef() print est_mean1 print est_cov1 print est_mean2 print est_cov2 print est_mean3 print est_cov3 print est_coef #plot real GMM, data and estimated GMM min_gen=min(min(generated)) max_gen=max(max(generated)) plot_real=empty(0)
generated = array([real_gmm.sample()]) for i in range(199): generated = append(generated, array([real_gmm.sample()]), axis=1) feat_train = RealFeatures(generated) #train GMM using EM est_gmm = GMM(3) est_gmm.train(feat_train) est_gmm.train_em(min_cov, max_iter, min_change) #get and print estimated means and covariances est_mean1 = est_gmm.get_nth_mean(0) est_mean2 = est_gmm.get_nth_mean(1) est_mean3 = est_gmm.get_nth_mean(2) est_cov1 = est_gmm.get_nth_cov(0) est_cov2 = est_gmm.get_nth_cov(1) est_cov3 = est_gmm.get_nth_cov(2) est_coef = est_gmm.get_coef() print est_mean1 print est_cov1 print est_mean2 print est_cov2 print est_mean3 print est_cov3 print est_coef #plot real GMM, data and estimated GMM min_gen = min(min(generated)) max_gen = max(max(generated)) plot_real = empty(0)
generated=array([real_gmm.sample()]) for i in range(199): generated=append(generated, array([real_gmm.sample()]), axis=0) generated=generated.transpose() feat_train=RealFeatures(generated) #train GMM using EM est_gmm=GMM(2, cov_type) est_gmm.train(feat_train) est_gmm.train_em(min_cov, max_iter, min_change) #get and print estimated means and covariances est_mean1=est_gmm.get_nth_mean(0) est_mean2=est_gmm.get_nth_mean(1) est_cov1=est_gmm.get_nth_cov(0) est_cov2=est_gmm.get_nth_cov(1) est_coef=est_gmm.get_coef() print est_mean1 print est_cov1 print est_mean2 print est_cov2 print est_coef #plot real GMM, data and estimated GMM min_x_gen=min(min(generated[[0]]))-0.1 max_x_gen=max(max(generated[[0]]))+0.1 min_y_gen=min(min(generated[[1]]))-0.1 max_y_gen=max(max(generated[[1]]))+0.1 plot_real=empty(0)
generated = array([real_gmm.sample()]) for i in range(199): generated = append(generated, array([real_gmm.sample()]), axis=0) generated = generated.transpose() feat_train = RealFeatures(generated) #train GMM using EM est_gmm = GMM(2, cov_type) est_gmm.train(feat_train) est_gmm.train_em(min_cov, max_iter, min_change) #get and print estimated means and covariances est_mean1 = est_gmm.get_nth_mean(0) est_mean2 = est_gmm.get_nth_mean(1) est_cov1 = est_gmm.get_nth_cov(0) est_cov2 = est_gmm.get_nth_cov(1) est_coef = est_gmm.get_coef() print est_mean1 print est_cov1 print est_mean2 print est_cov2 print est_coef #plot real GMM, data and estimated GMM min_x_gen = min(min(generated[[0]])) - 0.1 max_x_gen = max(max(generated[[0]])) + 0.1 min_y_gen = min(min(generated[[1]])) - 0.1 max_y_gen = max(max(generated[[1]])) + 0.1 plot_real = empty(0)