Info
この質問は閉じられています。 編集または回答するには再度開いてください。
kmeans works with some values of k and not works with other
1 回表示 (過去 30 日間)
古いコメントを表示
hi,
*I used kmeans(f1, 2) where f1 is square binary matrix, it is work with k=2 but when set k to 3, i got this error I do not why
error using ==>kmeans>batchUpdate at 417 empty cluster created at iteration 1.
thanks*
0 件のコメント
回答 (2 件)
Peter Perkins
2014 年 12 月 12 日
If f1 is a binary matrix, then it certainly does make sense to cluster your data into more than two clusters. Each column of f1 is treated as an N-D binary vector, and (if n were 3, for example), one cluster might be [0;0;1], another [0;1;0], and the third [1;0;0]. This isn't very interesting in 3D, but in higher dimensions. it might well be.
HOWEVER.
You are clustering binary data using (squared) Euclidean distance. There are other choices for the distance function that are likely more appropriate, read the doc.
The empty cluster error is simply because (apparently) your data do NOT contain more than two clusters and KMEANS is having trouble figuring out what to put in a third one. There is a parameter to KMEANS that controls how to handle this, again, read the doc.
Hope this helps.
1 件のコメント
この質問は閉じられています。
参考
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!