def log_marg(self):
"""Return log marginal of data and component assignments: p(X, z)"""
log_prob_z = self.log_prob_z()
log_prob_X_given_z = self.log_prob_X_given_z()
# # Log probability of component assignment, (24.24) in Murphy, p. 842
# log_prob_z = (
# gammaln(self.alpha)
# - gammaln(self.alpha + np.sum(self.components.counts))
# + np.sum(
# gammaln(
# self.components.counts
# + float(self.alpha)/self.components.K_max
# )
# - gammaln(self.alpha/self.components.K_max)
# )
# )
# # Log probability of data in each component
# log_prob_X_given_z = self.components.log_marg()
return log_prob_z + log_prob_X_given_z
# @profile
评论列表
文章目录