Form K-means clusters from a set of
n-dimensional vectors
1. Set ic (iteration count) to 1
2. Choose randomly a set of K means
m1(1), …, mK(1).
3. For each vector xi, compute
D(xi,mk(ic)), k=1,…K
and assign xi to the cluster Cj with
nearest mean.
4.
Increment ic by 1, update the means to get m1(ic),…,mK(ic).
5. Repeat steps 3 and 4 until Ck(ic)
= Ck(ic+1) for all k.