Question about k means clustering

12 ビュー (過去 30 日間)
John
John 2011 年 11 月 16 日
Hi there,
After you have clustered data, how can you find out or get a print out of what cluster each point has been assigned to?
For example if I cluster this simple data, how can I find out which cluster each data point belongs to
X = [randn(100,2)+ones(100,2);...
randn(100,2)-ones(100,2)];
opts = statset('Display','final');
[idx,ctrs] = kmeans(X,2,...
'Distance','city',...
'Replicates',5,...
'Options',opts);
plot(X(idx==1,1),X(idx==1,2),'r.','MarkerSize',12)
hold on
plot(X(idx==2,1),X(idx==2,2),'b.','MarkerSize',12)
Thank you

採用された回答

bym
bym 2011 年 11 月 17 日
Isn't it the
idx
variable which you have plotted in different colors?

その他の回答 (1 件)

John
John 2011 年 11 月 17 日
Yes it is! Thanks

カテゴリ

Help Center および File ExchangeCluster Analysis and Anomaly Detection についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by