Finds the centers of clusters and groups the input samples around the clusters.
Parameters: |
|
---|
The function kmeans implements a k-means algorithm that finds the centers of clusterCount clusters and groups the input samples around the clusters. On output, contains a 0-based cluster index for the sample stored in the row of the samples matrix.
The function returns the compactness measure, which is computed as
after every attempt; the best (minimum) value is chosen and the corresponding labels and the compactness value are returned by the function. Basically, the user can use only the core of the function, set the number of attempts to 1, initialize labels each time using some custom algorithm and pass them with ( flags = KMEANS_USE_INITIAL_LABELS ) flag, and then choose the best (most-compact) clustering.
Splits an element set into equivalency classes.
Parameters: |
|
---|
The generic function partition implements an algorithm for splitting a set of elements into one or more equivalency classes, as described in http://en.wikipedia.org/wiki/Disjoint-set_data_structure . The function returns the number of equivalency classes.