Hello,
I would like to use a square matrix for cluster analysis using the Gaussian Mixture Model.
I would like to use the soft variant for this. Unfortunately, I get the following error messages:
Error using gmdistribution.fit
X must have more rows than columns.
Error in fitgmdist (line 135)
gm = gmdistribution.fit(X,k,varargin{:});
Hence the question: How can I change the code to cluster the 50x50 matrix?
%Code
>> % Erzeugen einer 50x50 Matrix mit zufälligen Werten
X = rand(50, 50);
% GMM-Clusteranalyse durchführen
maxNumClusters = 10; % Maximale Anzahl von Clustern
BIC = zeros(1, maxNumClusters);
for k = 1:maxNumClusters
gm = fitgmdist(X, k);
BIC(k) = gm.BIC;
end
% Bestimmung der optimalen Anzahl von Clustern basierend auf dem BIC
[~, optimalNumClusters] = min(BIC);
% GMM-Clusteranalyse mit optimaler Anzahl von Clustern durchführen
gm = fitgmdist(X, optimalNumClusters);
% Cluster-Zuweisungen erhalten
idx = cluster(gm, X);
% Visualisierung der Cluster
figure;
scatter(X(:,1), X(:,2), 10, idx, 'filled');
xlabel('Feature 1');
ylabel('Feature 2');
title(sprintf('GMM Cluster mit %d Clustern', optimalNumClusters));
colorbar;
Error using gmdistribution.fit
X must have more rows than columns.
Error in fitgmdist (line 135)
gm = gmdistribution.fit(X,k,varargin{:});