at.tuwien.ifs.somtoolbox.reportgenerator.QEContainers
Class QMContainer

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.reportgenerator.QEContainers.QMContainer

public class QMContainer
extends Object

Version:
$Id: QMContainer.java 3590 2010-05-21 10:43:45Z mayer $
Author:
Martin Waitzbauer (0226025)

Field Summary
private  ArrayList<String> damagedcriteriaQM
           
(package private)  HashMap<String,Double> MapQualities
           
static int NUMBER_OF_CLASSES
           
private  HashMap<Integer,String> QualityIdentifier
           
(package private)  TestRunResult run
           
(package private)  SemanticInterpreterGrid sGrid
           
(package private)  HashMap<String,Double> UnitMAXQualities
           
(package private)  HashMap<String,Double> UnitMINQualities
           
(package private)  HashMap<String,double[][]> UnitQualities
           
(package private)  HashMap<String,int[][]> UnitQualitiesClassified
           
 ArrayList<String> UnitQualityMeasureNames
           
 
Constructor Summary
QMContainer(TestRunResult run)
           
 
Method Summary
 void classifyUnits(String Name)
          Puts all the Values of the QM identified with "Name" in "Classes" 1-5 (strong - very weak)
 void clearDamagedCriteriaList()
           
 double[] compareQualities(String Name1, String Name2, Unit[] Region, int type)
          Compares the 2 QM with each other,i.e looks through all units (only in the Region if region != NULL) and looks for similar values at the same Units (TRY: Enlarge the search radius to a certain neighbourhood radius (1))
 boolean createQualityMeasureImage(String outputDir, String filename, String Name)
          creates an image visualizing the Quality Measure "Name" of this SOM the image is saved under the given path and name, although a prefix run_runId_ is added to the image name
 QMConfigurationProfile getActualConfiguration(String qualifier, Unit[] units, int type)
          Returns an array with the actual identification configuration , of how the qualifier QM behaves
 ArrayList<String> getClassFileDependantQualities()
           
 String getClassIdentifier(int c)
          Returns the string representation of the given int value
FIXME: refactor this!
 int[][] getClassifiedUnits(String Name)
          Returns the int [] of classified units for identifier Name
 ArrayList<Unit> getComparedQMRegionOccurances(String Name1, String Name2, Unit[] Region, int type)
          Returns an array of Units, witch have Intersection of QM Name1 & Name 2 with the given type of operation
 Double getMapQualities(String Name)
          Returns the map qualities of the given quality measure
 int getMaximumClassifiedRegionValue(Unit[] region, String Name)
          Returns the maximum of the selected classified Region
 Unit[] getMaxUnit(String Name, Unit[] Area)
          returns the maximal Value of the quality measure with "Name"as identifier
 int getMinimumClassifiedRegionValue(Unit[] region, String Name)
          Returns the minimum of the selected classified Region
 Unit[] getMinUnit(String Name, Unit[] Area)
          returns the minimal Value of the quality measure with "Name"as identifier
private  SemanticNode getNode(int[] c)
          returns the Semantic Node for given coordinates.
 int getNumberOfClassifiedUnits(String Name, int clss)
          Computes the number of classified units for the given class and identifier
 QMConfigurationProfile getOriginalConfiguration(String qualifier, int type)
          Returns an array with the original identification configuration , of how the qualifier QM should behave on MAXIMUM / MINIMUM Value
 String getQualityIdentifier(int quality_list_index)
          Returns a String Representation of the Meaning of the Position of the ArrayList Array
 double getUnitMAXQualities(String Name)
           
 double getUnitMINQualities(String Name)
           
 double[][] getUnitQualities(String Name)
           
 boolean hasHighDensity(Unit u)
          Tests whether the Unit U is having a High Mapped Input Density.
This is made upon an assumption, we say a unit is highly dense when the average value of the first 15% of units with highest values is equal or above that value that
 boolean hasLowDensity(Unit u)
          Returns true if the Unit has a low density
 Boolean hasMixedClasses(Unit u)
          Returns whether there are mixed classes on the Unit.
 Boolean hasNeighboringEmptyUnits(Unit u)
          * Returns true if 8-fold neighbourhood shows any Units with no Inputs.
 Boolean hasSingleClass(Unit u)
           
 ArrayList<SemanticClass> isOnClusterEdge(Unit u)
          returns a ArrayList with all classes for witch unit u resembles a Cluster Edge Unit for those classes.
 boolean isOnMapEdge(Unit u)
          tests whether a unit is on the edge of the map
FIXME: this should go to GrowingLayer
 void putMapQualities(String Name, double measure)
           
 void putUnitQualities(String Name, double[][] units)
           
 void setsGrid(SemanticInterpreterGrid sGrid)
          Sets the SemanticGrid for calculations PLEASE NOTE: only the "Master- Grid can be set here" -> wich is the Grid over the full Map, inluding all ClassReports
 void writeQualityIdentifier()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

UnitQualities

HashMap<String,double[][]> UnitQualities

UnitMAXQualities

HashMap<String,Double> UnitMAXQualities

UnitMINQualities

HashMap<String,Double> UnitMINQualities

MapQualities

HashMap<String,Double> MapQualities

UnitQualitiesClassified

HashMap<String,int[][]> UnitQualitiesClassified

UnitQualityMeasureNames

public ArrayList<String> UnitQualityMeasureNames

sGrid

SemanticInterpreterGrid sGrid

damagedcriteriaQM

private ArrayList<String> damagedcriteriaQM

QualityIdentifier

private HashMap<Integer,String> QualityIdentifier

run

TestRunResult run

NUMBER_OF_CLASSES

public static int NUMBER_OF_CLASSES
Constructor Detail

QMContainer

public QMContainer(TestRunResult run)
Method Detail

putUnitQualities

public void putUnitQualities(String Name,
                             double[][] units)

getUnitQualities

public double[][] getUnitQualities(String Name)

putMapQualities

public void putMapQualities(String Name,
                            double measure)

getMaxUnit

public Unit[] getMaxUnit(String Name,
                         Unit[] Area)
returns the maximal Value of the quality measure with "Name"as identifier

Parameters:
Area - null if whole grid is admitted, != null ifi want a Part only
Returns:
an Unit Array storing the Unit(s) with the biggest Value

getMinUnit

public Unit[] getMinUnit(String Name,
                         Unit[] Area)
returns the minimal Value of the quality measure with "Name"as identifier

Parameters:
Area - != null if i want area selection, null if whole grid
Returns:
an Unit Array storing the Unit(s) with the smallest Value

classifyUnits

public void classifyUnits(String Name)
Puts all the Values of the QM identified with "Name" in "Classes" 1-5 (strong - very weak)


getClassifiedUnits

public int[][] getClassifiedUnits(String Name)
Returns the int [] of classified units for identifier Name


getNumberOfClassifiedUnits

public int getNumberOfClassifiedUnits(String Name,
                                      int clss)
Computes the number of classified units for the given class and identifier


getMapQualities

public Double getMapQualities(String Name)
Returns the map qualities of the given quality measure


createQualityMeasureImage

public boolean createQualityMeasureImage(String outputDir,
                                         String filename,
                                         String Name)
creates an image visualizing the Quality Measure "Name" 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

getUnitMAXQualities

public double getUnitMAXQualities(String Name)

getUnitMINQualities

public double getUnitMINQualities(String Name)

getClassIdentifier

public String getClassIdentifier(int c)
Returns the string representation of the given int value
FIXME: refactor this!


getMaximumClassifiedRegionValue

public int getMaximumClassifiedRegionValue(Unit[] region,
                                           String Name)
Returns the maximum of the selected classified Region

Parameters:
region - null if whole Grid
Name - QM Identifier
Returns:
the maximum of the selected classified Region

getMinimumClassifiedRegionValue

public int getMinimumClassifiedRegionValue(Unit[] region,
                                           String Name)
Returns the minimum of the selected classified Region

Parameters:
region - null if whole Grid
Name - QM Identifier
Returns:
the minimum of the selected classified Region

compareQualities

public double[] compareQualities(String Name1,
                                 String Name2,
                                 Unit[] Region,
                                 int type)
Compares the 2 QM with each other,i.e looks through all units (only in the Region if region != NULL) and looks for similar values at the same Units (TRY: Enlarge the search radius to a certain neighbourhood radius (1))

Parameters:
type - 1 = Max-Max, 2 = Min-Min, 3 = Max-Min, 4 = Min-Max Compares according to Min /Max Values return a Array [0] gives the percentage of similarity, [1] gives the absolute difference in strength between max/min 1/2, [2] the region of intersection(1-9)

getComparedQMRegionOccurances

public ArrayList<Unit> getComparedQMRegionOccurances(String Name1,
                                                     String Name2,
                                                     Unit[] Region,
                                                     int type)
Returns an array of Units, witch have Intersection of QM Name1 & Name 2 with the given type of operation


setsGrid

public void setsGrid(SemanticInterpreterGrid sGrid)
Sets the SemanticGrid for calculations PLEASE NOTE: only the "Master- Grid can be set here" -> wich is the Grid over the full Map, inluding all ClassReports


getOriginalConfiguration

public QMConfigurationProfile getOriginalConfiguration(String qualifier,
                                                       int type)
Returns an array with the original identification configuration , of how the qualifier QM should behave on MAXIMUM / MINIMUM Value

Parameters:
qualifier - the QM
type - 1= max, 2 = Min
Returns:
an Array of arraylists, built up as following: out[0] = high Density out[1] = low Density out[2] = mixed classes out[3] = one class out[4] = Units on Map edges out[5] = Units not on Map edges out[6] = Having neighboring empty units out[7] = having no neighboring empt unist out[8] = Units on Cluster edges out[9] = Units in Clusters out[10] = Big Distance of mapped Vectors to Prototype vector. out[11] = Small Distance of mapped Vectors to Prototype vector. out[12] = Big average Distance of mapped Vectors compared to each other. out[13] = Small average Distance of mapped Vectors compared to each other. out[14] = Input Vectors equally distributed over the Map out[15] = Input Vectors not equally distributed over the Map out[16] = Intra Cluster Distances == 0, Inter Cluster Distances != 0 out[17] = Intra Cluster Distances != 0, Inter Cluster Distances == 0

getActualConfiguration

public QMConfigurationProfile getActualConfiguration(String qualifier,
                                                     Unit[] units,
                                                     int type)
Returns an array with the actual identification configuration , of how the qualifier QM behaves

Parameters:
qualifier - the QM
units - the units witch are tested
type - 1 = MAX, 2 = MIN
Returns:
an Array of arraylists, built up as following: out[0] = high Density out[1] = low Density out[2] = mixed classes out[3] = one class out[4] = Units on Map edges out[5] = Units not on Map edges out[6] = Having neighboring empty units out[7] = having no neighboring empt unist out[8] = Units on Cluster edges out[9] = Units in Clusters out[10] = Big Distance of mapped Vectors to Prototype vector. out[11] = Small Distance of mapped Vectors to Prototype vector. out[12] = Big average Distance of mapped Vectors compared to each other. out[13] = Small average Distance of mapped Vectors compared to each other. out[14] = Input Vectors equally distributed over the Map out[15] = Input Vectors not equally distributed over the Map out[16] = Intra Cluster Distances == 0, Inter Cluster Distances != 0 out[17] = Intra Cluster Distances != 0, Inter Cluster Distances == 0

hasHighDensity

public boolean hasHighDensity(Unit u)
Tests whether the Unit U is having a High Mapped Input Density.
This is made upon an assumption, we say a unit is highly dense when the average value of the first 15% of units with highest values is equal or above that value that


hasLowDensity

public boolean hasLowDensity(Unit u)
Returns true if the Unit has a low density


hasMixedClasses

public Boolean hasMixedClasses(Unit u)
Returns whether there are mixed classes on the Unit. If no class file was used during report Creation, die measure is left out


hasSingleClass

public Boolean hasSingleClass(Unit u)

isOnMapEdge

public boolean isOnMapEdge(Unit u)
tests whether a unit is on the edge of the map
FIXME: this should go to GrowingLayer


isOnClusterEdge

public ArrayList<SemanticClass> isOnClusterEdge(Unit u)
returns a ArrayList with all classes for witch unit u resembles a Cluster Edge Unit for those classes. this need a clss file to b presents, returns null otherwise


hasNeighboringEmptyUnits

public Boolean hasNeighboringEmptyUnits(Unit u)
* Returns true if 8-fold neighbourhood shows any Units with no Inputs. Need a class file to b presents, returns null otherwise
FIXME: this should be move to GrowingLayer


getNode

private SemanticNode getNode(int[] c)
returns the Semantic Node for given coordinates. a node is null if no class file was attached


getQualityIdentifier

public String getQualityIdentifier(int quality_list_index)
Returns a String Representation of the Meaning of the Position of the ArrayList Array

Parameters:
quality_list_index - gives a Description to the Index of the quality List below quality_list[0] = high Density quality_list[1] = low Density quality_list[2] = mixed classes quality_list[3] = one class quality_list[4] = Units on Map edges quality_list[5] = Units not on Map edges quality_list[6] = Having neighboring empty units quality_list[7] = having no neighboring empt unist quality_list[8] = Units on Cluster edges quality_list[9] = Units in Clusters quality_list[10] = Big Distance of mapped Vectors to Prototype vector. quality_list[11] = Small Distance of mapped Vectors to Prototype vector. quality_list[12] = Big average Distance of mapped Vectors compared to each other. quality_list[13] = Small average Distance of mapped Vectors compared to each other. quality_list[14] = Input Vectors equally distributed over the Map quality_list[15] = Input Vectors not equally distributed over the Map quality_list[16] = Intra Cluster Distances == 0, Inter Cluster Distances != 0 quality_list[17] = Intra Cluster Distances != 0, Inter Cluster Distances == 0

getClassFileDependantQualities

public ArrayList<String> getClassFileDependantQualities()

clearDamagedCriteriaList

public void clearDamagedCriteriaList()

writeQualityIdentifier

public void writeQualityIdentifier()