Error in using fitgmdist : xmust have more rows than x

6 vues (au cours des 30 derniers jours)
A. P. B.
A. P. B. le 31 Mai 2017
Commenté : Jose Marques le 17 Fév 2018
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.

Réponse acceptée

Archita P
Archita P le 5 Juin 2017
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 commentaires
A. P. B.
A. P. B. le 7 Juin 2017
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 le 17 Fév 2018
How did you convert the matrix to a vector?

Connectez-vous pour commenter.

Plus de réponses (0)

Tags

Community Treasure Hunt

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

Start Hunting!

Translated by