How does kmeans decide which centroid the observation goes to when they have same mean? And is it possible to use 1d data matrix (n-by-1)?
3 次查看(过去 30 天)
显示 更早的评论
I've been doing color image segmentation using kmeans and it does wonders. However, this question has been bugging me as long and I still yet to find an answer for it.
Example (I'll use one data point and 4 cluster centroids):
data point, A = [3,4]
cluster centroid = [0,8;6,8;0,0;6,0]
Note that the (Euclidean distance) mean of A to all 4 cluster centroids is same = 5
How does kmeans decide which centroid A belongs to? Does it depends on the parameter we set? (eg using different distance measure, number of replicates)
I'm using three components of RGB for my image segmentation, thus it makes me even more confused.
Regarding the observation, is it possible to use 1d data matrix for kmeans, eg only Red component of the image? I Googled and searched all over the place and did not find anything.
0 个评论
回答(1 个)
Walter Roberson
2016-5-18
Unless you specifically request otherwise in the kmeans call, points are randomly assigned to initial clusters. Then as the kmeans algorithm progresses, points may be moved to some other cluster if they are found to be closer to the other cluster. If they are the same distance then the other cluster is not closer so the point would not be moved.
2 个评论
Walter Roberson
2016-5-20
Correct. With the initial membership being done randomly unless you pass a specific initial membership.
另请参阅
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!