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)?

22 ビュー (過去 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.

回答 (1 件)

Walter Roberson
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 件のコメント
Lim
Lim 2016 年 5 月 19 日
Ah! So, as long as the initial cluster it belongs to is the closest, it will just remain in that cluster until it finds another centroids that is closer to it or until the centroids no longer move, am I understand it right?
Walter Roberson
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!

Translated by