Error in using fitgmdist : xmust have more rows than x

6 次查看(过去 30 天)
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.

请先登录,再进行评论。

更多回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by