infomat.algorithms.grouping
Class KMeans

java.lang.Object
  extended by infomat.algorithms.grouping.GroupingAlgorithm
      extended by infomat.algorithms.grouping.KMeans
All Implemented Interfaces:
NeedsISimilarity, HasProperties, UniqueIdentifiable

public class KMeans
extends GroupingAlgorithm
implements NeedsISimilarity

KMeans


Field Summary
static int kmeansClusteringNumber
           
private  ISimilarity similarity
           
 
Fields inherited from class infomat.algorithms.grouping.GroupingAlgorithm
identifier, printGroupSizesInIterations, properties
 
Constructor Summary
KMeans()
           
KMeans(ISimilarity similarity)
           
KMeans(ISimilarity similarity, Properties properties)
           
KMeans(Properties properties)
           
 
Method Summary
 IObjectGrouping cluster(IObjectGroup iogroup)
          Clusters the IObjectGroup.
private  IObjectGrouping cluster(IObjectGroup iogroup, DenseISimilarity similarity)
           
private  IObjectGrouping cluster(IObjectGroup iogroup, SparseISimilarity similarity)
           
private  IObjectGrouping clusterCartesian(IObjectGroup iogroup, SparseCartesianSimilarity similarity)
           
 java.lang.String getAlgorithmName()
           
 Properties getDefaultProperties()
           
 java.lang.String getInfoString()
           
 Properties getProperties()
           
 java.lang.Object getPropertyValue(java.lang.String name)
           
 java.util.Vector getPropertyVector()
           
 ISimilarity getSimilarity()
           
 UniqueIdentifier getUniqueIdentifier()
           
private  java.util.Vector<IObjectGroup> init(IObjectGroup iogroup)
           
 IObjectGrouping oneIter(IObjectGrouping iogrouping, SparseISimilarity similarity)
          Implemented for the "Clustering" course of GSLT 2008.
 void setProperties(Properties properties)
           
 void setProperty(java.lang.String name, java.lang.Object value)
           
 void setSimilarity(ISimilarity similarity)
           
 void setUniqueIdentifier(UniqueIdentifier uniqueIdentifier)
           
 
Methods inherited from class infomat.algorithms.grouping.GroupingAlgorithm
printGroup, printGroupSizes
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

kmeansClusteringNumber

public static int kmeansClusteringNumber

similarity

private ISimilarity similarity
Constructor Detail

KMeans

public KMeans()

KMeans

public KMeans(Properties properties)

KMeans

public KMeans(ISimilarity similarity)

KMeans

public KMeans(ISimilarity similarity,
              Properties properties)
Method Detail

getDefaultProperties

public Properties getDefaultProperties()
Specified by:
getDefaultProperties in interface HasProperties

setSimilarity

public void setSimilarity(ISimilarity similarity)
Specified by:
setSimilarity in interface NeedsISimilarity

getSimilarity

public ISimilarity getSimilarity()

cluster

public IObjectGrouping cluster(IObjectGroup iogroup)
Description copied from class: GroupingAlgorithm
Clusters the IObjectGroup. Does not store the result.

Specified by:
cluster in class GroupingAlgorithm

cluster

private IObjectGrouping cluster(IObjectGroup iogroup,
                                SparseISimilarity similarity)

clusterCartesian

private IObjectGrouping clusterCartesian(IObjectGroup iogroup,
                                         SparseCartesianSimilarity similarity)

cluster

private IObjectGrouping cluster(IObjectGroup iogroup,
                                DenseISimilarity similarity)

init

private java.util.Vector<IObjectGroup> init(IObjectGroup iogroup)

getInfoString

public java.lang.String getInfoString()
Specified by:
getInfoString in class GroupingAlgorithm

getAlgorithmName

public java.lang.String getAlgorithmName()
Specified by:
getAlgorithmName in class GroupingAlgorithm

getPropertyVector

public java.util.Vector getPropertyVector()
Specified by:
getPropertyVector in class GroupingAlgorithm

getPropertyValue

public java.lang.Object getPropertyValue(java.lang.String name)
Specified by:
getPropertyValue in interface HasProperties

setProperty

public void setProperty(java.lang.String name,
                        java.lang.Object value)
                 throws PropertyNotFoundException
Specified by:
setProperty in interface HasProperties
Throws:
PropertyNotFoundException

getProperties

public Properties getProperties()
Specified by:
getProperties in interface HasProperties

setProperties

public void setProperties(Properties properties)
Specified by:
setProperties in interface HasProperties

getUniqueIdentifier

public UniqueIdentifier getUniqueIdentifier()
Specified by:
getUniqueIdentifier in interface UniqueIdentifiable

setUniqueIdentifier

public void setUniqueIdentifier(UniqueIdentifier uniqueIdentifier)
Specified by:
setUniqueIdentifier in interface UniqueIdentifiable

oneIter

public IObjectGrouping oneIter(IObjectGrouping iogrouping,
                               SparseISimilarity similarity)
Implemented for the "Clustering" course of GSLT 2008. Will not be kept up to date. Runs one iteration of the K-Means algorithm using the specified similarity, starting with the specified IObjectGrouping. Returns a new grouping representing the new state.