org.encog.ml.kmeans
Class KMeansClustering

java.lang.Object
  extended by org.encog.ml.kmeans.KMeansClustering
All Implemented Interfaces:
MLClustering, MLMethod

public class KMeansClustering
extends Object
implements MLClustering

This class performs a basic K-Means clustering. This class can be used on either supervised or unsupervised data. For supervised data, the ideal values will be ignored. http://en.wikipedia.org/wiki/Kmeans


Constructor Summary
KMeansClustering(int k, MLDataSet theSet)
          Construct the K-Means object.
 
Method Summary
static double calculateEuclideanDistance(Centroid c, MLData data)
          Calculate the euclidean distance between a centroid and data.
 MLCluster[] getClusters()
           
 double getWCSS()
           
 void iteration()
          Perform a single training iteration.
 void iteration(int count)
          The number of iterations to perform.
 int numClusters()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KMeansClustering

public KMeansClustering(int k,
                        MLDataSet theSet)
Construct the K-Means object.

Parameters:
k - The number of clusters to use.
theSet - The dataset to cluster.
Method Detail

calculateEuclideanDistance

public static double calculateEuclideanDistance(Centroid c,
                                                MLData data)
Calculate the euclidean distance between a centroid and data.

Parameters:
c - The centroid to use.
data - The data to use.
Returns:
The distance.

getClusters

public final MLCluster[] getClusters()
Specified by:
getClusters in interface MLClustering
Returns:
The clusters.

getWCSS

public final double getWCSS()
Returns:
Within-cluster sum of squares (WCSS).

iteration

public final void iteration()
Perform a single training iteration.

Specified by:
iteration in interface MLClustering

iteration

public final void iteration(int count)
The number of iterations to perform.

Specified by:
iteration in interface MLClustering
Parameters:
count - The count of iterations.

numClusters

public final int numClusters()
Specified by:
numClusters in interface MLClustering
Returns:
The number of clusters.


Copyright © 2011. All Rights Reserved.