pmtk3 icon indicating copy to clipboard operation
pmtk3 copied to clipboard

gaussLogprob and positive definiteness

Open ido opened this issue 11 years ago • 0 comments

From [email protected] on July 05, 2011 09:12:04

What steps will reproduce the problem? 1. Follow the tutorial on: http://pmtk3.googlecode.com/svn/trunk/docs/tutorial/html/tutFoundations.html 2. From this line on I get different outputs to the ones shown in the tutorial: m2 = gaussFit(X(1:50,:)); cond(m2.Sigma) 3. Later, this crashes: L = gaussLogprob(m3, X); Saying: ??? Error using ==> chol Matrix must be positive definite. What is the expected output? What do you see instead? An output for L is expected. I get an error. What version / revision of the product are you using? On what operating system? R2011a (64bit) on Windows 7 64bit system Please provide any additional information below. Looking inside the gaussLogprob function, it says:

% Full covariance case if 0 logp2 = -0.5_sum((X/Sigma)._X, 2); logZ2 = (d/2)_log(2_pi) + 0.5_logdet(Sigma); logp2 = logp2 - logZ2; end % slightly faster version R = chol(Sigma); logp = -0.5_sum((X/R).^2, 2); logZ = 0.5_d_log(2*pi) + sum(log(diag(R))); logp = logp - logZ;

Maybe the 'if 0' should be replaced by a test for positive definiteness.

Original issue: http://code.google.com/p/pmtk3/issues/detail?id=28

ido avatar Jan 04 '14 01:01 ido