org.encog.ml.kmeans
Class KMeansCluster

java.lang.Object
  extended by org.encog.ml.kmeans.KMeansCluster
All Implemented Interfaces:
MLCluster

public class KMeansCluster
extends Object
implements MLCluster

Holds a cluster of MLData items that have been clustered by the KMeansClustering class.


Constructor Summary
KMeansCluster()
           
 
Method Summary
 void add(MLData pair)
          Add to the cluster.
 void calcSumOfSquares()
          Calculate the sum of squares.
 MLDataSet createDataSet()
          Create a dataset from the clustered data.
 MLData get(int pos)
          Get the specified data item by index.
 Centroid getCentroid()
           
 List<MLData> getData()
          
 double getSumSqr()
           
 void remove(MLData pair)
          Remove the specified item.
 void setCentroid(Centroid c)
          Set the centroid.
 int size()
          
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

KMeansCluster

public KMeansCluster()
Method Detail

add

public final void add(MLData pair)
Add to the cluster.

Specified by:
add in interface MLCluster
Parameters:
pair - The pair to add.

calcSumOfSquares

public final void calcSumOfSquares()
Calculate the sum of squares.


createDataSet

public final MLDataSet createDataSet()
Create a dataset from the clustered data.

Specified by:
createDataSet in interface MLCluster
Returns:
The dataset.

get

public final MLData get(int pos)
Get the specified data item by index.

Specified by:
get in interface MLCluster
Parameters:
pos - The index of the data item to get.
Returns:
The data item.

getCentroid

public final Centroid getCentroid()
Returns:
The centroid.

getData

public final List<MLData> getData()

Specified by:
getData in interface MLCluster
Returns:
The data in this cluster.

getSumSqr

public final double getSumSqr()
Returns:
The sum of squares.

remove

public final void remove(MLData pair)
Remove the specified item.

Specified by:
remove in interface MLCluster
Parameters:
pair - The item to remove.

setCentroid

public final void setCentroid(Centroid c)
Set the centroid.

Parameters:
c - The new centroid.

size

public final int size()

Specified by:
size in interface MLCluster
Returns:
The number of items.


Copyright © 2011. All Rights Reserved.