k-means clustering algorithm

For the data set shown below, execute the k-means clustering algorithm with k=2 till convergence. You should declare convergence when the cluster assignments for the examples no longer change. As initial values, set µ1 and µ2 equal to x(1) and x(3) respectively. Show your calculations for every iteration. x1 x2 1 1 1,5 2 2 1 2 0,5 4 3 5 4 6 3 6 4
1. You should start your calculation first by initializing your µ1 and µ2 as shown below. µ1 = x(1) =(1,1) µ2 = x(3) =(2,1) 2. For every iteration till convergence find c(i) for i = {1,2,3,4,5,6,7,8} then compute the average for each cluster and reassign the µ1 and µ2 3. Repeat 2 till convergence

5 件のコメント

the cyclist
the cyclist 2016 年 5 月 22 日
編集済み: the cyclist 2016 年 5 月 22 日
Read this guide to asking a good question here.
Image Analyst
Image Analyst 2016 年 5 月 22 日
編集済み: Image Analyst 2016 年 5 月 22 日
the cyclist
the cyclist 2016 年 5 月 22 日
@ImageAnalyst ...
FYI, kmeans does accept a name-value pair ('Start',<value>) for initialization of the cluster centroids.
Image Analyst
Image Analyst 2016 年 5 月 23 日
Thanks for the correction - apparently I overlooked it.

サインインしてコメントする。

回答 (1 件)

Image Analyst
Image Analyst 2016 年 5 月 23 日

0 投票

Hint:
x1x2 = [...
1 1
1.5 2
2 1
2 0.5
4 3
5 4
6 3
6 4]
x1 = x1x2(:, 1);
x2 = x1x2(:, 2);
mu1 = [1,1];
mu2 = [2,1];
for k = 1 : 4
indexes = kmeans(x1x2, 2, 'start', [mu1;mu2])
mu1 = mean(x1x2(indexes == 1, :), 1)
mu2 = mean(x1x2(indexes == 2, :), 1)
end

カテゴリ

ヘルプ センター および File ExchangeStatistics and Machine Learning Toolbox についてさらに検索

質問済み:

2016 年 5 月 22 日

コメント済み:

2017 年 12 月 28 日

Community Treasure Hunt

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

Start Hunting!

Translated by