# K-Means initialization (newbie question)

Hi All,

being a newbie to both data mining and Rapidminer I run into a question with regards to the k-means clustering algorithm.

First of all, from my theory book (Introduction to datamining by Tan & Steinbach) I learned that choosing the initial centroids for k-means is essential for the success of the algorithm. With the examples in the book, I understand that. But I would like to learn how to do this in practice using rapidminer.

Is there a way to set the initial centroids? I don't see any attribute for it on the k-means component.

Am I misunderstanding theory? Is this something rapidminer just doesn't support (and thus does random initialization)

Another question is whether RapidMiner is using Euclidean distance, Manhattan distance or another distance algorithm (and if this can be influenced?)

Regards,

Geoffrey

being a newbie to both data mining and Rapidminer I run into a question with regards to the k-means clustering algorithm.

First of all, from my theory book (Introduction to datamining by Tan & Steinbach) I learned that choosing the initial centroids for k-means is essential for the success of the algorithm. With the examples in the book, I understand that. But I would like to learn how to do this in practice using rapidminer.

Is there a way to set the initial centroids? I don't see any attribute for it on the k-means component.

Am I misunderstanding theory? Is this something rapidminer just doesn't support (and thus does random initialization)

Another question is whether RapidMiner is using Euclidean distance, Manhattan distance or another distance algorithm (and if this can be influenced?)

Regards,

Geoffrey

0

## Answers

537Guru@ option to set initial clusters yourself

I don't think there is.

But since RM is open source it is very easy to modify the code.

Here is the source of k-means:

http://pastebin.com/TvGxrwdJ

Within source of public class CentroidClusterModel extends ClusterModel {

for (int i = 0; i < k; i++) {

centroids.add(new Centroid(dimensionNames.size()));

}

Please also read: http://rapid-i.com/content/view/25/72/lang,en/

@ Theory

I think random initializations are fine.

You should simply do multiple runs with random initializations.

1,643RM FounderCheers,

Ingo