org.apache.commons.math.stat.clustering
Class KMeansPlusPlusClusterer<T extends Clusterable<T>>

java.lang.Object
  extended by org.apache.commons.math.stat.clustering.KMeansPlusPlusClusterer<T>
Type Parameters:
T - type of the points to cluster

public class KMeansPlusPlusClusterer<T extends Clusterable<T>>
extends Object

Clustering algorithm based on David Arthur and Sergei Vassilvitski k-means++ algorithm.

Since:
2.0
Version:
$Revision: 811685 $ $Date: 2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009) $
See Also:
K-means++ (wikipedia)

Constructor Summary
KMeansPlusPlusClusterer(Random random)
          Build a clusterer.
 
Method Summary
 List<Cluster<T>> cluster(Collection<T> points, int k, int maxIterations)
          Runs the K-means++ clustering algorithm.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KMeansPlusPlusClusterer

public KMeansPlusPlusClusterer(Random random)
Build a clusterer.

Parameters:
random - random generator to use for choosing initial centers
Method Detail

cluster

public List<Cluster<T>> cluster(Collection<T> points,
                                int k,
                                int maxIterations)
Runs the K-means++ clustering algorithm.

Parameters:
points - the points to cluster
k - the number of clusters to split the data into
maxIterations - the maximum number of iterations to run the algorithm for. If negative, no maximum will be used
Returns:
a list of clusters containing the points


Copyright © 2003-2010 The Apache Software Foundation. All Rights Reserved.