Error in using fitgmdist : xmust have more rows than x
6 vues (au cours des 30 derniers jours)
Afficher commentaires plus anciens
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.
0 commentaires
Réponse acceptée
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
Plus de réponses (0)
Voir également
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!