MATLAB Answers

How can I set 'evalclusters' function initial points?

12 views (last 30 days)
Liuxing
Liuxing on 28 Aug 2014
Answered: Anish Mitra on 30 Sep 2014
As we know, kmeans method need we post initial points to do iterations. Basically, evalclusters will call multiply times kmeans function. we can set start points in kmeans, however, I can not find the options to set this parameter in 'evalclusters' function. Can anyone provide solutions?

  0 Comments

Sign in to comment.

Answers (1)

Anish Mitra
Anish Mitra on 30 Sep 2014
As I understand, you are using the MATLAB function evalclusters to generate multiple cluster results for the same data (with different number of clusters each time), and evaluating them based on certain criterion. While you can choose the clustering method ( kmeans ), the function options do not allow the initialization of the cluster centroid positions.
There is, however, a method of creating a function handle to the kmeans algorithm, with the 'start' option specified. This function handle can then be used as an input argument to the evalclusters function.
1. Create the function handle.
>> myfunc = @(X,K)(kmeans(X, K, 'emptyaction', 'singleton', 'replicate',5,'start','uniform'));
Note that you can set any of the options of the kmeans algorithm that you need. X represents the data set and K is the number of clusters.
2. Use the evalclusters function
>> eva = evalclusters(meas, myfunc, 'CalinskiHarabasz', 'klist', [1:6])
'meas' is the variable containing the data stored in the workspace.
You can use this method to specify the distribution of the initial cluster centroid positions.
You can also refer to the following documentation and the example on “Specify Clustering Algorithm with a Function Handle” for more information on the above technique.

  0 Comments

Sign in to comment.

Products