Clusterer< T extends Clusterable< T > > Class Reference

Collaboration diagram for Clusterer< T extends Clusterable< T > >:

List of all members.


Detailed Description

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

Parameters:
<T>type of the points to cluster
See also:
K-means++ (wikipedia)
Version:
Revision:
811685
Date:
2009-09-05 13:36:48 -0400 (Sat, 05 Sep 2009)
Since:
2.0

Public Methods

 Clusterer (final Random random, KMeansClustererComponent component)
List< Cluster< T > > cluster (final List< T > points, final int k, final int maxIterations) throws InterruptedException, ExecutionException

Package Functions

private< T extends Clusterable
< T > > void 
assignPointsToClusters (final Collection< Cluster< T >> clusters, final List< T > points) throws InterruptedException, ExecutionException
private< T extends Clusterable
< T > > List< Cluster< T > > 
chooseInitialCenters (final Collection< T > points, final int k, final Random random)
private< T extends Clusterable
< T > > Cluster< T > 
getNearestCluster (final Collection< Cluster< T >> clusters, final T point)

Constructors

Clusterer ( final Random  random,
KMeansClustererComponent  component 
)

Build a clusterer.

Parameters:
randomrandom generator to use for choosing initial centers
kMeansClusterer

Method Details

private<T extends Clusterable<T> > void assignPointsToClusters ( final Collection< Cluster< T >>  clusters,
final List< T >  points 
) throws InterruptedException, ExecutionException [package]

Adds the given points to the closest Cluster.

Parameters:
<T>type of the points to cluster
clustersthe Clusters to add the points to
pointsthe points to add to the given Clusters
Exceptions:
ExecutionException
InterruptedException
private<T extends Clusterable<T> > List<Cluster<T> > chooseInitialCenters ( final Collection< T >  points,
final int  k,
final Random  random 
) [package]

Use K-means++ to choose the initial centers.

Parameters:
<T>type of the points to cluster
pointsthe points to choose the initial centers from
kthe number of centers to choose
randomrandom generator to use
Returns:
the initial centers
Exceptions:
ExecutionException
InterruptedException
List<Cluster<T> > cluster ( final List< T >  points,
final int  k,
final int  maxIterations 
) throws InterruptedException, ExecutionException

Runs the K-means++ clustering algorithm.

Parameters:
pointsthe points to cluster
kthe number of clusters to split the data into
maxIterationsthe maximum number of iterations to run the algorithm for. If negative, no maximum will be used
Returns:
a list of clusters containing the points
Exceptions:
ExecutionException
InterruptedException
private<T extends Clusterable<T> > Cluster<T> getNearestCluster ( final Collection< Cluster< T >>  clusters,
final T  point 
) [package]

Returns the nearest Cluster to the given point

Parameters:
<T>type of the points to cluster
clustersthe Clusters to search
pointthe point to find the nearest Cluster for
Returns:
the nearest Cluster to the given point