at.tuwien.ifs.somtoolbox.reportgenerator.output
Class SOMDescriptionHTML

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.reportgenerator.output.SOMDescriptionHTML
Direct Known Subclasses:
SOMGGDescriptionHTML

public class SOMDescriptionHTML
extends Object

this class is the base class for generating the part of the reports that describes a SOM. it creates output containing information about basic properties of the learning process and the created SOM, as well as about the distribution of the input data on this SOM. This class implements the description of a standard GrowingSOM, and is subtyped for creating proper description of other SOMs.

Version:
$Id: SOMDescriptionHTML.java 3914 2010-11-04 14:28:18Z mayer $
Author:
Sebastian Skritek (0226286, Sebastian.Skritek@gmx.at), Martin Waitzbauer (0226025)

Field Summary
protected  DatasetInformation dataset
          contains all available information about the input data
private  EditableReportProperties EP
           
private  String imgDir
          the directory to which the created images shall be saved
static String imgSubdir
          the name of the directory where the image shall be saved - relative to the given baseDir path in the constructor
private  QMContainer qm
          Quality Measure Container
(package private)  ArrayList qualifiers
          ArrayList for quality measures
private  SemanticInterpreterGrid sGrid
          The SemanticGrid used for Semantic Interpretation of Quality Measures & Classes
protected  TestRunResult testrun
          encapsulates all available information about the testrun - just ask
protected  ReportFileWriter writer
          all strings that shall be in the output are sent to this object
 
Constructor Summary
SOMDescriptionHTML(ReportFileWriter writer, DatasetInformation dataset, TestRunResult testrun, String baseDir, EditableReportProperties EP)
          creates a new instance
 
Method Summary
private  String classDistInCluster(int level, int numbInputs)
          returns a formatted string that contains information about the classes present in the given cluster
 String createClusterReport(int clusterlevel)
          Creates a semantic Report on the Given Clusterlevel
private  String getInputCoords(InputQEContainer value)
          formats a list of input vectors for use in the quantization error list the created format is: "on input vector(s) "id" on unit at[x,y], "id2" on unit at [x2,y2],...
protected  String getUnitCoords(UnitQEContainer value)
          formats a list of units for use in the quantization error list the created format is "on unit(s) at [x,y] - z vectors mapped, [x2,y2] - z2 vectors mapped, ...
 void includeAdditionalVisualizations()
           
protected  void printClusterInfos()
          this function prints some information about the possible clusters that can be found on the SOM.
protected  int[] printClusterNode(ClusterNode node, int parentLevel, int boundary, int depth, int[] nodeInfos)
          outputs the subtree in one node of the cluster tree we add to the report.
 void printDataDistribution()
           
protected  void printDistributionDetailTable(Hashtable<String,Vector<InputDatum>> lookup, boolean classInformationAvailable)
          creates and outputs one out of two possible tables the first possible table:
the first table contains for each unit only the number of input vectors mapped to it, and a pie chart image of the class distribution within this unit.
protected  void printLearningRate()
          prints the type of how the learning rate changes, and the initial learning rate (taken from the MySOMMapDescription, provided by the TestRunResult object)
protected  void printMapLayout(boolean classInfoAvailable)
          Creates output describing the layout of the created som this includes tables showing the distribution of the input vectors of the som, as well as (if available) the distribution of the classes on the som.
protected  void printMetricUsed()
          prints the metric used to calculate the distance between two vectors (taken from the MySOMMapDescription, provided by the TestRunResult object)
protected  void printNeighbourhoodFunction()
          Prints the neighbourhood type and the initial neighbourhood range used for training (taken from the MySOMMapDescription, provided by the TestRunResult object)
protected  void printNumberOfIterations()
          prints the number of iterations used in the training process (taken from the MySOMMapDescription, provided by the TestRunResult object)
 void printQualityMeasureReport()
          Prints a report opn all selected qualitymeasures
protected  void printRandomSeed()
          prints the random seed used for the initialization of the SOM (taken from the MySOMMapDescription, provided by the TestRunResult object)
 void printRegionalOverviewReport()
          Creates a semantic Report on teh SOM
protected  void printSigma()
          prints the value of the sigma, as one of the learning parameters (taken from the SOMProperty object)
 void printSOMDescription()
          initiates the creation of the output Creates the description of the SOM and training properties
protected  void printSOMDimensions()
          Prints the dimension of the SOM, that is the number of units in x and y direction (for Growing SOM this is enough) (taken from the MySOMMapDescription, provided by the TestRunResult object)
protected  void printSOMProperties()
          prints a list of properties describing the training process and the generated SOM this list contains besides others: type and topology of SOM dimensions of the som different training parameters neighbourhood function ...
protected  void printTau()
          prints the value of the tau, as one of the learning parameters (taken from the SOMProperty object)
protected  void printTopographicErrorReport()
          adds information about the topographic error on the map to the report beside a list containing the topographic error of the map and the min/max top.
protected  void printTopologyOfSOM()
          Prints the topology and type of the SOM (unit shape, type of SOM, ...) the value is dependent of the value keyTopoology specified by the TestRunResult Object
protected  void printTrainingDate()
          if available, prints the time and date of the training (taken from the MySOMMapDescription, provided by the TestRunResult object)
protected  void printTrainingTime()
          if available, prints the time the training of the SOM needed (taken from the MySOMMapDescription, provided by the TestRunResult object)
 void showSDHSwitchBox(int maxs, int step)
          Generate teh sdh switch box for all possible values of s: create pics, and bind them to the page
 void showTopographicProductSwitchBox(int maxs, int step)
          Generate teh TopographicProduct switch box for all possible values of s: create pics, and bind them to the page
 void showTrustworthyNessSwitchBox(int maxs, int step)
          Generate teh TrustworthyNessImages switch box for all possible values of s: create pics, and bind them to the page
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

imgSubdir

public static final String imgSubdir
the name of the directory where the image shall be saved - relative to the given baseDir path in the constructor

See Also:
Constant Field Values

qualifiers

ArrayList qualifiers
ArrayList for quality measures


writer

protected ReportFileWriter writer
all strings that shall be in the output are sent to this object


testrun

protected TestRunResult testrun
encapsulates all available information about the testrun - just ask


dataset

protected DatasetInformation dataset
contains all available information about the input data


qm

private QMContainer qm
Quality Measure Container


imgDir

private String imgDir
the directory to which the created images shall be saved


sGrid

private SemanticInterpreterGrid sGrid
The SemanticGrid used for Semantic Interpretation of Quality Measures & Classes


EP

private EditableReportProperties EP
Constructor Detail

SOMDescriptionHTML

public SOMDescriptionHTML(ReportFileWriter writer,
                          DatasetInformation dataset,
                          TestRunResult testrun,
                          String baseDir,
                          EditableReportProperties EP)
creates a new instance

Parameters:
writer - object that handles how the created string is written to a file
dataset - object storing information about input data
testrun - object storing information about testrun results
Method Detail

printSOMDescription

public void printSOMDescription()
initiates the creation of the output Creates the description of the SOM and training properties


printSOMProperties

protected void printSOMProperties()
prints a list of properties describing the training process and the generated SOM this list contains besides others:


printTopologyOfSOM

protected void printTopologyOfSOM()
Prints the topology and type of the SOM (unit shape, type of SOM, ...) the value is dependent of the value keyTopoology specified by the TestRunResult Object


printSOMDimensions

protected void printSOMDimensions()
Prints the dimension of the SOM, that is the number of units in x and y direction (for Growing SOM this is enough) (taken from the MySOMMapDescription, provided by the TestRunResult object)


printSigma

protected void printSigma()
prints the value of the sigma, as one of the learning parameters (taken from the SOMProperty object)


printTau

protected void printTau()
prints the value of the tau, as one of the learning parameters (taken from the SOMProperty object)


printMetricUsed

protected void printMetricUsed()
prints the metric used to calculate the distance between two vectors (taken from the MySOMMapDescription, provided by the TestRunResult object)


printNumberOfIterations

protected void printNumberOfIterations()
prints the number of iterations used in the training process (taken from the MySOMMapDescription, provided by the TestRunResult object)


printTrainingDate

protected void printTrainingDate()
if available, prints the time and date of the training (taken from the MySOMMapDescription, provided by the TestRunResult object)


printTrainingTime

protected void printTrainingTime()
if available, prints the time the training of the SOM needed (taken from the MySOMMapDescription, provided by the TestRunResult object)


printRandomSeed

protected void printRandomSeed()
prints the random seed used for the initialization of the SOM (taken from the MySOMMapDescription, provided by the TestRunResult object)


printNeighbourhoodFunction

protected void printNeighbourhoodFunction()
Prints the neighbourhood type and the initial neighbourhood range used for training (taken from the MySOMMapDescription, provided by the TestRunResult object)


printLearningRate

protected void printLearningRate()
prints the type of how the learning rate changes, and the initial learning rate (taken from the MySOMMapDescription, provided by the TestRunResult object)


printDataDistribution

public void printDataDistribution()

printMapLayout

protected void printMapLayout(boolean classInfoAvailable)
Creates output describing the layout of the created som this includes tables showing the distribution of the input vectors of the som, as well as (if available) the distribution of the classes on the som. In addition, if the user selected input items for getting their position on the trained SOM, this information is also created in this function.

Parameters:
classInfoAvailable - true if class information are available (and therefore a piechart should be inserted, false otherwise)

printDistributionDetailTable

protected void printDistributionDetailTable(Hashtable<String,Vector<InputDatum>> lookup,
                                            boolean classInformationAvailable)
creates and outputs one out of two possible tables the first possible table:
the first table contains for each unit only the number of input vectors mapped to it, and a pie chart image of the class distribution within this unit. (lookup == null) If no class information is available, this table is not created

The second table additionally contains the ids of input vectors selected by the user within the unit they are mapped to. Therefore lookup must be a hashtable that contains for each unit (key = "x_y") a list of InputDatum objects specifying the input elements mapped to this unit. If for a key there's no list, then nothing is mapped to this unit. if no class information is available, the table does not contain the number of input vectors mapped to each unit

Parameters:
lookup - a hashtable with the content specified above to map input vectors to units
classInformationAvailable - true if class information (and therefore pie chart diagrams for the units are available, false otherwise

printTopographicErrorReport

protected void printTopographicErrorReport()
adds information about the topographic error on the map to the report beside a list containing the topographic error of the map and the min/max top. error on the units, an image visualizing the distribution of the topographic error on the map is output.


getUnitCoords

protected String getUnitCoords(UnitQEContainer value)
formats a list of units for use in the quantization error list the created format is "on unit(s) at [x,y] - z vectors mapped, [x2,y2] - z2 vectors mapped, ...

Parameters:
value - the container from which the information about the number ob units can be picked
Returns:
A string formatted as stated above

getInputCoords

private String getInputCoords(InputQEContainer value)
formats a list of input vectors for use in the quantization error list the created format is: "on input vector(s) "id" on unit at[x,y], "id2" on unit at [x2,y2],...

Parameters:
value - a container storing all information required to create the output
Returns:
a string formatted as stated above

printClusterInfos

protected void printClusterInfos()
this function prints some information about the possible clusters that can be found on the SOM. It tries to find some good, or stable clusters, using a simple heuristic. For a description of this, please see TestRunResult.getStableClusters2. (it works at least quite well with the iris and the animal dataset - more test tbd. as maximal number of clusters, the number of units on the SOM is choosen. Besides the tree of available clusters, the ten "best" (according to this heuristic clusters are listed and visualized. Also the image of the UMatrix of the SOM is created and attached to the report !!! I also wanted to do some tests with the k-nearest neighbour clustering, but couldn't find any implementation of it. !!!


classDistInCluster

private String classDistInCluster(int level,
                                  int numbInputs)
returns a formatted string that contains information about the classes present in the given cluster

Parameters:
level - the level of the cluster of interest
numbInputs - the number of input vectors mapped to this cluster
Returns:
a formatted string containing some information about this cluster

printClusterNode

protected int[] printClusterNode(ClusterNode node,
                                 int parentLevel,
                                 int boundary,
                                 int depth,
                                 int[] nodeInfos)
outputs the subtree in one node of the cluster tree we add to the report. this node is collapsed by default. the cluster tree is added as unorded list with sub-items to the report. This functions creates the subtree of this cluster tree in one node, by calling itself recursivley. The subtree is collapsed by default.

Parameters:
node - the node in the cluster tree, whose subtree shall be created
parentLevel - the number of the level of the parent node - needed to calculate the number of new clusters this cluster remains unchanged
boundary - the maximal level, where the recursion shall stop
depth - the depth of this node in the tree, seen from the root
nodeInfos - WARNING!!! this array contains two different information: at index 0, the maximal number of new clusters a cluster "survived" is saved. at index 1, the corresponding level is saved. from index i = 2 to n+1 , the depth of the clusternode of level i is saved.
Returns:
the array nodeInfos (see above - last parameter), containing the correct values for the subrtree rooted in "node".

showSDHSwitchBox

public void showSDHSwitchBox(int maxs,
                             int step)
Generate teh sdh switch box for all possible values of s: create pics, and bind them to the page


showTrustworthyNessSwitchBox

public void showTrustworthyNessSwitchBox(int maxs,
                                         int step)
Generate teh TrustworthyNessImages switch box for all possible values of s: create pics, and bind them to the page


showTopographicProductSwitchBox

public void showTopographicProductSwitchBox(int maxs,
                                            int step)
Generate teh TopographicProduct switch box for all possible values of s: create pics, and bind them to the page


printRegionalOverviewReport

public void printRegionalOverviewReport()
Creates a semantic Report on teh SOM


createClusterReport

public String createClusterReport(int clusterlevel)
Creates a semantic Report on the Given Clusterlevel

Parameters:
clusterlevel - the clusterlevel
Returns:
the report

printQualityMeasureReport

public void printQualityMeasureReport()
Prints a report opn all selected qualitymeasures


includeAdditionalVisualizations

public void includeAdditionalVisualizations()