Info

이 질문은 마감되었습니다. 편집하거나 답변을 올리려면 질문을 다시 여십시오.

kmeans works with some values of k and not works with other

조회 수: 1 (최근 30일)
huda nawaf
huda nawaf 2014년 12월 11일
마감: MATLAB Answer Bot 2021년 8월 20일
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*

답변 (2개)

Adam
Adam 2014년 12월 11일
편집: Adam 2014년 12월 12일
Surely in a binary matrix it wouldn't make any sense to have more than 2 clusters? You have a cluster of 0s and a cluster of 1s. How can you possibly split into 3 clusters in a mathematically meaningful way?
  댓글 수: 2
huda nawaf
huda nawaf 2014년 12월 12일
I thought the kmeans do as Neuman did in same binary matrix.
huda nawaf
huda nawaf 2014년 12월 12일
Thanks so much

Peter Perkins
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
huda nawaf
huda nawaf 2014년 12월 12일
thanks I will describe my data it is squared matrix each row represents the relation between one user and others ,where 1 represent there is a relation and o otherwise.
In Neuman algorithm for clustering, these data are clustered into three clusters. Maybe because I have no experience with kmeans I thought it will give me three clusters.

이 질문은 마감되었습니다.

태그

Community Treasure Hunt

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

Start Hunting!

Translated by