org.openimaj.ml.clustering
Interface Cluster<T,DATATYPE>

Type Parameters:
T - The type which can be read and written by this cluster
DATATYPE - the primative datatype which represents a centroid of this cluster
All Superinterfaces:
Readable, ReadableASCII, ReadableBinary, ReadWriteable, ReadWriteableCluster, Writeable, WriteableASCII, WriteableBinary
All Known Implementing Classes:
ClusterLimitedIntRAC, FastByteKMeansCluster, FastDoubleKMeansCluster, FastFloatKMeansCluster, FastIntKMeansCluster, FastLongKMeansCluster, FastShortKMeansCluster, HByteKMeans, HDoubleKMeans, HFloatKMeans, HIntKMeans, HLongKMeans, HShortKMeans, IntRAC, IntRandomForest, RandomByteCluster, RandomDoubleCluster, RandomFloatCluster, RandomIntCluster, RandomLongCluster, RandomSetByteCluster, RandomSetDoubleCluster, RandomSetFloatCluster, RandomSetIntCluster, RandomSetLongCluster, RandomSetShortCluster, RandomShortCluster

public interface Cluster<T,DATATYPE>
extends ReadWriteableCluster

Author:
Jonathon Hare , Sina Samangooei

Field Summary
 
Fields inherited from interface org.openimaj.ml.clustering.ReadWriteableCluster
CLUSTER_HEADER
 
Method Summary
 DATATYPE[] getClusters()
          Utility function useful for testing.
 int getNDims()
          Get data dimensionality
 int getNumberClusters()
          Get the number of centers K
 void optimize(boolean exact)
          Prepare the cluster for pushing
 int push_one(DATATYPE data)
          Project one datum to clusters
 int[] push_one(DATATYPE data, int numNeighbours)
          Project one datum to clusters
 int[] push(DATATYPE[] data)
          Project data to clusters.
 int[][] push(DATATYPE[] data, int numNeighbours)
          Project data to clusters.
 int train(DataSource<DATATYPE> data)
          Train clusters with a data source, can be more efficient
 int train(DATATYPE[] data)
          Train clusters
 
Methods inherited from interface org.openimaj.io.ReadableASCII
asciiHeader, readASCII
 
Methods inherited from interface org.openimaj.io.ReadableBinary
binaryHeader, readBinary
 
Methods inherited from interface org.openimaj.io.WriteableASCII
asciiHeader, writeASCII
 
Methods inherited from interface org.openimaj.io.WriteableBinary
binaryHeader, writeBinary
 

Method Detail

train

int train(DATATYPE[] data)
Train clusters

Parameters:
data - data.
Returns:
-1 if an overflow may have occurred.

train

int train(DataSource<DATATYPE> data)
Train clusters with a data source, can be more efficient

Parameters:
data - data.
Returns:
-1 if an overflow may have occurred.

getNDims

int getNDims()
Get data dimensionality

Returns:
data dimensionality.

getNumberClusters

int getNumberClusters()
Get the number of centers K

Returns:
number of centers K.

optimize

void optimize(boolean exact)
Prepare the cluster for pushing

Parameters:
exact - TODO

push

int[] push(DATATYPE[] data)
Project data to clusters.

Parameters:
data - data.
Returns:
The cluster indecies which the data was pushed to

push_one

int push_one(DATATYPE data)
Project one datum to clusters

Parameters:
data - datum to project.
Returns:
the cluster index.

push

int[][] push(DATATYPE[] data,
             int numNeighbours)
Project data to clusters.

Parameters:
data - data.
numNeighbours - number of neighboring clusters to return also. When set to 1 this is equivalent to Cluster#push(DATATYPE[])
Returns:
The centers and neighbours for the data

push_one

int[] push_one(DATATYPE data,
               int numNeighbours)
Project one datum to clusters

Parameters:
data - datum to project.
numNeighbours - number of neighbouring clusters to return also. When set to 1 this is equivalent to push_one(Object)
Returns:
the cluster index and the index of neighbours.

getClusters

DATATYPE[] getClusters()
Utility function useful for testing. The cluster must return something it considers to be it's cluster centroids. Different types of cluster will clearly return different data types here. This might (and often will be) null given that it often might not make any sense. It is a sign of a good cluster that can produce a set of centroids for itself.

Returns:
The cluster's centroids.


Copyright © 2011 The University of Southampton. All Rights Reserved.