def marginal_likelihood(self, log=True, normalize=True): lp = logmvbeta(self.initial_counts) + logmvbeta(self.transition_counts) if normalize: lp -= (logmvbeta(self.initial_alpha) + logmvbeta(self.transition_alpha)) return lp if log else np.exp(lp)
def marginal_likelihood(self, log=True, normalize=True): lf1 = logmvbeta(self.counts) if normalize: lf1 -= logmvbeta(self.alpha) lf2 = sum(component.marginal_likelihood(log=True, normalize=normalize) for component in self.components) return lf1 + lf2 if log else np.exp(lf1 + lf2)