k-means++
Cluster multivariate data using the k-means++ algorithm.
Author: Laurent S

Hi, Laurent,
Thank you for your files. I try your codes and it works if I carefully choose the parameter. However, I cannot choose how many clusters to apply. In my perception, the parameter k should be the number of clusters, however, unfortunately, it is not.

In my case, X is [400*1] matrix, which means that my data is 1D and there are 400 data point. If I let k=1, the code works well, with the resulting C contains 22 unique centers. However, if I let k to be other number, say 4, it is the identical 4 columns with each column the same as in the case of k=1! Is it your initial purpose to do it? If it is the case, I don't understand the purpose of parameter 'k'.

Hope to know your answers! Anyway, thank you very much for your efforts and sharing!

I have code:
nfo = imfinfo('im.png');
X = im2double(imread('im','png'));
X = imadjust(X);
k = 4;
and kmeanspp??
I want to output the resulting image
for example:
X=kmeanspp(X,k);
how can I do?
thanks
I am an Italian student

Comment only

10 Jan 2014

k-means++
Cluster multivariate data using the k-means++ algorithm.

Hi Laurent,
I'm having a bit of trouble understanding the bsxfun lines. Is there any documentation or explanation of why you are maximizing this and how it relates to the distance, can't quite understand where the C' comes from?
Thanks.

Comment only

22 Oct 2013

k-means++
Cluster multivariate data using the k-means++ algorithm.

Hi Laurent,
First of all thanks for the code. I actually trying to use kmeans to bin my 1D data, the C output could be used as the bin centers. However, if I want the function to output edges is there a non-trivial way to do it?
Thanks.

Comment only