# What is exactly the kmeans ++ algorithm? How do you actually go about implementing it?

6 views (last 30 days)

Show older comments

##### 0 Comments

### Answers (2)

Tom Lane
on 24 Oct 2015

First off, if you look inside kmeans.m you should find an implementation of this.

I'm hoping this is the kind of information you want, based on your other comments. Pick a point at random as the first cluster center. The general idea is that you want other cluster centers to be far from the first one. Suppose the D^2 distances from the other points to the first center are in descending order 12, 10, 2, 1.1, 0.5, ..., and suppose the sum of these is 30. Then you would choose as the second cluster the first point with probability 12/30, the second with probability 10/30, and so on.

For the third center, proceed the same way but D^2 for any point is the minimum distance from that point to the first two centers. Then choose centers 4,5,...,k the same way,

Generally this just starts you out. You proceed with the k-means algorithm iterations once you select the k starting centers.

##### 0 Comments

### See Also

### Community Treasure Hunt

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

Start Hunting!