org.carrot2.filter.trc.carrot.filter.cluster.rough.clustering
Class AbstractKMeansAlgorithm

java.lang.Object
  extended by org.carrot2.filter.trc.carrot.filter.cluster.rough.clustering.AbstractKMeansAlgorithm
Direct Known Subclasses:
SoftKMeansAlgorithm

public abstract class AbstractKMeansAlgorithm
extends Object

A boiler-plate implementation of generic K-Means algorithm. Soft (fuzzy) membership allowed.


Field Summary
protected static Timer timer
           
 
Constructor Summary
AbstractKMeansAlgorithm()
           
 
Method Summary
protected abstract  void calculateClusterRepresentation()
          Calculate representation for cluster (usually in form of a centroid)
 void cluster()
          Execute clustering
protected abstract  void doClustering()
          Main step in clustering algorithm : assign objects to clusters
abstract  double[][] getClusterRepresentation()
          Return cluster's representation vector as a matrix Rows = vectors
abstract  int[][] getClusters()
          Return clusters as a form of binary matrix (n rows-objects * k colums-clusters) Cell[i,j] = 1 iff object i belongs to cluster j
abstract  double[][] getMembership()
          Return cluster membership matrix Colums = cluster membership vector
abstract  int[] getUnclassified()
          Return indices of unclassified objects
abstract  double[] getUnclassifiedCentroid()
          Return centroid of unclassified objects
abstract  double[] getUnclassifiedMembership()
          Return membership vector for unclassified objects; Length of vector = number of unclassified object
protected abstract  void prepareInitialClusters()
          Prepare initial clusters
protected abstract  boolean stopCondition()
          Stop condition for algorithm
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

timer

protected static final Timer timer
Constructor Detail

AbstractKMeansAlgorithm

public AbstractKMeansAlgorithm()
Method Detail

prepareInitialClusters

protected abstract void prepareInitialClusters()
Prepare initial clusters


doClustering

protected abstract void doClustering()
Main step in clustering algorithm : assign objects to clusters


calculateClusterRepresentation

protected abstract void calculateClusterRepresentation()
Calculate representation for cluster (usually in form of a centroid)


stopCondition

protected abstract boolean stopCondition()
Stop condition for algorithm

Returns:
true when algorithm should stop processing

cluster

public void cluster()
Execute clustering


getClusters

public abstract int[][] getClusters()
Return clusters as a form of binary matrix (n rows-objects * k colums-clusters) Cell[i,j] = 1 iff object i belongs to cluster j


getMembership

public abstract double[][] getMembership()
Return cluster membership matrix Colums = cluster membership vector


getClusterRepresentation

public abstract double[][] getClusterRepresentation()
Return cluster's representation vector as a matrix Rows = vectors


getUnclassified

public abstract int[] getUnclassified()
Return indices of unclassified objects


getUnclassifiedCentroid

public abstract double[] getUnclassifiedCentroid()
Return centroid of unclassified objects


getUnclassifiedMembership

public abstract double[] getUnclassifiedMembership()
Return membership vector for unclassified objects; Length of vector = number of unclassified object



Copyright (c) Dawid Weiss, Stanislaw Osinski