at.tuwien.ifs.somtoolbox.visualization.clustering
Class WardsLinkageTreeBuilderAll

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.visualization.clustering.TreeBuilder
      extended by at.tuwien.ifs.somtoolbox.visualization.clustering.AbstractWardsLinkageTreeBuilder
          extended by at.tuwien.ifs.somtoolbox.visualization.clustering.WardsLinkageTreeBuilderAll

public class WardsLinkageTreeBuilderAll
extends AbstractWardsLinkageTreeBuilder

Class to create Clustering trees with the Ward's Linkage algorithm. This class is not compatible with mnemonic SOMs (and probably also not compatible with hierarchical SOMs)

Version:
$Id: WardsLinkageTreeBuilderAll.java 3938 2010-11-17 15:15:25Z mayer $
Author:
Angela Roiger

Field Summary
private  boolean lazyUpdate
           
 
Fields inherited from class at.tuwien.ifs.somtoolbox.visualization.clustering.TreeBuilder
level, monitor, progress, progressWriter
 
Constructor Summary
WardsLinkageTreeBuilderAll()
          Only use this constructor if you suspect WardsLinkageTreeBuilderAll(true) does not return a correct clustering
WardsLinkageTreeBuilderAll(boolean lazyUpdate)
          Only use false if you suspect WardsLinkageTreeBuilderAll(true) does not return a correct clustering.
 
Method Summary
private  TreeSet<NodeDistance> calculateInitialDistances(GeneralUnitPNode[][] units)
          Calculates the initial distances from each To each other unit where there is not yet a distance calculated.
 ClusteringTree createTree(GeneralUnitPNode[][] units)
          Calculation of the Clustering.
 String getClusteringAlgName()
           
 
Methods inherited from class at.tuwien.ifs.somtoolbox.visualization.clustering.AbstractWardsLinkageTreeBuilder
calcESSincrease
 
Methods inherited from class at.tuwien.ifs.somtoolbox.visualization.clustering.TreeBuilder
allowAborting, finishMonitor, incrementMonitor, resetMonitor, setMonitor
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

lazyUpdate

private boolean lazyUpdate
Constructor Detail

WardsLinkageTreeBuilderAll

public WardsLinkageTreeBuilderAll()
Only use this constructor if you suspect WardsLinkageTreeBuilderAll(true) does not return a correct clustering


WardsLinkageTreeBuilderAll

public WardsLinkageTreeBuilderAll(boolean lazyUpdate)
Only use false if you suspect WardsLinkageTreeBuilderAll(true) does not return a correct clustering. The new Update function only recalculates the distance values before merging two clusters. This way a lot less calculations have to be made, reducing the complexity from n^3 to n^2.

Parameters:
lazyUpdate - true to use faster update function
Method Detail

createTree

public ClusteringTree createTree(GeneralUnitPNode[][] units)
                          throws ClusteringAbortedException
Calculation of the Clustering. This code is only compatible with rectangular, non hierarchical SOMs!

Specified by:
createTree in class TreeBuilder
Parameters:
units - the GeneralUnitPNode Array containing all the units of the SOM
Returns:
the ClusteringTree (i.e. the top node of the tree)
Throws:
ClusteringAbortedException

calculateInitialDistances

private TreeSet<NodeDistance> calculateInitialDistances(GeneralUnitPNode[][] units)
                                                 throws ClusteringAbortedException
Calculates the initial distances from each To each other unit where there is not yet a distance calculated. This results in n^2/2 distance calculations and the same amount of created objects. Can take long in case of large maps. This code is only compatible with rectangular, non hierarchical SOMs!

Parameters:
units - A GeneralUnitPNode[][] containing the Units of the som
Returns:
a TreeSet of NodeDistances containing the distances between the units starting with the smallest.
Throws:
ClusteringAbortedException

getClusteringAlgName

public String getClusteringAlgName()
Specified by:
getClusteringAlgName in class TreeBuilder