probml / pmtk3

Probabilistic Modeling Toolkit for Matlab/Octave.
MIT License
1.55k stars 797 forks source link

Error in using mixGaussFit: Matrix must be positive definite #121

Open rayleigh007 opened 8 years ago

rayleigh007 commented 8 years ago

OS: Windows & with Matlab 2015a

I was inputting a data=11 x 2180 comprises of 11 dimensions with 2180 observations to the function mixGaussFit(data, 2). It prompted the following error. How do i solved "Matrix must be positive definite."

Error using chol Matrix must be positive definite. Error in gaussSample (line 20) A = chol(Sigma, 'lower'); Error in kmeansFit (line 42) noise = gaussSample(zeros(1, length(v)), 0.01*diag(v), K); Error in kmeansInitMixGauss (line 7) [mu, assign] = kmeansFit(data, K); Error in mixGaussFit>initGauss (line 38) [mu, Sigma, model.mixWeight] = kmeansInitMixGauss(X, nmix); Error in mixGaussFit>@(m,X,r)initGauss(m,X,r,initParams,prior) (line 24) initFn = @(m, X, r)initGauss(m, X, r, initParams, prior); Error in emAlgo (line 56) model = init(model, data, restartNum); Error in mixGaussFit (line 25) [model, loglikHist] = emAlgo(model, data, initFn, @estep, @mstep , ...