at.tuwien.ifs.somtoolbox.reportgenerator
Class TestRunResult

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.reportgenerator.TestRunResult
Direct Known Subclasses:
GGSOMTestRunResult

public class TestRunResult
extends Object

Version:
$Id: TestRunResult.java 3800 2010-09-13 14:03:43Z frank $
Author:
Sebastian Skritek (0226286, Sebastian.Skritek@gmx.at), Martin Waitzbauer (0226025)

Field Summary
private  int[][][] classDistribution
           
private  ClusteringTree clusterTree
           
 DatasetInformation datasetInfo
           
private  String dwFilePath
           
 EntropyVisualizer entropy_visualizer
           
private  SOMLibFormatInputReader inputReader
           
private  MySOMLibMapDescription mapDescription
           
private  String mapFilePath
           
private  MetroMapVisualizer metroVis
           
private  String propertyFilePath
           
private  SOMProperties props
           
 QMContainer QMContainer
           
private  int runId
           
private  SmoothedDataHistograms sdh_visualizer
           
private  GrowingSOM som
           
private  CommonSOMViewerStateData state
           
private  HashMap<String,String> texts
           
private  ThematicClassMapVisualizer thematic_visualizer
           
private  TopographicProductVisualizer topographicproduct_visualizer
           
private  TrustwothinessVisualizer trustworthyness_visualizer
           
private  int type
           
private  String unitFilePath
           
protected  SharedSOMVisualisationData visData
           
private  String weightFilePath
           
 
Constructor Summary
TestRunResult(DatasetInformation datasetInfo, String mapFilePath, String propertyFilePath, String unitFilePath, String weightFilePath, String dwFilePath, int runId, int type)
          Constructor without Trained SOM, e.g.
TestRunResult(DatasetInformation datasetInfo, String mapFilePath, String propertyFilePath, String unitFilePath, String weightFilePath, String dwFilePath, int runId, int type, CommonSOMViewerStateData state)
          Constructor for an already trained SOM & State, e.g.
 
Method Summary
 boolean createClassDistributionImage(String outputDir, String filename, int ClassID)
          UPDATE creates a jpg showing the class distribtion on the trained SOM The jpg is saved to the output dir with the following name: run_RUNID_FILENAME
 boolean createDistortionImage(String outputDir, String filename, int unitScale, int index)
          create the Distortion visualization of the SOM the image is saved under the given path (which is neither checked nor created) under the given name, only the prefix run_runId_ is added to the filename.
 boolean createDMatrixImage(String outputDir, String filename, int unitScale)
          Creates a D-Matrix Image
 boolean createEntropyImage(String outputDir, String filename, int ClassID)
          Creates an Entropy Image, and saves it at the given Location.
 boolean createFlowBorderLineImage(String outputDir, String filename, int unitScale)
          create the Flow & BorderLine visualization of the SOM the image is saved under the given path (which is neither checked nor created) under the given name, only the prefix run_runId_ is added to the filename.
 boolean createInputDistributionImage(String outputDir, String filename)
          creates a visualization of the distribution of the input data on the SOM the image is saved under the given path (which is neither checked nor created) under the given name, only the prefix run_runId_ is added to the filename.
 boolean createIntrinsicDistanceImage(String outputDir, String filename)
          Creates a Intrinsic Distance Image
 void createPaletteImage(String outputDir, String filename, String palName)
          Creates a Palette Image on the color palette on the specified Index
FIXME: move this way from this class
 void createPieChartImages(String outputDir)
          creates for each unit having at least one input item mapped to it an image of the class distribution the images are stored in an subdirectory of the specified directory (which is neither checked nor created) named "pieCharts_runId".
 boolean createQuantizationErrorImage(String outputDir, String filename, int variant)
          creates an image visualizing the quantization error of this SOM the image is saved under the given path and name, although a prefix run_runId_ is added to the image name
 void createSDHImages(String outputDir, String filename, int unitScale, boolean Latex, int step)
          create a SDH visualization of the SOM the image is saved under the given path (which is neither checked nor created) under the given name, only the prefix run_runId_ is added to the filename.
 boolean createSilouetteImage(String outputDir, String filename, int variant)
          Creates a Silhouette image
 boolean createSingleMetroMapComponentImage(String outputDir, String filename, int component)
          Creates a SingleMetroMapComponentImage with the given component index.
 boolean createTopographicErrorImage(String outputDir, String filename)
          creates an image visualizing the topographic error of this SOM the image is saved under the given path and name, although a prefix run_runId_ is added to the image name
 void createTopographicProductImages(String outputDir, String filename, int unitScale, boolean Latex, int step)
          create a TopographicProduct visualization of the SOM the image is saved under the given path (which is neither checked nor created) under the given name, only the prefix run_runId_ is added to the filename.
 void createTrustworthyNessImages(String outputDir, String filename, int unitScale, boolean Latex, int step)
          create TrustWortyNess pictures of the SOM the image is saved under the given path (which is neither checked nor created) under the given name, only the prefix run_runId_ is added to the filename.
 boolean createUDMatrixImage(String outputDir, String filename, int unitScale, int index)
          create the U-D-Matrix visualization of the SOM the image is saved under the given path (which is neither checked nor created) under the given name, only the prefix run_runId_ is added to the filename.
 void fillQMContainer()
          Fills the QMContainer Object with all quality Measures that were specified in the report
 ArrayList<int[]> getAllUnitsContainingClass(int index)
           
 int[][][] getClassDistribution()
          Returns the Class Distribution array for each Unit of the Map
 int[] getClassDistributionInCluster(int clusterLevel)
          returns for the given cluster, how many input elements of the different classses are mapped to units of this cluster returns an array, that contains for each class, how many input vectors belonging to this class are mapped to units of the cluster
 double getClassEntropy(int index)
          Returns the entropy for class with index
 int[] getClassesForUnit(int x, int y)
          returns an array containing the counting for each class for the given unit
 int[] getClassMeanUnit(int classId)
          returns the mean x and y coordinates (and the standard derivation) of a class the following is done: for all input elements of the given class, the sum of the x coordinates of the unit the item is mapped onto is build, and then divided by the number of input items in this class.
 String[][] getClassMix(int index)
          returns every other class+hits contained in the regions with classmembers from the given index, or null if index exceeds the possible number of classes
 int[] getClassPurity1()
          returns for i = 0 ...
 String getClassPurity2(int[] purity)
          returns an textual interpretation of how good the SOM separates the different classes this is done quite simple by grouping the error to: less than 5% less than 10% less than 20% less than 50% less than 70% less than 85% less or equal than 100%
 int[] getClassRangesInUnits()
          Returns an Array containing the Range in SOMUnits from all Classes, or null if no Class info is available
 ClusterNode getClusterNodes(int level, int numbClusters)
          returns the cluster node representing the cluster at the specified level
 ClusteringTree getClusterTree()
          creates and returns the clustering tree for this SOM the cluster method used is WardsLinkageTreeBuilder.
 DatasetInformation getDatasetInfo()
           
 String getDWFilePath()
           
 GrowingSOM getGrowingSOM()
          returns the SOM learned within the run this object represents
 InputQEContainer getInputMappedQE(String name)
          calculates the qe for the specified input vector Calculates the quantization error of the input vector specified by its name, that is the distance of the given input vector to the unit it is mapped to.
protected  SOMLibFormatInputReader getInputReader()
          returns an instance of input reader the following files are handed to the reader: this.weightFilePath, this.unitFilePath, this.mapFilePath the reader created is saved in this.inputReader
 InputQEContainer getInputWinnerQE(String name)
          calculates the qe for the specified input vector Calculates the quantization error of the input vector specified by its name, that is the distance of the given input vector to the winner unit on the som.
 String getMapFilePath()
           
 MapQEContainer getMapMMQE()
          returns the mmqe of the trained SOM returns the mmqe of the trained SOM, as specified by the QuantizationError Object - see there for more information
 MapQEContainer getMapMQE()
          returns the mqe of the trained SOM returns the mqe of the trained SOM, as specified by the QuantizationError Object - see there for more information
 int[] getMappedUnit(double[] vector)
          mappes the vector to the current SOM and returns x and y coordinates of the winning unit.
 Object getMapProperty(String property)
           
 double getMapSilouette()
          returns the silhouette value of the map (using quality measure "silhouette")
 double getMapTE()
          returns the topographic error of the map (using quality measure "TE_Map")
 String[][] getMaxEErrorRegionNames()
          Returns the maximum Entropy Error Region's classnames
 int getMaximumEEClassIndex()
          Returns the class with the maximum EntropyError
 InputQEContainer getMaxInputMappedQE()
          returns the max qe of any input item compared with the unit it is mapped to returns the value of the greatest distance between the weight vector of an input item and the unit this item is mapped to.
 InputQEContainer getMaxInputWinnerQE()
          returns the max qe of any input item compared with all units on the map returns the value of the greatest distance between the weight vector of an input item and alle the weight vectors of units on the map.
 UnitQEContainer getMaxUnitMQE()
          returns the biggest mean quantization error of all units where at least one input vector is mapped on.
 UnitQEContainer getMaxUnitQE()
          returns the biggest quantization error of all units where at least one input vector is mapped on
 UnitQEContainer getMaxUnitTE()
          returns the maximal topographic error of any unit on the map (together with the unit)
 double getMeanClassSpread()
          Returns the mean Class spread of all Classes in Units;
 InputQEContainer getMinInputMappedQE()
          returns the min qe of any input item compared with the unit it is mapped to returns the value of the smallest distance between the weight vector of an input item and the unit this item is mapped to.
 InputQEContainer getMinInputWinnerQE()
          returns the min qe of any input item compared with all units on the map returns the value of the smallest distance between the weight vector of an input item and alle the weight vectors of units on the map.
 UnitQEContainer getMinUnitMQE()
          returns the smallest mean quantization error of all units where at least one input vector is mapped on.
 UnitQEContainer getMinUnitQE()
          returns the smallest quantization error of all units where at least one input vector is mapped on
 UnitQEContainer getMinUnitSilouette()
          returns the minimal silhouette Value of any unit on the map (together with the unit)
 UnitQEContainer getMinUnitTE()
          returns the minimal topographic error (> 0!!) of any unit on the map (together with the unit)
 double getMQEForUnit(int x, int y)
          returs the mean quantization error for the unit with the specified coordinates the mqe of a unit = sum or qe errors / number of input items mapped to this unit.
 int getNumberofClasses()
           
 int getNumberOfInputsOnUnit(int x, int y)
           
 int getNumberOfMaps()
           
 int getNumberOfSilouettelessUnits()
          returns the number of units on the map having no Silouette Value
 int getNumberOfTElessUnits()
          returns the number of units on the map having no topographic error
 double getPercOfZeroEntropyRegions()
          Returns the percentage of regions with 0 entropy
 String getPropertyFilePath()
           
 double getQEForUnit(int x, int y)
          Returns the quantization error of the unit at the specified coordinates That is, for all inputs mapped to this unit, the distance between the weigh vector of the input item and the unit is summed and returned
 QMContainer getQMContainer()
           
 double getRegionEntropyError(int mode)
          returns Entropy (Max/Min) error Region
 int getRunId()
           
 double getSigma()
           
 int getSOMDimensions()
          Returns the SOMs Dimensions
private  int getSomXSize()
           
private  int getSomYSize()
           
 Vector<double[]> getStableClusters1(ClusterNode node, int count, int boundary, Vector<double[]> stableClusterList)
          Quality measure for clusters that didn't work
 Vector<double[]> getStableClusters2(ClusterNode node, double parentValue, int boundary, Vector<double[]> stableClusterList)
          tries to sort all possible clusters by their "stability" that is, tries to give a measure about how good a cluster is.
 Vector<double[]> getStableClusters3(ClusterNode node, double parentValue, int boundary, Vector<double[]> stableClusterList)
          quality measure for clusters that didn't work
private  CommonSOMViewerStateData getStateObject()
          returns an instance of CommonSOMViewerStateData, that stores basic properties for visualization of SOMs and is needed for creating most of the images
 double getTau()
           
 double getTau2()
           
 HashMap<String,String> getTexts()
           
 int getType()
          gets the Type of the Testrunresult (HTML, LATEX)
 String getUnitFilePath()
           
 Unit getUnitMappedTo(InputDatum input)
          returns the unit the specified input item is mapped to
 SharedSOMVisualisationData getVisData()
          helper function to initialize the Shared data object for visualizations
 String getWeightFilePath()
           
 boolean hasMapDescription()
           
 boolean hasPropertyFilenpath()
           
 boolean hasUnitOn(int x, int y)
           
private  void prepareClassDistribution()
          calculates for each unit on the SOM, how many members of each class are mapped to it the resulting value is stored in a 3-dim.
private  QuantizationError somQE()
          returns the QuantizationError Object for the SOM specified by this TestRunResult Creates the some according to the data stored by this object, and returns the Quantization Error Object provided by the Layer (which can be retrieved from the GrowingSOM)
 boolean visualizeClassLayout(int[] meanUnit, int[] mappedMeanVector, int classId, String outputDir)
          creates an image that visualizes the "mean unit" of a class, its standard derivation and the unit onto which the mean weight vector of the class would be mapped Creates an image, that visualizes the units of the SOM.
 boolean visualizeCluster(int clusterLevel, String outputDir, int[] nodeDepths, int preferredUnitSize)
          creates a visualization of the given cluster the visualization is an image of the SOM, where the units are displayed, an the units belonging to the cluster are coloured.
private  boolean writeImagesAsJPG(String outputDir, String filename, BufferedImage buffImage, String visName)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

QMContainer

public QMContainer QMContainer

datasetInfo

public DatasetInformation datasetInfo

mapDescription

private MySOMLibMapDescription mapDescription

props

private SOMProperties props

mapFilePath

private String mapFilePath

unitFilePath

private String unitFilePath

weightFilePath

private String weightFilePath

propertyFilePath

private String propertyFilePath

dwFilePath

private String dwFilePath

texts

private HashMap<String,String> texts

visData

protected SharedSOMVisualisationData visData

inputReader

private SOMLibFormatInputReader inputReader

runId

private int runId

state

private CommonSOMViewerStateData state

clusterTree

private ClusteringTree clusterTree

som

private GrowingSOM som

thematic_visualizer

private ThematicClassMapVisualizer thematic_visualizer

entropy_visualizer

public EntropyVisualizer entropy_visualizer

sdh_visualizer

private SmoothedDataHistograms sdh_visualizer

trustworthyness_visualizer

private TrustwothinessVisualizer trustworthyness_visualizer

topographicproduct_visualizer

private TopographicProductVisualizer topographicproduct_visualizer

type

private int type

classDistribution

private int[][][] classDistribution

metroVis

private MetroMapVisualizer metroVis
Constructor Detail

TestRunResult

public TestRunResult(DatasetInformation datasetInfo,
                     String mapFilePath,
                     String propertyFilePath,
                     String unitFilePath,
                     String weightFilePath,
                     String dwFilePath,
                     int runId,
                     int type,
                     CommonSOMViewerStateData state)
Constructor for an already trained SOM & State, e.g. when using the report generator from the SOM Viewer


TestRunResult

public TestRunResult(DatasetInformation datasetInfo,
                     String mapFilePath,
                     String propertyFilePath,
                     String unitFilePath,
                     String weightFilePath,
                     String dwFilePath,
                     int runId,
                     int type)
Constructor without Trained SOM, e.g. when running stand-alone

Method Detail

getDatasetInfo

public DatasetInformation getDatasetInfo()

getMapFilePath

public String getMapFilePath()

getUnitFilePath

public String getUnitFilePath()

getDWFilePath

public String getDWFilePath()

getWeightFilePath

public String getWeightFilePath()

getRunId

public int getRunId()

getNumberOfInputsOnUnit

public int getNumberOfInputsOnUnit(int x,
                                   int y)

hasMapDescription

public boolean hasMapDescription()

hasPropertyFilenpath

public boolean hasPropertyFilenpath()

getPropertyFilePath

public String getPropertyFilePath()

getMapProperty

public Object getMapProperty(String property)

hasUnitOn

public boolean hasUnitOn(int x,
                         int y)

getSigma

public double getSigma()

getTau

public double getTau()

getTau2

public double getTau2()

getNumberOfMaps

public int getNumberOfMaps()

getMapMQE

public MapQEContainer getMapMQE()
returns the mqe of the trained SOM returns the mqe of the trained SOM, as specified by the QuantizationError Object - see there for more information

Returns:
the mqe of the trained map

getMapMMQE

public MapQEContainer getMapMMQE()
returns the mmqe of the trained SOM returns the mmqe of the trained SOM, as specified by the QuantizationError Object - see there for more information

Returns:
the mmqe of the trained map

getMinUnitQE

public UnitQEContainer getMinUnitQE()
returns the smallest quantization error of all units where at least one input vector is mapped on

Returns:
object containing the smallest QE and some information about the unit

getMapTE

public double getMapTE()
returns the topographic error of the map (using quality measure "TE_Map")

Returns:
the topographic error of the map or -1 (in case of any problems)

getMaxUnitTE

public UnitQEContainer getMaxUnitTE()
returns the maximal topographic error of any unit on the map (together with the unit)

Returns:
an object storing information about both: the biggest topographic error of the map as well as of the unit containing this error, null in case of any error

getMapSilouette

public double getMapSilouette()
returns the silhouette value of the map (using quality measure "silhouette")

Returns:
the silhouette value of the map or -1 (in case of any problems)

getNumberOfTElessUnits

public int getNumberOfTElessUnits()
returns the number of units on the map having no topographic error

Returns:
the number of units without topographic error, -1 in case of any error

getNumberOfSilouettelessUnits

public int getNumberOfSilouettelessUnits()
returns the number of units on the map having no Silouette Value

Returns:
the number of units without silouette value error, -1 in case of any error

getMinUnitTE

public UnitQEContainer getMinUnitTE()
returns the minimal topographic error (> 0!!) of any unit on the map (together with the unit)

Returns:
an object storing information about both: the smallest topographic error (> 0!!) of the map as well as of the unit containing this error, null in case of an error

getMinUnitSilouette

public UnitQEContainer getMinUnitSilouette()
returns the minimal silhouette Value of any unit on the map (together with the unit)

Returns:
an object storing information about both: the smallest silhouette error (> 0!!) of the map as well as of the unit containing this error, null in case of an error

getQEForUnit

public double getQEForUnit(int x,
                           int y)
Returns the quantization error of the unit at the specified coordinates That is, for all inputs mapped to this unit, the distance between the weigh vector of the input item and the unit is summed and returned

Parameters:
x - the x-coordinate of the unit on the map
y - the y-coordinate of the unit on the map
Returns:
the qe of the unit at the specified coordinates, -1 in case of an error

getMaxUnitQE

public UnitQEContainer getMaxUnitQE()
returns the biggest quantization error of all units where at least one input vector is mapped on

Returns:
an object containing both, the value of the qe as well as information about the unit this qe is located on, null in case of any error

getMinUnitMQE

public UnitQEContainer getMinUnitMQE()
returns the smallest mean quantization error of all units where at least one input vector is mapped on. (that is: sum of distances / number of vectors)

Returns:
an object containing the value of the smallest mqe of all units on the map as well as information about the unit the error is located on. null in case of any problem.

getMQEForUnit

public double getMQEForUnit(int x,
                            int y)
returs the mean quantization error for the unit with the specified coordinates the mqe of a unit = sum or qe errors / number of input items mapped to this unit. This value is returned

Parameters:
x - the x-coordinate of the unit on the map
y - the y-coordinate of the unit on the map
Returns:
the mqe of the specified unit or -1 in case of any error.

getMaxUnitMQE

public UnitQEContainer getMaxUnitMQE()
returns the biggest mean quantization error of all units where at least one input vector is mapped on. (that is: sum of distances / number of vectors)

Returns:
an object containing the value of the biggest mqe as well as information about the unit this error is located on, null in case of any problems

getUnitMappedTo

public Unit getUnitMappedTo(InputDatum input)
returns the unit the specified input item is mapped to

Parameters:
input - the input item, for which the unit it is mapped to shall be returned
Returns:
the unit onto which the given input item is mapped

getInputMappedQE

public InputQEContainer getInputMappedQE(String name)
calculates the qe for the specified input vector Calculates the quantization error of the input vector specified by its name, that is the distance of the given input vector to the unit it is mapped to.

Parameters:
name - the name specifying the input vector
Returns:
an object containing the value of the qe of the specified input

getMappedUnit

public int[] getMappedUnit(double[] vector)
mappes the vector to the current SOM and returns x and y coordinates of the winning unit. searches the winning unit on the SOM for the given weight vector (that ist the SOM whose weight vector is closest to the given vecotr and returns the coordinates of this unit.

Parameters:
vector - the vector of the item that shall be mapped to the unit
Returns:
and array containing x and y coordinates of the winning unit

getClassMeanUnit

public int[] getClassMeanUnit(int classId)
returns the mean x and y coordinates (and the standard derivation) of a class the following is done: for all input elements of the given class, the sum of the x coordinates of the unit the item is mapped onto is build, and then divided by the number of input items in this class. (the same for y) That is, the mean unit in terms of the units the item are really mapped onto is calculated. (meanx = sum(x)/n, where n is the number of input items in the class, and the sum is over all input items, and x is the x-coordinate of the unit the item is mapped onto - equivalent for y). And the standard derivation of this value is also calculated

Parameters:
classId - the id of the class for which the mean unit shall be calculated
Returns:
the mean x and y coordinates (at index 0=x, 1=y) as well as their standard derivation (2=x, 3=y)

visualizeClassLayout

public boolean visualizeClassLayout(int[] meanUnit,
                                    int[] mappedMeanVector,
                                    int classId,
                                    String outputDir)
creates an image that visualizes the "mean unit" of a class, its standard derivation and the unit onto which the mean weight vector of the class would be mapped Creates an image, that visualizes the units of the SOM. The position of the mean unit (defined by the indexes 0,1 of the meanUnit parameter) is marked by a square, the position of the unit onto which the mean weight vector would be mapped by a circle. The radius (standard derivation of the mean unit) is denoted by a rectangle, going meanUnit[2] units to the left and right of the mean unit, and meanUnit[3] items to the top and bottom the image is named run_RUNID_classCenter_CLASSID.jpg";

Parameters:
meanUnit - [0]: the x coordinate of the mean unit, [1]: the y coordinate, [2]: the derivation in x-direction, [3]: the derivation in y direction
mappedMeanVector - [0]: the x coordinate of the unit onto which the mean weight vector of the class would be mapped, [1]: the y coordinate
classId - the id of the class for which the image shall be made
outputDir - the directory into which the image shall be saved. (neither checked nor created)

getInputWinnerQE

public InputQEContainer getInputWinnerQE(String name)
calculates the qe for the specified input vector Calculates the quantization error of the input vector specified by its name, that is the distance of the given input vector to the winner unit on the som. (it is not clear yet, whether this unit must be the same as the unit this element is mapped onto, or whether during training the map can change in a way that the mapped unit is not the winner at the end of the training. There would be a chance if an input vector at the beginning of the training is lying between two units, but during the rest of the training, the unit chosen moves away from the input vector, while the other one comes closer ...)

Parameters:
name - the name specifying the input vector

getMinInputMappedQE

public InputQEContainer getMinInputMappedQE()
returns the min qe of any input item compared with the unit it is mapped to returns the value of the smallest distance between the weight vector of an input item and the unit this item is mapped to. It also returns the input item(s) and unit(s) between those error arises

Returns:
object containing the information specified above

getMaxInputMappedQE

public InputQEContainer getMaxInputMappedQE()
returns the max qe of any input item compared with the unit it is mapped to returns the value of the greatest distance between the weight vector of an input item and the unit this item is mapped to. It also returns the input item(s) and unit(s) between those error arises

Returns:
object containing the information specified above

getMinInputWinnerQE

public InputQEContainer getMinInputWinnerQE()
returns the min qe of any input item compared with all units on the map returns the value of the smallest distance between the weight vector of an input item and alle the weight vectors of units on the map. It also returns the input item(s) and unit(s) between those error arises.

Returns:
object containing the information specified above

getMaxInputWinnerQE

public InputQEContainer getMaxInputWinnerQE()
returns the max qe of any input item compared with all units on the map returns the value of the greatest distance between the weight vector of an input item and alle the weight vectors of units on the map. It also returns the input item(s) and unit(s) between those error arises.

Returns:
object containing the information specified above

getClusterNodes

public ClusterNode getClusterNodes(int level,
                                   int numbClusters)
returns the cluster node representing the cluster at the specified level

Parameters:
level - the level for which the cluster node shall be returned
numbClusters - should be 1
Returns:
the cluster node representing the specfied value

somQE

private QuantizationError somQE()
returns the QuantizationError Object for the SOM specified by this TestRunResult Creates the some according to the data stored by this object, and returns the Quantization Error Object provided by the Layer (which can be retrieved from the GrowingSOM)

Returns:
the QuantizationError object for this SOM

getGrowingSOM

public GrowingSOM getGrowingSOM()
returns the SOM learned within the run this object represents


getClassPurity1

public int[] getClassPurity1()
returns for i = 0 ... numberOfClasses onto how many units on the map have exactly items of i different classes are mapped on

Returns:
array of length numberOfClasses + 1, where the index denotes the number of classes, and the value the number of corresponding units

getClassPurity2

public String getClassPurity2(int[] purity)
returns an textual interpretation of how good the SOM separates the different classes this is done quite simple by grouping the error to:

getVisData

public SharedSOMVisualisationData getVisData()
helper function to initialize the Shared data object for visualizations

Returns:
a SharedSOMVisualiationData object storing the paths to the important files

createClassDistributionImage

public boolean createClassDistributionImage(String outputDir,
                                            String filename,
                                            int ClassID)
UPDATE creates a jpg showing the class distribtion on the trained SOM The jpg is saved to the output dir with the following name: run_RUNID_FILENAME

Parameters:
outputDir - string defining the output directory where the image shall be saved (neither checked nor created)
filename - the filename that shall be used for saving the image (run_RUNID_ is prefixed)
ClassID - Specifies the Class to be shown, when ClasID is -1, teh whoel class dictribution image is painted
Returns:
true if everything worked fine, false in case of any error (false does not give any information about whether the image exists or not)

createDMatrixImage

public boolean createDMatrixImage(String outputDir,
                                  String filename,
                                  int unitScale)
Creates a D-Matrix Image


writeImagesAsJPG

private boolean writeImagesAsJPG(String outputDir,
                                 String filename,
                                 BufferedImage buffImage,
                                 String visName)

getSomYSize

private int getSomYSize()

getSomXSize

private int getSomXSize()

createQuantizationErrorImage

public boolean createQuantizationErrorImage(String outputDir,
                                            String filename,
                                            int variant)
creates an image visualizing the quantization error of this SOM the image is saved under the given path and name, although a prefix run_runId_ is added to the image name

Parameters:
outputDir - the path to the output dir where the image shall be saved (must exists, is neither checked nor created)
filename - the name under which the image (together with the prefix run_[runId]_ ) is saved
variant - 0 = normal, 1 =mean Quant
Returns:
true if everything worked fine, false if there was any problem. False does neither assure that the image exists, nor that is does not

createSilouetteImage

public boolean createSilouetteImage(String outputDir,
                                    String filename,
                                    int variant)
Creates a Silhouette image


createTopographicErrorImage

public boolean createTopographicErrorImage(String outputDir,
                                           String filename)
creates an image visualizing the topographic error of this SOM the image is saved under the given path and name, although a prefix run_runId_ is added to the image name

Parameters:
outputDir - the path to the output dir where the image shall be saved (must exists, is neither checked nor created)
filename - the name under which the image (together with the prefix run_[runId]_ ) is saved
Returns:
true if everything worked fine, false if there was any problem. False does neither assure that the image exists, nor that is does not

createIntrinsicDistanceImage

public boolean createIntrinsicDistanceImage(String outputDir,
                                            String filename)
Creates a Intrinsic Distance Image


createUDMatrixImage

public boolean createUDMatrixImage(String outputDir,
                                   String filename,
                                   int unitScale,
                                   int index)
create the U-D-Matrix visualization of the SOM the image is saved under the given path (which is neither checked nor created) under the given name, only the prefix run_runId_ is added to the filename.

Parameters:
outputDir - the path to the output dir where the image shall be saved (must exists, is neither checked nor created
filename - the name under which the image (together with the prefix run_[runId]_ ) is saved
unitScale - defines how many pixels shall be used to represent one unit (so one unit has size unitScalexunitScale pixels
index - which visualisation to create; 0 = U Matrix, 1 = D Matrix;
Returns:
true if everything worked fine, false if there was any problem. False does neither assure that the image exists, nor that is does not

createFlowBorderLineImage

public boolean createFlowBorderLineImage(String outputDir,
                                         String filename,
                                         int unitScale)
create the Flow & BorderLine visualization of the SOM the image is saved under the given path (which is neither checked nor created) under the given name, only the prefix run_runId_ is added to the filename.

Parameters:
outputDir - the path to the output dir where the image shall be saved (must exists, is neither checked nor created
filename - the name under which the image (together with the prefix run_[runId]_ ) is saved
unitScale - defines how many pixels shall be used to represent one unit (so one unit has size unitScalexunitScale pixels
Returns:
true if everything worked fine, false if there was any problem. False does neither assure that the image exists, nor that is does not

createDistortionImage

public boolean createDistortionImage(String outputDir,
                                     String filename,
                                     int unitScale,
                                     int index)
create the Distortion visualization of the SOM the image is saved under the given path (which is neither checked nor created) under the given name, only the prefix run_runId_ is added to the filename.

Parameters:
outputDir - the path to the output dir where the image shall be saved (must exists, is neither checked nor created
filename - the name under which the image (together with the prefix run_[runId]_ ) is saved
unitScale - defines how many pixels shall be used to represent one unit (so one unit has size unitScalexunitScale pixels
index - the index
Returns:
true if everything worked fine, false if there was any problem. False does neither assure that the image exists, nor that is does not

createSDHImages

public void createSDHImages(String outputDir,
                            String filename,
                            int unitScale,
                            boolean Latex,
                            int step)
create a SDH visualization of the SOM the image is saved under the given path (which is neither checked nor created) under the given name, only the prefix run_runId_ is added to the filename.

Parameters:
outputDir - the path to the output dir where the image shall be saved (must exists, is neither checked nor created
filename - the name under which the image (together with the prefix run_[runId]_ ) is saved
unitScale - defines how many pixels shall be used to represent one unit (so one unit has size unitScalexunitScale pixels
Latex - used for latex output

createTrustworthyNessImages

public void createTrustworthyNessImages(String outputDir,
                                        String filename,
                                        int unitScale,
                                        boolean Latex,
                                        int step)
create TrustWortyNess pictures of the SOM the image is saved under the given path (which is neither checked nor created) under the given name, only the prefix run_runId_ is added to the filename.

Parameters:
outputDir - the path to the output dir where the image shall be saved (must exists, is neither checked nor created
filename - the name under which the image (together with the prefix run_[runId]_ ) is saved
unitScale - defines how many pixels shall be used to represent one unit (so one unit has size unitScalexunitScale pixels
Latex - used for latex output

createTopographicProductImages

public void createTopographicProductImages(String outputDir,
                                           String filename,
                                           int unitScale,
                                           boolean Latex,
                                           int step)
create a TopographicProduct visualization of the SOM the image is saved under the given path (which is neither checked nor created) under the given name, only the prefix run_runId_ is added to the filename.

Parameters:
outputDir - the path to the output dir where the image shall be saved (must exists, is neither checked nor created
filename - the name under which the image (together with the prefix run_[runId]_ ) is saved
unitScale - defines how many pixels shall be used to represent one unit (so one unit has size unitScalexunitScale pixels
Latex - used for latex output

createInputDistributionImage

public boolean createInputDistributionImage(String outputDir,
                                            String filename)
creates a visualization of the distribution of the input data on the SOM the image is saved under the given path (which is neither checked nor created) under the given name, only the prefix run_runId_ is added to the filename.

Parameters:
outputDir - the path to the output dir where the image shall be saved (must exists, is neither checked nor created
filename - the name under which the image (together with the prefix run_[runId]_ ) is saved

createSingleMetroMapComponentImage

public boolean createSingleMetroMapComponentImage(String outputDir,
                                                  String filename,
                                                  int component)
Creates a SingleMetroMapComponentImage with the given component index. Note that the dimensions of the Pictures are fixed.


createEntropyImage

public boolean createEntropyImage(String outputDir,
                                  String filename,
                                  int ClassID)
Creates an Entropy Image, and saves it at the given Location.

Parameters:
ClassID - if ClassID is set to -1, the Picture generated by default is that of all classes of the SOM. If ClassID is > -1, the Class with the specified ClassID-index is displayed

createPaletteImage

public void createPaletteImage(String outputDir,
                               String filename,
                               String palName)
Creates a Palette Image on the color palette on the specified Index
FIXME: move this way from this class


prepareClassDistribution

private void prepareClassDistribution()
calculates for each unit on the SOM, how many members of each class are mapped to it the resulting value is stored in a 3-dim. array, where the first dimension denots the x position of the unit, the second the y position, and the third the id of the class. There the number of input items mapped to this unit belongig to this class is saved. this array is stored in this.classDistribution


createPieChartImages

public void createPieChartImages(String outputDir)
creates for each unit having at least one input item mapped to it an image of the class distribution the images are stored in an subdirectory of the specified directory (which is neither checked nor created) named "pieCharts_runId". All content in this directory is deleted before the images are created.

Parameters:
outputDir - the path to the output dir where the image shall be saved (must exists, is neither checked nor created

getClusterTree

public ClusteringTree getClusterTree()
creates and returns the clustering tree for this SOM the cluster method used is WardsLinkageTreeBuilder. If an error occurs, null is probably returned.

Returns:
the clustering tree for this som, or null in case of an error

getStableClusters2

public Vector<double[]> getStableClusters2(ClusterNode node,
                                           double parentValue,
                                           int boundary,
                                           Vector<double[]> stableClusterList)
tries to sort all possible clusters by their "stability" that is, tries to give a measure about how good a cluster is. Thereby, as simple qualification method, simply the improvement of the distance between all units within a cluster and the mean vector of a cluster, divided by the number of units within a cluster compared to the same value in the parent cluster is chosen. This works surprisingly well. (that is: biggest difference of parentvalue - my value)

Parameters:
node - the node in the cluster tree, whose subtree shall be scanned through
parentValue - the value of the quality measure in the parent node
boundary - a boundary for the level of clusters, where the calculation shall be stopped, that is a boundary for the depth the subtree of node shall be scanned
stableClusterList - a sorted list of clusters, into which the clusters of this subtree shall be inserted-
Returns:
an ordered list containing all the clusters specified in the last argument as well as all clusters in the subtree rooted in node "node" having level smaller than boundary

getClassDistributionInCluster

public int[] getClassDistributionInCluster(int clusterLevel)
returns for the given cluster, how many input elements of the different classses are mapped to units of this cluster returns an array, that contains for each class, how many input vectors belonging to this class are mapped to units of the cluster

Parameters:
clusterLevel - the level of the cluster
Returns:
the number of inputs for each cluss within the cluster

visualizeCluster

public boolean visualizeCluster(int clusterLevel,
                                String outputDir,
                                int[] nodeDepths,
                                int preferredUnitSize)
creates a visualization of the given cluster the visualization is an image of the SOM, where the units are displayed, an the units belonging to the cluster are coloured. Further, the name of the cluster is written in the cluster (as least tried to)

WARNING!! nodeDepths should contain the depths of the cluster nodes. But for level i, the according depth is not in nodeDepths[i-1] or [i], but at [i+1]!!!!

Parameters:
clusterLevel - the level of the cluster to be visualized (uniquly identifies the cluster within the tree)
outputDir - the path to the output dir where the image shall be saved (must exists, is neither checked nor created
nodeDepths - the array containing the depths of the cluster nodes in the cluster tree. Read warning above!!!
preferredUnitSize - the length a unit-side has in the ideal case (that is if there aren't too many units), that is, a unit gets dimenstions preferredUnitSizexpreferredUnitSize
Returns:
true if no error was encountered during execution, false otherwise (if false is returned, nothing can be stated about whether the image exists or not)

getInputReader

protected SOMLibFormatInputReader getInputReader()
returns an instance of input reader the following files are handed to the reader: this.weightFilePath, this.unitFilePath, this.mapFilePath the reader created is saved in this.inputReader

Returns:
an instance of input reader.

getStateObject

private CommonSOMViewerStateData getStateObject()
returns an instance of CommonSOMViewerStateData, that stores basic properties for visualization of SOMs and is needed for creating most of the images

Returns:
and instance of this object, initialized with only default values.

getStableClusters1

public Vector<double[]> getStableClusters1(ClusterNode node,
                                           int count,
                                           int boundary,
                                           Vector<double[]> stableClusterList)
Quality measure for clusters that didn't work


getStableClusters3

public Vector<double[]> getStableClusters3(ClusterNode node,
                                           double parentValue,
                                           int boundary,
                                           Vector<double[]> stableClusterList)
quality measure for clusters that didn't work


getClassRangesInUnits

public int[] getClassRangesInUnits()
Returns an Array containing the Range in SOMUnits from all Classes, or null if no Class info is available


getMeanClassSpread

public double getMeanClassSpread()
Returns the mean Class spread of all Classes in Units;

Returns:
double the mean class spread, unit measured

getRegionEntropyError

public double getRegionEntropyError(int mode)
returns Entropy (Max/Min) error Region

Parameters:
mode - (1 = max, 2 = min)

getMaxEErrorRegionNames

public String[][] getMaxEErrorRegionNames()
Returns the maximum Entropy Error Region's classnames


getPercOfZeroEntropyRegions

public double getPercOfZeroEntropyRegions()
Returns the percentage of regions with 0 entropy


getClassEntropy

public double getClassEntropy(int index)
Returns the entropy for class with index


getMaximumEEClassIndex

public int getMaximumEEClassIndex()
Returns the class with the maximum EntropyError


getTexts

public HashMap<String,String> getTexts()

getClassMix

public String[][] getClassMix(int index)
returns every other class+hits contained in the regions with classmembers from the given index, or null if index exceeds the possible number of classes


getType

public int getType()
gets the Type of the Testrunresult (HTML, LATEX)


getSOMDimensions

public int getSOMDimensions()
Returns the SOMs Dimensions


getClassesForUnit

public int[] getClassesForUnit(int x,
                               int y)
returns an array containing the counting for each class for the given unit


getClassDistribution

public int[][][] getClassDistribution()
Returns the Class Distribution array for each Unit of the Map


getAllUnitsContainingClass

public ArrayList<int[]> getAllUnitsContainingClass(int index)

getNumberofClasses

public int getNumberofClasses()

fillQMContainer

public void fillQMContainer()
                     throws QualityMeasureNotFoundException
Fills the QMContainer Object with all quality Measures that were specified in the report

Throws:
QualityMeasureNotFoundException

getQMContainer

public QMContainer getQMContainer()