user3452546
user3452546

Reputation: 27

How to view kmeans output in matlab?

I have a 2400x12 data which I would like to classify using kmeans. Can anybody tell me how I can see the output of kmeans? Thanks.

Upvotes: 0

Views: 163

Answers (1)

TheVoiceInMyHead
TheVoiceInMyHead

Reputation: 73

As the other guy said, you can't 'see' 12 dimensions. However, you may be able to use PCA to deal with that (check PCA in wikipedia). Assuming that the data variable is called Data:

[c, s] = princomp(Data);
plot(s(:,1), s(:,2),'.');

The rows in s are related to the rows in Data, so you can plot using different symbols for different clusters. For instance:

U=kmeans(Data,2);
[c, s] = princomp(Data);
plot (s(U==1,1), s(U==1,2), 'x');
hold on;
plot (s(U==2,1), s(U==2,2), '*');

Upvotes: 1

Related Questions