def rh_e2p_fit(self):
"""Initial fit of e2p map with a batch of data"""
# 2. now we learn e2p mapping (conditional joint density model for dealing with ambiguity)
# ## prepare data
if not self.attr_check(["logs", "e2p"]):
return
# print self.logs["EP"].shape, self.logs["X_"].shape
# pl.ioff()
# pl.plot(self.logs["X_"])
# pl.show()
# print "self.logs['X_']", self.logs["X_"]
print("%s.rh_e2p_fit batch fitting of e2p (%s)" % (self.__class__.__name__, self.mm.__class__.__name__))
self.mm.fit(np.asarray(self.e2p.X_)[10:], np.asarray(self.e2p.y_)[10:])
# # fit gmm
# self.cen_lst, self.cov_lst, self.p_k, self.logL = gmm.em_gm(self.logs["EP"], K = 10, max_iter = 1000,\
# verbose = False, iter_call = None)
# print "rh_e2p_fit gmm: Log likelihood (how well the data fits the model) = ", self.logL
# # print "rh_e2p_fit gmm:", np.array(self.cen_lst).shape, np.array(self.cov_lst).shape, self.p_k.shape
评论列表
文章目录