Permalink
Browse files

Revert "No specific need that matrix is upper-triangular in gmm."

This reverts commit 1ca639e.
  • Loading branch information...
1 parent 52505e9 commit c7248c8dc99bb3fc53914231989d0ed89944aed0 @fabianp fabianp committed Oct 20, 2010
Showing with 2 additions and 5 deletions.
  1. +2 −5 scikits/learn/gmm.py
View
7 scikits/learn/gmm.py
@@ -557,9 +557,6 @@ def _lmvnpdftied(obs, means, covars):
return lpr
def _lmvnpdffull(obs, means, covars):
- """
- Calculate the log density with a full covariance matrix
- """
from scipy import linalg
import itertools
if hasattr(linalg, 'solve_triangular'):
@@ -572,9 +569,9 @@ def _lmvnpdffull(obs, means, covars):
nmix = len(means)
log_prob = np.empty((nobs,nmix))
for c, (mu, cv) in enumerate(itertools.izip(means, covars)):
- cv_chol = linalg.cholesky(cv)
+ cv_chol = linalg.cholesky(cv, lower=True)
cv_det = np.prod(np.diagonal(cv_chol))**2
- cv_sol = solve_triangular(cv_chol, (obs - mu).T)
+ cv_sol = solve_triangular(cv_chol, (obs - mu).T, lower=True)
log_prob[:, c] = -.5 * (np.sum(cv_sol**2, axis=0) + \
ndim * np.log(2 * np.pi) + np.log(cv_det))

0 comments on commit c7248c8

Please sign in to comment.