k-Means
Synopsis
This Operator performs clustering using the
k-means algorithm.
Description
This Operator performs clustering using the k-means algorithm. Clustering groups Examples together which are similar to each other. As no Label Attribute is necessary, Clustering can be used on unlabelled data and is an algorithm of unsupervised machine learning.
The k-means algorithm determines a set of k clusters and assignes each Examples to exact one cluster. The clusters consist of similar Examples. The similarity between Examples is based on a distance measure between them.
A cluster in the k-means algorithm is determined by the position of the center in the n-dimensional space of the n Attributes of the ExampleSet. This position is called centroid. It can, but do not have to be the position of an Example of the ExampleSets.
The k-means algorithm starts with k points which are treated as the centroid of k potential clusters. These start points are either the position of k randomly drawn Examples of the input ExampleSet, or are determined by the k-means++ heuristic if determine good start values is set to true.
All Examples are assigned to their nearest cluster (nearest is defined by the measure type). Next the centroids of the clusters are recalculated by averaging over all Examples of one cluster. The previous steps are repeated for the new centroids until the the centroids no longer move or max optimization steps is reached. Be aware that it is not ensured that the k-means algorithm converges if the measure type is not based on Euclidean Distance calculation (cause the recalculation of the centroids by averaging is assuming Euclidean space).
The procedure is repeated max runs times with each time a different set of start points. The set of clusters is delivered which has the minimal sum of squared distances of all Examples to their corresponding centroids.
Differentiation
K-Medoids
In case of the k-medoids algorithm the centroid of a cluster will always be one of the points in the cluster. This is the major difference between the k-means and k-medoids algorithm.
k-Means (Kernel)
Kernel k-means uses kernels to estimate distances between Examples and clusters. Because of the nature of kernels it is necessary to sum over all Examples of a cluster to calculate one distance. So this algorithm is quadratic in number of Examples and does not return a Centroid Cluster Model (on the contrary the K-Means operator returns a Centroid Cluster Model).
Input
example set
This input port expects an ExampleSet.
Output
cluster model
This port delivers the cluster model. It contains the information which Examples are part of which cluster. It also stores the position of the centroids of the clusters.
It can be used by the Apply Model Operator to perform the specified clustering on another ExampleSet.
The cluster model can also be grouped together with other clustering models, preprocessing models and learning models by the Group Models Operator.
clustered set
An Attribute 'id' with special role 'Id' is added to the input ExampleSet to distinguish Examples. Depending on the add cluster attribute and the add as label parameters an Attribute 'cluster' with special role 'Cluster' or 'Label' is also added. The resulting ExampleSet is delivered at this output port.
Parameters
add cluster attribute
If true, a new Attribute called 'cluster' with the cluster_id for each Example is generated. By default the Attribute is created with the special role 'Cluster', except the parameter add as label is true. If so the new Attribute is called 'label' and has the special role 'Label'. The Attribute can also be generated later by using the Apply Model Operator.
add as label
If true the new Attribute with the cluster_id is called 'label' and has the special role 'Label'. If the parameter add cluster attribute is false, no new Attribute is created.
remove unlabeled
If set to true, Examples which cannot be assigned to a cluster are removed from the output ExampleSet.
k
This parameter specifies the number of clusters to determine.
max runs
This parameter specifies the maximal number of runs of k-Means with random initialization of the start points that are performed.