def _compute_log_p_kappa(self): log_p_prior = sum([ compute_e_log_p_dirichlet(x, self.kappa_prior) for x in self.kappa.values() ]) log_p_posterior = self._compute_e_log_p_kappa_posterior() return log_p_prior + log_p_posterior
def _compute_e_log_p(self): gamma_prior = 0 gamma_posterior = 0 for data_type in self.data_types: for k in range(self.K): for m in range(self.M[data_type]): gamma_prior += compute_e_log_p_dirichlet(self.gamma[data_type][:, k, m], self.gamma_prior[data_type]) gamma_posterior += self._compute_e_log_p_gamma_posterior(data_type) kappa_prior = compute_e_log_p_dirichlet(self.kappa, self.kappa_prior) kappa_posterior = self._compute_e_log_p_kappa_posterior() return sum([gamma_prior, gamma_posterior, kappa_prior, kappa_posterior])
def _compute_log_p_gamma(self): log_p_prior = 0 log_p_posterior = 0 for data_type in self.data_types: if self.use_position_specific_gamma: for m in range(self.M[data_type]): log_p_prior += sum([ compute_e_log_p_dirichlet(x, y) for x, y in zip(self.gamma[data_type][:, :, m], self.gamma_prior[data_type]) ]) else: log_p_prior += sum([ compute_e_log_p_dirichlet(x, y) for x, y in zip( self.gamma[data_type], self.gamma_prior[data_type]) ]) log_p_posterior += self._compute_e_log_p_gamma_posterior(data_type) return log_p_prior + log_p_posterior
def _compute_log_p_alpha(self): log_p_prior = compute_e_log_p_dirichlet(self.alpha, self.alpha_prior) log_p_posterior = self._compute_e_log_p_alpha_posterior() return log_p_prior + log_p_posterior