K-Means initialization (newbie question)

dupolasdupolas Member Posts: 4 Contributor I
edited November 2018 in Help
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

Answers

  • wesselwessel Member Posts: 537 Maven
    Hey,

    @ 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.
  • IngoRMIngoRM Administrator, Moderator, Employee, RapidMiner Certified Analyst, RapidMiner Certified Expert, Community Manager, RMResearcher, Member, University Professor Posts: 1,751 RM Founder
    Hi,

    Another question is whether RapidMiner is using Euclidean distance, Manhattan distance or another distance algorithm (and if this can be influenced?)
    For k-Means, Euclidean distance is used. This is necessary in order to perform the cluster optimization in O(n log n) runtime and can hence not be changed. If you want to use other distance functions, you could use k-Medoids. This allows for all distance functions but is slightly slower and runs in O(n*n).

    Cheers,
    Ingo
Sign In or Register to comment.