at.tuwien.ifs.somtoolbox.input
Class MnemonicSOMLibFormatInputReader

java.lang.Object
  extended by at.tuwien.ifs.somtoolbox.input.AbstractSOMInputReader
      extended by at.tuwien.ifs.somtoolbox.input.SOMLibFormatInputReader
          extended by at.tuwien.ifs.somtoolbox.input.MnemonicSOMLibFormatInputReader
All Implemented Interfaces:
SOMInputReader

public class MnemonicSOMLibFormatInputReader
extends SOMLibFormatInputReader

A SOMInputReader that can handle MnemonicSOM, i.e. SOMs where not all units are occupied.

Version:
$Id: MnemonicSOMLibFormatInputReader.java 3583 2010-05-21 10:07:41Z mayer $
Author:
Rudolf Mayer

Nested Class Summary
 
Nested classes/interfaces inherited from class at.tuwien.ifs.somtoolbox.input.AbstractSOMInputReader
AbstractSOMInputReader.UnitInformation
 
Field Summary
 
Fields inherited from class at.tuwien.ifs.somtoolbox.input.SOMLibFormatInputReader
mapFileNameSuffix, unitFileNameSuffix, weightFileNameSuffix
 
Fields inherited from class at.tuwien.ifs.somtoolbox.input.AbstractSOMInputReader
allVectorNames, commonLabelPrefix, dim, gridLayout, gridTopology, labelled, metricName, unitInfo, xSize, ySize, zSize
 
Fields inherited from interface at.tuwien.ifs.somtoolbox.input.SOMInputReader
MAP_FILE, UNIT_FILE, WEIGHT_VECTOR
 
Constructor Summary
MnemonicSOMLibFormatInputReader(String unitDescriptionFileName, String mapDescriptionFileName, int dimension)
           
MnemonicSOMLibFormatInputReader(String weightVectorFileName, String unitDescriptionFileName, String mapDescriptionFileName)
           
MnemonicSOMLibFormatInputReader(String weightVectorFileName, String unitDescriptionFileName, String mapDescriptionFileName, int dimension)
           
 
Method Summary
private  void generateWRandomWeightvectors()
          Generates random weight vectors, but only for those units that are occupied.
 String[] getMappedVecs(int x, int y, int z)
          Returns an array of strings containing the names of vectors mapped onto a certain unit specified by coordinates x and y.
 double[] getMappedVecsDist(int x, int y, int z)
          Returns an array of double values containing the distances between mapped vectors and the unit specified by coordinates x and y.
 int getNrVecMapped(int x, int y, int z)
          Returns the number of vectors mapped onto a certain unit specified by coordinates x and y.
 double[][][][] getVectors()
          Returns a 4-dimensional double array of the weight vectors.
protected  void processUnitElement(String line, int j, int i)
           
protected  void processUnitElement(String line, int k, int j, int i)
           
 
Methods inherited from class at.tuwien.ifs.somtoolbox.input.SOMLibFormatInputReader
getFilePath, getFormatName, getMapDescriptionFileName, getUnitDescriptionFileName, getWeightVectorFileName, readMapDescriptionFile, readUnitDescriptionFile
 
Methods inherited from class at.tuwien.ifs.somtoolbox.input.AbstractSOMInputReader
getBestContextUnitLabels, getBestContextUnitLabels, getCommonVectorLabelPrefix, getContextGateUnitLabels, getContextGateUnitLabels, getDim, getGridLayout, getGridTopology, getKaskiGateUnitLabels, getKaskiGateUnitLabels, getKaskiGateUnitLabelsWgt, getKaskiGateUnitLabelsWgt, getKaskiUnitLabels, getKaskiUnitLabels, getKaskiUnitLabelsWgt, getKaskiUnitLabelsWgt, getMappedVecs, getMappedVecsDist, getMetricName, getNrBestContext, getNrBestContext, getNrContextGateLabels, getNrContextGateLabels, getNrGateWeights, getNrGateWeights, getNrKaskiGateLabels, getNrKaskiGateLabels, getNrKaskiLabels, getNrKaskiLabels, getNrKaskiWeights, getNrKaskiWeights, getNrSomsMapped, getNrSomsMapped, getNrUnitLabels, getNrUnitLabels, getNrVecMapped, getQuantErrorUnit, getQuantErrorUnit, getQuantErrorUnitAvg, getQuantErrorUnitAvg, getUnitLabels, getUnitLabels, getUnitLabelsQe, getUnitLabelsQe, getUnitLabelsWgt, getUnitLabelsWgt, getUrlMappedSoms, getUrlMappedSoms, getXSize, getYSize, getZSize, initUnitInformation, isLabelled
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MnemonicSOMLibFormatInputReader

public MnemonicSOMLibFormatInputReader(String unitDescriptionFileName,
                                       String mapDescriptionFileName,
                                       int dimension)
                                throws FileNotFoundException,
                                       SOMLibFileFormatException
Throws:
FileNotFoundException
SOMLibFileFormatException

MnemonicSOMLibFormatInputReader

public MnemonicSOMLibFormatInputReader(String weightVectorFileName,
                                       String unitDescriptionFileName,
                                       String mapDescriptionFileName)
                                throws FileNotFoundException,
                                       SOMLibFileFormatException
Throws:
FileNotFoundException
SOMLibFileFormatException

MnemonicSOMLibFormatInputReader

public MnemonicSOMLibFormatInputReader(String weightVectorFileName,
                                       String unitDescriptionFileName,
                                       String mapDescriptionFileName,
                                       int dimension)
                                throws FileNotFoundException,
                                       SOMLibFileFormatException
Throws:
FileNotFoundException
SOMLibFileFormatException
Method Detail

processUnitElement

protected void processUnitElement(String line,
                                  int j,
                                  int i)

processUnitElement

protected void processUnitElement(String line,
                                  int k,
                                  int j,
                                  int i)
Overrides:
processUnitElement in class SOMLibFormatInputReader

generateWRandomWeightvectors

private void generateWRandomWeightvectors()
Generates random weight vectors, but only for those units that are occupied.


getVectors

public double[][][][] getVectors()
Description copied from interface: SOMInputReader
Returns a 4-dimensional double array of the weight vectors. The first dimension represents units of a map in horizontal direction, the second dimension represents the units of a map in vertical direction and the third dimension represents units of a map in depth.

Specified by:
getVectors in interface SOMInputReader
Overrides:
getVectors in class AbstractSOMInputReader
Returns:
a 4-dimensional double array of the weight vectors.

getNrVecMapped

public int getNrVecMapped(int x,
                          int y,
                          int z)
Description copied from interface: SOMInputReader
Returns the number of vectors mapped onto a certain unit specified by coordinates x and y. If the coordinates are invalid, an ArrayIndexOutOfBoundsException will be thrown. The calling function is not obliged to catch it.

Specified by:
getNrVecMapped in interface SOMInputReader
Overrides:
getNrVecMapped in class AbstractSOMInputReader
Parameters:
x - horizontal position of the unit on the map.
y - vertical position of the unit on the map.
z - TODO
Returns:
the number of vectors mapped onto a certain unit specified by coordinates x and y.

getMappedVecs

public String[] getMappedVecs(int x,
                              int y,
                              int z)
Description copied from interface: SOMInputReader
Returns an array of strings containing the names of vectors mapped onto a certain unit specified by coordinates x and y. If the coordinates are invalid, an ArrayIndexOutOfBoundsException will be thrown. The calling function is not obliged to catch it.

Specified by:
getMappedVecs in interface SOMInputReader
Overrides:
getMappedVecs in class AbstractSOMInputReader
Parameters:
x - horizontal position of the unit on the map.
y - vertical position of the unit on the map.
z - TODO
Returns:
an array of strings containing the names of vectors mapped onto a certain unit specified by coordinates x and y.

getMappedVecsDist

public double[] getMappedVecsDist(int x,
                                  int y,
                                  int z)
Description copied from interface: SOMInputReader
Returns an array of double values containing the distances between mapped vectors and the unit specified by coordinates x and y. If the coordinates are invalid, an ArrayIndexOutOfBoundsException will be thrown. The calling function is not obliged to catch it.

Specified by:
getMappedVecsDist in interface SOMInputReader
Overrides:
getMappedVecsDist in class AbstractSOMInputReader
Parameters:
x - horizontal position of the unit on the map.
y - vertical position of the unit on the map.
z - TODO
Returns:
an array of double values containing the distances between mapped vectors and the unit specified by coordinates x and y.