be.ac.ulg.montefiore.run.jahmm
Class KMeansCalculator<K extends CentroidFactory<? super K>>

java.lang.Object
  extended by be.ac.ulg.montefiore.run.jahmm.KMeansCalculator<K>

public class KMeansCalculator<K extends CentroidFactory<? super K>>
extends java.lang.Object

This class can be used to divide a set of elements in clusters using the k-means algorithm.

The algorithm used is just the plain old k-means algorithm as explained in Clustering and the Continuous k-Means Algorithm (Vance Faber, Los Alamos Science number 22).

In order to get the theoretical complexity, the list of elements to be clustered must be accessible in O(1).


Constructor Summary
KMeansCalculator(int k, java.util.List<? extends K> elements)
          This class divides a set of elements in a given number of clusters.
 
Method Summary
 java.util.Collection<K> cluster(int index)
          Returns the elements of one of the clusters.
 int nbClusters()
          Returns the number of clusters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KMeansCalculator

public KMeansCalculator(int k,
                        java.util.List<? extends K> elements)
This class divides a set of elements in a given number of clusters.

Parameters:
k - The number of clusters to get.
elements - The elements to divide in clusters.
Method Detail

cluster

public java.util.Collection<K> cluster(int index)
Returns the elements of one of the clusters.

Parameters:
index - The cluster index of the cluster your are interested in (the first cluster has the index 0, while the last has the index given by nbClusters - 1.
Returns:
A vector holding the elements of the requested cluster.

nbClusters

public int nbClusters()
Returns the number of clusters.

Returns:
The number of clusters in the cluster set computed by this class.


Copyright © 2004,2005 Jean-Marc François.