我正在尝试用k-均值聚类对二维数据进行聚类,其中我的数据为wv_prop
(附加),并根据matlab提供的示例代码进行绘图。但是,如附图所示,第二个质心周围没有任何点,我得到了一个奇怪的结果。有人知道为什么会这样吗?看起来idx变量只包含1,没有2。
[idx,C] = kmeans(wv_prop,2);
figure;
plot(wv_prop(idx==1,1),wv_prop(idx==1,2),'r.','MarkerSize',12)
hold on
plot(wv_prop(idx==2,1),wv_prop(idx==2,2),'b.','MarkerSize',12)
plot(C(:,1),C(:,2),'kx',... 'MarkerSize',15,'LineWidth',3)
legend('Cluster 1','Cluster 2','Centroids',... 'Location','NW')
title 'Cluster Assignments and Centroids'
hold off
我可以在此处附加数据吗?