how can we know that which cluster has which data points after applying k-means clustering ?
2 次查看(过去 30 天)
显示 更早的评论
My data size is 100*11. I have applied k-means clustering and clusters are generated. I want to know about the data points of each cluster.Please give me solution of it.
Thanks in advance
0 个评论
回答(2 个)
KSSV
2018-7-11
kmean gives you classes of each cluster, from here it is easy to access the group/ class you want. Check the below code for demo:
K = 4 ; % groups
N = 5000 ;
x = rand(N,1) ;
y = rand(N,1) ;
% apply kmeans
idx = kmeans([x,y],K) ;
% get each cluster
data = cell(K,1) ;
figure
hold on
for i = 1:K
data{i} = [x(idx==i),y(idx==i)] ;
plot(x(idx==i),y(idx==i),'.')
end
3 个评论
Image Analyst
2018-7-14
Here's another thing you can read http://www.mathworks.com/matlabcentral/answers/6200-tutorial-how-to-ask-a-question-on-answers-and-get-a-fast-answer.
Image Analyst
2018-7-11
But the assigned class is exactly what kmeans gives you. Explain why you're confused about this.
Attached are some kmeans demos.
另请参阅
类别
在 Help Center 和 File Exchange 中查找有关 Statistics and Machine Learning Toolbox 的更多信息
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!