Skip to content
Snippets Groups Projects
Commit 1caffe80 authored by Vincent Michel's avatar Vincent Michel
Browse files

Fix a bug in the computation of the log lokelihood

git-svn-id: https://scikit-learn.svn.sourceforge.net/svnroot/scikit-learn/trunk@707 22fbfee3-77ab-4535-9bad-27d1bd3bc7d8
parent 69905bbe
No related branches found
No related tags found
No related merge requests found
......@@ -75,10 +75,9 @@ class GNB(object):
joint_log_likelihood = []
for i in range(np.size(self.unique_y)):
jointi = np.log(self.proba_y[i])
n_ij = np.sum(-0.5 * np.log(np.pi * self.sigma[i,:]))
n_ij = n_ij * np.ones(np.size(X, 0))
n_ij -= np.sum((X - self.theta[i,:])**2, 1)
n_ij += np.sum(2 * self.sigma[i,:]) * np.ones(np.size(X, 0))
n_ij = - 0.5 * np.sum(np.log(np.pi*self.sigma[i,:]))
n_ij -= 0.5 * np.sum( ((X - self.theta[i,:])**2) /\
(self.sigma[i,:]),1)
joint_log_likelihood.append(jointi+n_ij)
joint_log_likelihood = np.array(joint_log_likelihood).T
proba = np.exp(joint_log_likelihood)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment