|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectat.tuwien.ifs.somtoolbox.layers.GrowingLayer
public class GrowingLayer
Implementation of a growing Self-Organizing Map layer that can also be static in size. Layer growth is based on the quantization errors of the units and the distance to their respective neighboring units.
Nested Class Summary | |
---|---|
static class |
GrowingLayer.Flip
|
static class |
GrowingLayer.Rotation
|
(package private) class |
GrowingLayer.UpdaterThread
|
Nested classes/interfaces inherited from interface at.tuwien.ifs.somtoolbox.layers.Layer |
---|
Layer.GridLayout, Layer.GridTopology |
Constructor Summary | |
---|---|
GrowingLayer(int xSize,
int ySize,
int zSize,
String metricName,
int dim,
boolean normalized,
boolean usePCA,
long seed,
InputData data)
Convenience constructor for top layer map of GHSOM or a single map. |
|
GrowingLayer(int xSize,
int ySize,
String metricName,
int dim,
boolean normalized,
boolean usePCA,
long seed,
InputData data)
Convenience constructor for top layer map of GHSOM or a single map. |
|
GrowingLayer(int id,
Unit su,
int xSize,
int ySize,
int zSize,
String metricName,
int dim,
boolean normalized,
boolean usePCA,
long seed,
InputData data)
Constructor for a new, untrained layer. |
|
GrowingLayer(int id,
Unit su,
int xSize,
int ySize,
int zSize,
String metricName,
int dim,
double[][][][] vectors,
long seed)
Constructor for an already trained layer as specified by 2-dimensional array of d-dimensional weight vectors as argument vectors . |
|
GrowingLayer(int id,
Unit su,
int xSize,
int ySize,
String metricName,
int dim,
boolean normalized,
boolean usePCA,
long seed,
InputData data)
Constructor for a new, untrained layer. |
|
GrowingLayer(int id,
Unit su,
int xSize,
int ySize,
String metricName,
int dim,
double[][][] vectors,
long seed)
Constructor for an already trained layer as specified by 2-dimensional array of d-dimensional weight vectors as argument vectors . |
Method Summary | |
---|---|
protected static double[][][][] |
addDimension(int x,
int y,
double[][][] vec)
|
void |
calculateQuantizationErrorForUnits()
Calculates the quantization error for all units of the layer. |
static void |
checkRotation(int rotation)
|
void |
clearLabels()
Removes all labels from the units. |
void |
clearMappedInput()
Removes all mapped input data from the units. |
Object |
clone()
Clone might not be fully functional! |
InputCorrections |
computeUnitFeatureWeights(InputCorrections corrections,
InputData data,
Unit.FeatureWeightMode mode)
Implementation of general weighting as in Nünrberger/Detyniecki, 'Weighted Self-Organizing Maps: Incorporating User Feedback' |
boolean |
equalWeights(GrowingLayer otherLayer)
Checks whether this and the given GrowingLayer are equal in their weight (model) vectors. |
void |
flip(GrowingLayer.Flip flip)
Flip the layer. |
Unit[][] |
get2DUnits()
Returns all units with depth 0 of the layer |
String[] |
getAllMappedDataNames()
|
String[] |
getAllMappedDataNames(boolean sort)
Returns all mapped inputs from all the units of the layer in an array. |
ArrayList<String> |
getAllMappedDataNamesAsList()
|
ArrayList<GrowingSOM> |
getAllSubMaps()
|
Unit[] |
getAllUnits()
Returns all units of the layer in an array. |
int[][] |
getBinAssignment(int component,
int bins)
|
Point2D[][] |
getBinCentres(int bins)
|
Point2D[] |
getBinCentres(int[][] binAssignment,
int bins)
|
ArrayList<ComponentLine2D> |
getBinCentresAsList(int bins)
|
double |
getBinDeviation(int[][] binAssignment,
int bins)
|
String |
getCommonVectorLabelPrefix()
|
double[][] |
getComponentPlane(int component)
Returns a component plane of the component specified by the argument component . |
double[][] |
getComponentPlane(int component,
int z)
Returns a component plane of the component specified by the argument component . |
double[][][] |
getComponentPlane3D(int component)
|
InputData |
getData()
|
double[] |
getDeviation(int bins)
|
int |
getDim()
Returns the dimensionality of the weight vectors. |
private int |
getDimension(int x,
int y,
int z,
double[][][][] vectors)
Needed for mnemonic (sparse) SOMs to find out the vector dimension, by finding the first non-null vector in the array |
private Unit |
getErrorUnit(QualityMeasure qm,
String methodName)
Returns the unit having the highest quantization error. |
double[][] |
getExtremes()
|
private String[] |
getFirstNLabels(int n,
ArrayList<InputNameDistance> items)
|
Layer.GridLayout |
getGridLayout()
|
Layer.GridTopology |
getGridTopology()
|
int |
getIdentifier()
Returns the ID of the layer. |
String |
getIdString()
Returns the identification string of the map layer. |
private double[] |
getInputVector(String query,
SOMLibTemplateVector templateVector)
|
int |
getLevel()
Returns the level of the map layer in a hierarchical model. |
double |
getMapDistance(int x1,
int y1,
int x2,
int y2)
|
double |
getMapDistance(int x1,
int y1,
int z1,
int x2,
int y2,
int z2)
Returns the distance between two units on the map grid. |
double |
getMapDistance(Unit u1,
Unit u2)
Returns the distance between two units on the map grid. |
double |
getMapDistanceSq(int x1,
int y1,
int z1,
int x2,
int y2,
int z2)
|
double |
getMapDistanceSq(Unit u1,
Unit u2)
|
DistanceMetric |
getMetric()
Calculates and returns the mean quantization error of the map based on the quantization errors of the single units. |
protected Unit |
getMostDissimilarNeighbor(Unit u)
Returns the neighboring unit of a unit specified by argument u with the most distant weight vector. |
ArrayList<Unit> |
getNeighbouringUnits(int x,
int y)
|
ArrayList<Unit> |
getNeighbouringUnits(int x,
int y,
double radius)
Convenience method for getNeighbouringUnits(int, int, int, double) |
private ArrayList<Unit> |
getNeighbouringUnits(int x,
int y,
int z)
|
ArrayList<Unit> |
getNeighbouringUnits(int x,
int y,
int z,
double radius)
Gets neighbours within a certain radius; uses getMapDistance(int, int, int, int, int, int) for map
distance computation |
protected ArrayList<Unit> |
getNeighbouringUnits(Unit u)
Get direct neighbours of the given unit. |
protected ArrayList<Unit> |
getNeighbouringUnits(Unit u,
double radius)
Convenience method for getNeighbouringUnits(int, int, int, double) |
String[] |
getNNearestInputs(String datumlabel,
int n,
InputData data)
|
String[] |
getNNearestInputs(Unit u,
int n)
|
static int |
getNO_CPUS()
|
int |
getNumberOfMappedInputs()
Returns the total number of Inputs mapped on all units in the map layer. |
int |
getNumberOfNotEmptyUnits()
Calculates and returns the number of units that are not empty, i.e. |
ArrayList<ComponentRegionCount> |
getNumberOfRegions(int bins)
|
private int |
getNumberOfRegions(int[][] regionAssignement)
|
QualityMeasure |
getQualityMeasure()
Returns the quality information. |
private int[][] |
getRegionAssignement(int[][] binAssignement,
int numberOfBins)
|
String |
getRevision()
Returns the revision string of this layer. |
Unit |
getSuperUnit()
Returns the superordinate unit, or null if none exists. |
Unit |
getUnit(int x,
int y)
Returns the Unit at the position specified by the x and y arguments. |
Unit |
getUnit(int x,
int y,
int z)
Returns the Unit at the position specified by the x and y arguments. |
int |
getUnitCount()
|
cern.colt.matrix.DoubleMatrix2D |
getUnitDistanceMatrix()
Computes a distance matrix between all Unit s in the Layer |
Unit |
getUnitForDatum(String name)
Returns the unit onto which the datum specified by its name by argument name is mapped. |
Unit |
getUnitForIndex(int index)
|
int |
getUnitIndex(int x,
int y)
Returns the index of given unit coordinates. |
Unit[][][] |
getUnits()
Returns all units of the layer in a 3D array. |
AdaptiveCoordinatesVirtualLayer |
getVirtualLayer()
|
Unit |
getWinner(InputDatum input)
Returns the winner unit for a given input datum specified by argument input . |
Unit |
getWinner(InputDatum input,
AbstractWeightedMetric metric)
Returns the winner for a given unit, using a weighted distance metric. |
Unit |
getWinner(InputDatum input,
DistanceMetric metric)
Returns the winner unit for a given input datum specified by argument input . |
Unit |
getWinnerFromQuery(String query,
SOMLibTemplateVector templateVector)
Return the winning unit for the given query. |
Unit[] |
getWinners(InputDatum input,
int num)
|
Unit[] |
getWinners(InputDatum input,
int num,
DistanceMetric metric)
Returns a number of best-matching units sorted by distance (ascending) for a given input datum. |
UnitDistance[] |
getWinnersAndDistances(InputDatum input,
int num)
Returns a number of best-matching units and distances sorted by distance (ascending) for a given input datum. |
Unit[] |
getWinnersFromQuery(String query,
int num,
SOMLibTemplateVector templateVector)
|
String[] |
getWinningInputDataFromQuery(String query,
int num,
SOMLibTemplateVector templateVector)
|
int |
getXSize()
Returns the width of the map layer. |
int |
getYSize()
Returns the height of the map layer. |
int |
getZSize()
Returns the depth of the map layer. |
boolean |
hasMappedInput(int x,
int y)
|
boolean |
hasNeighbours(int x,
int y)
|
boolean |
hasNeighbours(int x,
int y,
int z)
|
private void |
initCPURanges()
|
private void |
insertRowColumn(Unit a,
Unit b,
ProgressListener listener)
Inserts a row or column of units between units specified by argument a and b . |
boolean |
isEdgeColumn(int x)
|
boolean |
isEdgeRow(int y)
|
boolean |
isValidUnitLocation(int x,
int y)
|
boolean |
isValidUnitLocation(Point pos)
|
private void |
mapCompleteDataAfterTraining(InputData data)
Maps data onto layer without recalculating the quantization error after every single input datum. FIXME: add multi-threading |
void |
mapData(InputData data)
Maps input data onto layer. |
Unit |
mapDatum(InputDatum datum)
Maps a single input datum onto the layer and returns the winning unit. |
double |
maxNeighbourhoodRadius()
Computes the maximum value the neighbourhood radius can take, that is in the diagonal from one corner to the other. |
double |
neighbourhoodFeatureWeight(double dist,
int maxDist)
|
private void |
printInfo(double targetQualityValue,
String[] qmNameMethod,
QualityMeasure qm)
|
String |
printSize()
|
String |
printUnitIndices()
|
private void |
processRegionRecursive(int[][] binAssignment,
int[][] regionAssignment,
int x,
int y)
|
void |
rotate(GrowingLayer.Rotation rotation)
Clockwise rotate the layer by the given degrees. |
void |
rotate(int rotation)
|
void |
setCommonVectorLabelPrefix(String commonVectorLabelPrefix)
|
void |
setGridLayout(Layer.GridLayout gridLayout)
|
void |
setGridTopology(Layer.GridTopology gridTopology)
|
static void |
setNO_CPUS(int no_cpus)
|
void |
setQualityMeasure(String qualityMeasureName)
|
void |
setTrainingInterruptionListener(TrainingInterruptionListener t,
int i)
Assigns an object that implements the TrainingInterruptionListener interface to perform actions in
certain intervals during training determined by argument i . |
private boolean |
specialClassMode(SOMProperties trainingProps)
|
QualityMeasure |
train(InputData data,
double initialLearnrate,
double initialSigma,
int numIterations,
double tau,
double targetQualityValue,
String qualityMeasureName,
SOMProperties trainingProps)
Trains the layer with the input data. |
QualityMeasure |
train(InputData data,
double iniLearnrate,
double iniSigma,
int numIterations,
double tau,
String qualityMeasureName,
SOMProperties trainingProps)
Trains the layer with the input data. |
QualityMeasure |
train(InputData data,
double initialLearnrate,
double initialSigma,
int numIterations,
int startIteration,
double tau,
double targetQualityValue,
String qualityMeasureName,
SOMProperties trainingProps)
Trains the layer with the input data. |
QualityMeasure |
train(InputData data,
double iniLearnrate,
double iniSigma,
int numIterations,
int startIteration,
double tau,
String qualityMeasureName,
SOMProperties trainingProps)
Trains the layer with the input data. |
private void |
trainNormal(InputData data,
int numIterations,
int startIteration,
SOMProperties trainingProps,
double initialLearnrate,
double initialSigma,
double expParam,
double expParam2,
ProgressListener progressWriter)
|
private void |
trainSpecial(InputData data,
int numIterations,
int startIteration,
SOMProperties trainingProps,
double initialLearnrate,
double initialSigma,
double expParam,
double expParam2,
SOMLibClassInformation classInfo,
double minProbability,
ProgressListener progressWriter)
|
private void |
updateUnits(Unit winner,
InputDatum input,
double learnrate,
double sigma)
|
private void |
updateUnitsInArea(Unit winner,
double learnrate,
double opt1,
double[] inputVector,
Cuboid range)
|
private void |
updateUnitsInArea(Unit winner,
double learnrate,
double opt1,
double[] inputVector,
int startX,
int endX,
int startY,
int endY,
int startZ,
int endZ)
|
private void |
updateUnitsNoBorder(Unit winner,
InputDatum input,
double learnrate,
double sigma)
Updates the weight vectors of the all map units with respect to the input datum and the according winner unit. |
protected void |
updateUnitsNormal(Unit winner,
InputDatum input,
double learnrate,
double sigma)
Updates the weight vectors of the all map units with respect to the input datum and the according winner unit. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final double CUTOFF_SIGMA
public static final int[] ROTATIONS
protected int dim
private int identifier
private int interruptEvery
private int level
protected DistanceMetric metric
protected AbstractWeightedMetric metricWeighted
private String metricName
private boolean normalized
private QualityMeasure qualityMeasure
private Random rand
private Random randSkipProbability
private final String revision
private Unit superUnit
private TrainingInterruptionListener til
protected Unit[][][] units
protected int xSize
protected int ySize
protected int zSize
double[] minFeatureValues
double[] maxFeatureValues
protected Layer.GridLayout gridLayout
protected Layer.GridTopology gridTopology
private Hashtable<Integer,Point2D[][]> binAssignmentCache
private Hashtable<Integer,ArrayList<ComponentRegionCount>> regionAssignmentCache
private static int THREAD_COUNT
private CountDownLatch doneSignal
private ExecutorService e
private Cuboid[] ranges
private final int threadsUsed
private int notEmptyUnits
getNumberOfNotEmptyUnits()
, as the calculation of the value is only
performed by that method and stored for future access.
private InputData data
int skippedNonSelected
int trainedNonSelected
private String commonVectorLabelPrefix
public cern.colt.matrix.DoubleMatrix2D unitDistanceMatrix
private AdaptiveCoordinatesVirtualLayer virtualLayer
Constructor Detail |
---|
public GrowingLayer(int xSize, int ySize, String metricName, int dim, boolean normalized, boolean usePCA, long seed, InputData data)
null
.
xSize
- the number of columns.ySize
- the number of rows.metricName
- the name of the distance metric to use.dim
- the dimensionality of the weight vectors.normalized
- the type of normalization that is applied to the weight vectors of newly created units. This is
usually Normalization.NONE
or Normalization.UNIT_LEN
.seed
- the random seed for creation of the units' weight vectors.public GrowingLayer(int xSize, int ySize, int zSize, String metricName, int dim, boolean normalized, boolean usePCA, long seed, InputData data)
null
.
xSize
- the number of columns.ySize
- the number of rows.zSize
- the depthmetricName
- the name of the distance metric to use.dim
- the dimensionality of the weight vectors.normalized
- the type of normalization that is applied to the weight vectors of newly created units. This is
usually Normalization.NONE
or Normalization.UNIT_LEN
.seed
- the random seed for creation of the units' weight vectors.public GrowingLayer(int id, Unit su, int xSize, int ySize, String metricName, int dim, boolean normalized, boolean usePCA, long seed, InputData data)
id
- the unique id of the layer in a hierarchy.su
- the pointer to the corresponding unit in the upper layer map.xSize
- the number of units in horizontal direction.ySize
- the number of units in vertical direction.metricName
- the name of the distance metric to use.dim
- the dimensionality of the weight vectors.normalized
- the type of normalization that is applied to the weight vectors of newly created units. This is
usually Normalization.NONE
or Normalization.UNIT_LEN
.seed
- the random seed for creation of the units' weight vectors.public GrowingLayer(int id, Unit su, int xSize, int ySize, int zSize, String metricName, int dim, boolean normalized, boolean usePCA, long seed, InputData data)
id
- the unique id of the layer in a hierarchy.su
- the pointer to the corresponding unit in the upper layer map.xSize
- the number of units in horizontal direction.ySize
- the number of units in vertical direction.zSize
- the number of units in depthmetricName
- the name of the distance metric to use.dim
- the dimensionality of the weight vectors.normalized
- the type of normalization that is applied to the weight vectors of newly created units. This is
usually Normalization.NONE
or Normalization.UNIT_LEN
.seed
- the random seed for creation of the units' weight vectors.public GrowingLayer(int id, Unit su, int xSize, int ySize, String metricName, int dim, double[][][] vectors, long seed) throws SOMToolboxException
vectors
.
xSize
- the number of columns.ySize
- the number of rows.metricName
- the name of the distance metric to use.dim
- the dimensionality of the weight vectors.vectors
- the three dimensional array of d
dimensional weight vectors.seed
- the random seed for creation of the units' weight vectors.
SOMToolboxException
- if arguments x
, y
and d
do not correspond to
the dimensions of argument vectors
.public GrowingLayer(int id, Unit su, int xSize, int ySize, int zSize, String metricName, int dim, double[][][][] vectors, long seed) throws SOMToolboxException
vectors
.
xSize
- the number of columns.ySize
- the number of rows.zSize
- the depthmetricName
- the name of the distance metric to use.dim
- the dimensionality of the weight vectors.vectors
- the two dimensional array of d
dimensional weight vectors.seed
- the random seed for creation of the units' weight vectors.
SOMToolboxException
- if arguments x
, y
and d
do not correspond to
the dimensions of argument vectors
.Method Detail |
---|
protected static double[][][][] addDimension(int x, int y, double[][][] vec)
public boolean equalWeights(GrowingLayer otherLayer)
GrowingLayer
are equal in their weight (model) vectors. Other
information, such as mapping of vectors, labels, is not considered. This method can e.g. be utilised to check if
two layers have been trained equally.
private int getDimension(int x, int y, int z, double[][][][] vectors)
public void calculateQuantizationErrorForUnits()
public void clearLabels()
public void clearMappedInput()
public Unit[] getAllUnits()
getAllUnits
in interface Layer
public ArrayList<GrowingSOM> getAllSubMaps()
public Unit[][] get2DUnits()
public Unit[][][] getUnits()
public boolean hasMappedInput(int x, int y)
public String[] getAllMappedDataNames(boolean sort)
sort
- indicates whether the labels should be sorted (alphabetically)
public ArrayList<String> getAllMappedDataNamesAsList()
public String[] getAllMappedDataNames()
public double[][][] getComponentPlane3D(int component)
public double[][] getComponentPlane(int component)
Layer
component
. Returns
null
, if the argument component
is out of range.
getComponentPlane
in interface Layer
component
- the index of the component.
null
if argument component
is invalid.public double[][] getComponentPlane(int component, int z)
Layer
component
. Returns
null
, if the argument component
is out of range.
getComponentPlane
in interface Layer
component
- the index of the component.z
- TODO
null
if argument component
is invalid.public double[][] getExtremes() throws LayerAccessException
LayerAccessException
public int[][] getBinAssignment(int component, int bins)
public Point2D[] getBinCentres(int[][] binAssignment, int bins)
public Point2D[][] getBinCentres(int bins)
public ArrayList<ComponentLine2D> getBinCentresAsList(int bins)
public double getBinDeviation(int[][] binAssignment, int bins)
public double[] getDeviation(int bins)
private int[][] getRegionAssignement(int[][] binAssignement, int numberOfBins) throws LayerAccessException
LayerAccessException
private void processRegionRecursive(int[][] binAssignment, int[][] regionAssignment, int x, int y) throws LayerAccessException
LayerAccessException
private int getNumberOfRegions(int[][] regionAssignement)
public ArrayList<ComponentRegionCount> getNumberOfRegions(int bins) throws LayerAccessException
LayerAccessException
public int getDim()
private Unit getErrorUnit(QualityMeasure qm, String methodName)
public int getIdentifier()
public String getIdString()
Layer
getIdString
in interface Layer
public int getLevel()
Layer
getLevel
in interface Layer
public double getMapDistance(int x1, int y1, int x2, int y2)
public double getMapDistance(int x1, int y1, int z1, int x2, int y2, int z2)
Layer
getMapDistance
in interface Layer
x1
- the horizontal position of the first unit.y1
- the vertical position of the first unit.z1
- the height position of the first unit.x2
- the horizontal position of the second unit.y2
- the vertical position of the second unit.z2
- the height position of the second unit.
public double getMapDistance(Unit u1, Unit u2)
Layer
getMapDistance
in interface Layer
u1
- the first unit.u2
- the second unit.
public double getMapDistanceSq(int x1, int y1, int z1, int x2, int y2, int z2)
public double getMapDistanceSq(Unit u1, Unit u2)
public DistanceMetric getMetric()
getMetric
in interface Layer
protected Unit getMostDissimilarNeighbor(Unit u)
u
with the most distant weight vector.
u
- the unit for which the most dissimilar neighbor should be determined.
public QualityMeasure getQualityMeasure()
Layer
getQualityMeasure
in interface Layer
null
if not existent.public String getRevision()
Layer
getRevision
in interface Layer
public Unit getSuperUnit()
null
if none exists.
null
if none exists.public Unit getUnit(int x, int y) throws LayerAccessException
Layer
Unit
at the position specified by the x
and y
arguments. A
LayerAccessException
is thrown, if the coordinates are invalid.
getUnit
in interface Layer
x
- the horizontal position on the map layer.y
- the vertical position on the map layer.
LayerAccessException
- if the coordinates are out of range.public Unit getUnit(int x, int y, int z) throws LayerAccessException
Layer
Unit
at the position specified by the x
and y
arguments. A
LayerAccessException
is thrown, if the coordinates are invalid.
getUnit
in interface Layer
x
- the horizontal position on the map layer.y
- the vertical position on the map layer.z
- TODO
LayerAccessException
- if the coordinates are out of range.public int getUnitIndex(int x, int y)
getAllUnits()
.
public Unit getUnitForIndex(int index) throws LayerAccessException
LayerAccessException
public Unit getUnitForDatum(String name)
Layer
name
is mapped.
getUnitForDatum
in interface Layer
name
- the name of the input datum to be searched for.
null
if the datum is not found on the map.public Unit getWinner(InputDatum input, DistanceMetric metric)
input
.
input
- the input datum for which the winner unit will be searched.metric
- the metric to be used.
public Unit getWinner(InputDatum input, AbstractWeightedMetric metric)
public Unit getWinner(InputDatum input)
input
.
input
- the input datum for which the winner unit will be searched.
public Unit getWinnerFromQuery(String query, SOMLibTemplateVector templateVector)
public Unit[] getWinnersFromQuery(String query, int num, SOMLibTemplateVector templateVector)
public String[] getWinningInputDataFromQuery(String query, int num, SOMLibTemplateVector templateVector)
private double[] getInputVector(String query, SOMLibTemplateVector templateVector)
public Unit[] getWinners(InputDatum input, int num, DistanceMetric metric)
input
- the input datum for which the best-matching units will be searched.num
- the number of best-matching units.
public Unit[] getWinners(InputDatum input, int num)
public UnitDistance[] getWinnersAndDistances(InputDatum input, int num)
input
- the input datum for which the winner unit will be searched.num
- the number of best-matching units.
Vector
containing an array of Unit (elementAt(0)) and array of double (elementAt(1))
containing best-matching units sorted ascending by distance from the input datum.public int getXSize()
Layer
getXSize
in interface Layer
public int getYSize()
Layer
getYSize
in interface Layer
public int getZSize()
Layer
getZSize
in interface Layer
public int getUnitCount()
public boolean hasNeighbours(int x, int y) throws LayerAccessException
LayerAccessException
public boolean hasNeighbours(int x, int y, int z) throws LayerAccessException
LayerAccessException
public boolean isEdgeColumn(int x) throws LayerAccessException
LayerAccessException
public boolean isEdgeRow(int y) throws LayerAccessException
LayerAccessException
private void insertRowColumn(Unit a, Unit b, ProgressListener listener)
a
and b
.
a
- a unit on the layer.b
- a unit on the layer.private void mapCompleteDataAfterTraining(InputData data)
data
- input data to be mapped onto layer.public void mapData(InputData data)
data
- input data to be mapped onto layer.public Unit mapDatum(InputDatum datum)
datum
- input datum to be mapped onto the layer.
public void setTrainingInterruptionListener(TrainingInterruptionListener t, int i)
TrainingInterruptionListener
interface to perform actions in
certain intervals during training determined by argument i
.
t
- the listening object.i
- the number of training cycles after which the training process is interrupted.public QualityMeasure train(InputData data, double iniLearnrate, double iniSigma, int numIterations, double tau, String qualityMeasureName, SOMProperties trainingProps)
tau
is 1, a fix-sized layer is
trained, otherwise the layer grows until a certain quality criterion determined by tau
and the mean
quantization error of the data (which is automatically calculated) is reached. The process ends with all training
data being mapped onto the growing SOM. The units' quantization errors are calculated.
data
- input data to train the layer with.iniLearnrate
- initial value of learnrate.iniSigma
- initial sigma determining the neighborhood of the winner.numIterations
- the number of iterations until the mapping quality check.tau
- the fraction of the map's quantization error that determines the quality of the mapping.public QualityMeasure train(InputData data, double iniLearnrate, double iniSigma, int numIterations, int startIteration, double tau, String qualityMeasureName, SOMProperties trainingProps)
tau
is 1, a fix-sized layer is
trained, otherwise the layer grows until a certain quality criterion determined by tau
and the mean
quantization error of the data (which is automatically calculated) is reached. The process ends with all training
data being mapped onto the growing SOM. The units' quantization errors are calculated.
data
- input data to train the layer with.iniLearnrate
- initial value of learnrate.iniSigma
- initial sigma determining the neighborhood of the winner.numIterations
- the number of iterations until the mapping quality check.startIteration
- start with iteration x -- important for Lernrate / Sigma calculationtau
- the fraction of the map's quantization error that determines the quality of the mapping.public QualityMeasure train(InputData data, double initialLearnrate, double initialSigma, int numIterations, double tau, double targetQualityValue, String qualityMeasureName, SOMProperties trainingProps)
tau
is 1, a fix-sized layer is
trained, otherwise the layer grows until a certain quality criterion determined by tau
and the mean
quantization error specified by argument mqe0
is reached. The process ends with all training data
being mapped onto the growing SOM. The units' quantization errors are calculated.
data
- input data to train the layer with.initialLearnrate
- initial value of learnrate.initialSigma
- initial sigma determining the neighbourhood of the winner.numIterations
- the number of iterations until the mapping quality check.tau
- the fraction of the map's quantisation error that determines the quality of the mapping.targetQualityValue
- mean quantisation error determining the desired granularity of data representation.
Used for layers in GHSOMs.public QualityMeasure train(InputData data, double initialLearnrate, double initialSigma, int numIterations, int startIteration, double tau, double targetQualityValue, String qualityMeasureName, SOMProperties trainingProps)
tau
is 1, a fix-sized layer is
trained, otherwise the layer grows until a certain quality criterion determined by tau
and the mean
quantization error specified by argument mqe0
is reached. The process ends with all training data
being mapped onto the growing SOM. The units' quantization errors are calculated.
data
- input data to train the layer with.numIterations
- the number of iterations until the mapping quality check.startIteration
- start with iteration x -- important for Learnrate / Sigma calculationtau
- the fraction of the map's quantisation error that determines the quality of the mapping.targetQualityValue
- mean quantisation error determining the desired granularity of data representation.
Used for layers in GHSOMs.initialLearnrate
- initial value of learnrate.initialSigma
- initial sigma determining the neighbourhood of the winner.private void trainSpecial(InputData data, int numIterations, int startIteration, SOMProperties trainingProps, double initialLearnrate, double initialSigma, double expParam, double expParam2, SOMLibClassInformation classInfo, double minProbability, ProgressListener progressWriter)
private void trainNormal(InputData data, int numIterations, int startIteration, SOMProperties trainingProps, double initialLearnrate, double initialSigma, double expParam, double expParam2, ProgressListener progressWriter)
private boolean specialClassMode(SOMProperties trainingProps)
private void initCPURanges()
private void printInfo(double targetQualityValue, String[] qmNameMethod, QualityMeasure qm) throws QualityMeasureNotFoundException
QualityMeasureNotFoundException
private void updateUnits(Unit winner, InputDatum input, double learnrate, double sigma)
private void updateUnitsNoBorder(Unit winner, InputDatum input, double learnrate, double sigma)
winner
- the winner unit.input
- the input datum.learnrate
- the learnrate.sigma
- the width of the Gaussian determining the neighborhood radius.protected void updateUnitsNormal(Unit winner, InputDatum input, double learnrate, double sigma)
winner
- the winner unit.input
- the input datum.learnrate
- the learnrate.sigma
- the width of the Gaussian determining the neighborhood radius.private void updateUnitsInArea(Unit winner, double learnrate, double opt1, double[] inputVector, Cuboid range)
private void updateUnitsInArea(Unit winner, double learnrate, double opt1, double[] inputVector, int startX, int endX, int startY, int endY, int startZ, int endZ)
public int getNumberOfNotEmptyUnits() throws LayerAccessException
LayerAccessException
public void setQualityMeasure(String qualityMeasureName)
public InputData getData()
public String[] getNNearestInputs(String datumlabel, int n, InputData data) throws LayerAccessException, MetricException
LayerAccessException
MetricException
public String[] getNNearestInputs(Unit u, int n) throws LayerAccessException
LayerAccessException
private String[] getFirstNLabels(int n, ArrayList<InputNameDistance> items)
protected ArrayList<Unit> getNeighbouringUnits(Unit u) throws LayerAccessException
LayerAccessException
public ArrayList<Unit> getNeighbouringUnits(int x, int y) throws LayerAccessException
LayerAccessException
private ArrayList<Unit> getNeighbouringUnits(int x, int y, int z) throws LayerAccessException
LayerAccessException
protected ArrayList<Unit> getNeighbouringUnits(Unit u, double radius) throws LayerAccessException
getNeighbouringUnits(int, int, int, double)
LayerAccessException
public ArrayList<Unit> getNeighbouringUnits(int x, int y, double radius) throws LayerAccessException
getNeighbouringUnits(int, int, int, double)
LayerAccessException
public ArrayList<Unit> getNeighbouringUnits(int x, int y, int z, double radius) throws LayerAccessException
getMapDistance(int, int, int, int, int, int)
for map
distance computation
LayerAccessException
public cern.colt.matrix.DoubleMatrix2D getUnitDistanceMatrix()
Unit
s in the Layer
public boolean isValidUnitLocation(Point pos)
public boolean isValidUnitLocation(int x, int y)
public int getNumberOfMappedInputs()
Layer
getNumberOfMappedInputs
in interface Layer
public InputCorrections computeUnitFeatureWeights(InputCorrections corrections, InputData data, Unit.FeatureWeightMode mode) throws SOMToolboxException
SOMToolboxException
public double maxNeighbourhoodRadius()
public double neighbourhoodFeatureWeight(double dist, int maxDist)
public static int getNO_CPUS()
public static void setNO_CPUS(int no_cpus)
public void flip(GrowingLayer.Flip flip)
public void rotate(int rotation) throws SOMToolboxException
SOMToolboxException
public void rotate(GrowingLayer.Rotation rotation)
public static void checkRotation(int rotation) throws SOMToolboxException
SOMToolboxException
public String printUnitIndices()
public String printSize()
public void setCommonVectorLabelPrefix(String commonVectorLabelPrefix)
public String getCommonVectorLabelPrefix()
public Layer.GridLayout getGridLayout()
getGridLayout
in interface Layer
public Layer.GridTopology getGridTopology()
getGridTopology
in interface Layer
public void setGridLayout(Layer.GridLayout gridLayout)
public void setGridTopology(Layer.GridTopology gridTopology)
public Object clone() throws CloneNotSupportedException
clone
in class Object
CloneNotSupportedException
Object.clone()
public AdaptiveCoordinatesVirtualLayer getVirtualLayer()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |