def log_likelihood(self): nzw, ndz, nz = self._num_zw, self._num_dz, self._num_z alpha = self.alpha beta = self.beta nd = np.sum(ndz, axis=1).astype(np.intc) # call c function via _lda.pyx return _lda._loglikelihood(nzw, ndz, nz, nd, alpha, beta)
def loglikelihood(self): """Calculate complete log likelihood, log p(w,z) Formula used is log p(w,z) = log p(w|z) + log p(z) """ nd = np.sum(self.ndz, axis=1).astype(np.intc) return _lda._loglikelihood(self.nzw, self.ndz, self.nz, nd, self.alpha, self.beta)
def loglikelihood(self): """Calculate complete log likelihood, log p(w,z) Formula used is log p(w,z) = log p(w|z) + log p(z) """ nzw, ndz, nz = self.nzw_, self.ndz_, self.nz_ alpha = self.alpha eta = self.eta nd = np.sum(ndz, axis=1).astype(np.intc) return _lda._loglikelihood(nzw, ndz, nz, nd, alpha, eta)
def loglikelihood_inference(self): """ Computes the log-likelihood using just the LDA part: log p(w,z) = log p(w|z) + log p(z) """ return _lda._loglikelihood(self.nzw_, self.ndz_, self.nz_, self.nd_, self.alpha, self.eta)