I don't understand, how can I fix this?
You need to transpose the matrix, you got it right. The vectors must be on the raws
Any ideas on how to fix this?
GMDISTRIBUTION implements the standard Expectation-Maximization (EM) algorithm. In some cases, it may converge to a solution which contains singular or close-singular covariance matrix for one or more components. Those components usually contains a few data points almost lying in a lower-dimensional subspace. A solution with singular covariance matrix is usually considered as spurious. Sometimes, this problem may go away if you try another set of initial values; Sometimes, this problem will always occur because of any of the following reasons:
- The number of dimension of data is relatively high, but there are not enough observations.
- Some of the features(variables) of your data are highly correlated.
- Some or all the features are discrete.
- You try to fit the data to too many components.
In your case, it seems that the number of components that you used, 8, is too big. you can try to reduce the number of components. Generally, there are also other ways that you can use to avoid getting "Ill-conditioned covariance matrix" error message"
- If you don't mind to get solutions with ill-conditioned covariance matrix, you can use option 'Regularize' in the GMDISTRIBUTION/FIT function to add a very small positive number to the diagonal of every covariance matrix.
- You can specify the value of 'SharedCov' to be true to use equal covariance matrix for every component.
- You can specify the value of 'CovType' to be 'diagonal' .
See also
http://www.mathworks.com/matlabcentral/newsreader/view_thread/168289
Should I be using only upto 12 cols at a time?
No