필터 지우기
필터 지우기

Error in using fitgmdist : xmust have more rows than x

조회 수: 5 (최근 30일)
A. P. B.
A. P. B. 2017년 5월 31일
댓글: Jose Marques 2018년 2월 17일
Hi, I'm try to use fitgmdist to cluster high dimensional data with size of 128*128. Using
gmfit = fitgmdist(data,3,' CovarianceType','full','RegularizationValue',0.1);
Then error occurs:
X must have more rows than columns.
How can I fix this?
Thanks.

채택된 답변

Archita P
Archita P 2017년 6월 5일
The reason for this error is the explicit check that happens on the dimensions. "fitgmdist" uses the EM algorithm, which requires enough number of observations to fit Gaussian models with invertible covariance matrices. In order for the covariance matrix to be invertible, there must be more observations(rows) than variables(columns).
You can find more information about working with ill-conditioned matrices with "fitgmdist" in the Tips section at:
It is possible to get around the issue of matrices not being invertible by using regularization or a diagonal covariance matrix. To use this workaround with more columns than rows, you will also have to remove/comment-out the following sanity check on line 29 to 31 in the MATLAB\<Release>\toolbox\stats\stats\@gmdistribution\fit.m file:
if n <= d error(message('stats:gmdistribution:TooFewN')); end
Please note that modification to these files can possibly lead to unexpected behavior of MATLAB in the future.
  댓글 수: 2
A. P. B.
A. P. B. 2017년 6월 7일
In the case of square matrix it is also possible to convert the matrix to a vector and perform the fitgmdist for Gaussian Mixture Modelling. It solved my error.
Jose Marques
Jose Marques 2018년 2월 17일
How did you convert the matrix to a vector?

댓글을 달려면 로그인하십시오.

추가 답변 (0개)

태그

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by