def main(datapath, ubmpath, gmmPath): fpaths = get_training_data_fpaths(datapath) # print "The fpath is :",fpaths X_train, y_train = datautil.read_data(fpaths) ubm = GMM.load(ubmpath) for x, y in zip(X_train, y_train): gmm = GMM(concurrency=8, threshold=0.01, nr_iteration=100, verbosity=1) start = time.time() gmm.fit(x, ubm=ubm) # score = gmm.score(X_train[0]) # print(gmm.weights_) # score_ubm = ubm.score(X_train[0]) # print(sum(score)) # print(sum(score_ubm)) # score_all = gmm.score_all(X_train[6]) # score_all_ubm = ubm.score_all(X_train[6]) # print(str(score_all) + " score_all") # print(str(score_all_ubm) + " score_all") # print(str(score_all/score_all_ubm) + " score_all") end = time.time() print(str(end - start) + " seconds") gmm.dump(os.path.join(gmmPath, y + ".model")) print(os.path.join(gmmPath, y + ".model"))
def fit_new(self, x, label): self.y.append(label) gmm = GMM(self.gmm_order, **self.kwargs) gmm.fit(x, self.ubm) self.gmms.append(gmm)
def fit_new(self, x, label): self.y.append(label) gmm = GMM(self.gmm_order) gmm.fit(x) self.gmms.append(gmm)