Layer.GridLayout, Layer.GridTopology
Modifier and Type | Field and Description |
---|---|
private float |
alpha
Reduction Factor for signal counter
|
private double |
attractScale
Scaling Factor for gravity between Units
|
private double |
coherenceForceFactor
Scaling Factor for gravity between Units independent of connectedness/distance
|
private InputData |
data
Data used for training
|
private int |
dim
Dimensions of the input-data
|
private javax.swing.JFrame |
display
Frame used to display the CellUnits
|
private double[] |
emptyUnitMarkVector
Weight-Vector for Units that fill holes in unitfield
|
private float |
epsilonB
Adaption Factor of best matching unit
|
private float |
epsilonN
Adaption Factor of neighbors of best matching unit
|
private float |
eta
Cutoff-Value for normalized probability density
|
private int |
lamda
Number of adaption steps between adding/removing of Units
|
private int |
maxEpochs
Number of Iterations on the input data
|
private DistanceMetric |
metric
Distance Metric used for GrowingCellStructures
|
private QualityMeasure |
qualityMeasure
QualityMesure used for GrowingCellStructures
|
private java.util.Random |
rand
Random Nr Generator for Weight-Vector initialisation
|
private double |
repellingScale
Scaling Factor for repulsion between Units
|
private java.util.List<GrowingCellTetraheder> |
tetraheders
List of Tetraheders formed by the Units
|
private GrowingCellUnit[][] |
unitfield
Storagearray for Units for export
|
private java.util.List<GrowingCellUnit> |
units
List of Units that get trained
|
Constructor and Description |
---|
GrowingCellLayer(int dim,
boolean normalize,
long randomSeed,
InputData data)
Std.
|
Modifier and Type | Method and Description |
---|---|
private void |
addAttractingForce(GrowingCellUnit unitToMove,
GrowingCellUnit unitForcing,
double[] attractingForce)
Calculate the attracting force between unitToMove and unitForcing and store it in attractingForce
|
private void |
addRepellingForce(GrowingCellUnit unitToMove,
GrowingCellUnit unitForcing,
double[] force)
Calculate the repelling force between unitToMove and unitForcing and store it in force
|
private void |
analyzeDimension(GrowingCellUnit[][] data,
int[] dimandoffset)
Analyses maximum extension of the Units in data and their offset
|
private void |
analyzeDimension(java.util.List<GrowingCellUnit> units,
int[] dimandoffset)
Analyses maximum extension of the Units in units and their offset
|
private double |
calculateVoronoiEstimate(GrowingCellUnit u)
Calculates the voronoi region estimate for unit u
|
private void |
calculateVoronoiEstimate(java.util.List<GrowingCellUnit> neighborsToBe)
Sets the voronoiEstimate of all neighborsToBe
|
private void |
checkConsistency()
Checks consistency of tetraheders and units
|
private void |
clearMappedInput()
Clears the mapped Input of every unit
|
private void |
correctUnitPositions()
Correct Unit Positions so that they stay at the upper left corner (10,10) and don't drift away
|
private void |
decreaseSignalCounters()
Decrease SignalCoutners of units by alpha percent
|
java.util.Collection<? extends GrowingCellStructures> |
getAllSubMaps() |
Unit[] |
getAllUnits()
Returns an array of all units in the map layer; the specific order of the units is unspecified.
|
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 . |
InputData |
getData() |
int |
getDim() |
private double |
getDistance(double[] v1,
double[] v2) |
private GrowingCellUnit |
getFarthestNeighbor(GrowingCellUnit unit) |
Layer.GridLayout |
getGridLayout() |
Layer.GridTopology |
getGridTopology() |
java.lang.String |
getIdString()
Returns the identification string of the map layer.
|
private java.util.List<GrowingCellUnit> |
getInsertionTopologicalNeighbors(GrowingCellUnit sfwinner,
GrowingCellUnit sfpartner) |
int |
getLevel()
Returns the level of the map layer in a hierarchical model.
|
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.
|
DistanceMetric |
getMetric()
Returns the metric used for distance calculation.
|
int |
getNumberOfMappedInputs()
Returns the total number of Inputs mapped on all units in the map layer.
|
QualityMeasure |
getQualityMeasure()
Returns the quality information.
|
java.lang.String |
getRevision()
Returns the revision string of this layer.
|
private GrowingCellUnit |
getSignalFrequencyWinner() |
private java.util.List<GrowingCellUnit> |
getTopologicalNeighbors(GrowingCellUnit unit) |
private java.util.List<GrowingCellTetraheder> |
getTouchedTetraheders(GrowingCellUnit u1,
GrowingCellUnit u2)
Returns Tetraheders that have u1 and u2 in common
|
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. |
Unit |
getUnitForDatum(java.lang.String name)
Returns the unit onto which the datum specified by its name by argument
name is mapped. |
private GrowingCellUnit |
getWinner(InputDatum input) |
UnitDistance[] |
getWinnersAndDistances(InputDatum input,
int numWinners) |
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.
|
private void |
mapCompleteData(InputData data)
Maps data to the units
|
private void |
prepareForOutput()
Moves the units for optimized space requirement The order along x and y axis stays the same, but the space
between units gets reduced to 0, x is reduced before y so a narrow stripe along the y axis will emerge
|
private void |
removeUnits(java.util.List<GrowingCellUnit> unitsToRemove)
removes units specified in unitsToRemove and possible resulting disconnected units
|
QualityMeasure |
train(InputData data,
float epsilonB,
float epsilonN,
float alpha,
int lamda,
float eta,
SOMProperties props)
Trains the CellLayer with the given Parameters and returns the QualityMeasure
|
private void |
trainNormal(InputData data,
ProgressListener progressWriter)
Trains the CellLayer with the secified InputData and logs to progressWriter
|
private void |
updateInsertSignalCounters(GrowingCellUnit newUnit,
java.util.List<GrowingCellUnit> neighbors)
Updates the SignalCounters after an insert of a new unit
|
private void |
updatePositions()
Update the Position of Units in display-space by means of a simple physics simulation
|
private void |
updateWinnerAndNeighbors(GrowingCellUnit winner,
InputDatum currentInput)
Updates the weight-vectors of winning unit and its neighbors
|
private java.util.List<GrowingCellUnit> units
private java.util.List<GrowingCellTetraheder> tetraheders
private InputData data
private int dim
private QualityMeasure qualityMeasure
private DistanceMetric metric
private GrowingCellUnit[][] unitfield
private double[] emptyUnitMarkVector
private java.util.Random rand
private float epsilonB
private float epsilonN
private float alpha
private int lamda
private float eta
private int maxEpochs
private javax.swing.JFrame display
private double attractScale
private double repellingScale
private double coherenceForceFactor
public GrowingCellLayer(int dim, boolean normalize, long randomSeed, InputData data)
dim
- Dimensions of the InputDatanormalize
- Wheter or not the Data is normalizedrandomSeed
- Seed to use for random componentsdata
- InputData to be used for trainingpublic Unit[] getAllUnits()
Layer
getAllUnits
in interface Layer
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
- TODOnull
if argument component
is invalid.public java.lang.String getIdString()
Layer
getIdString
in interface Layer
public int getLevel()
Layer
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 DistanceMetric getMetric()
Layer
public int getNumberOfMappedInputs()
Layer
getNumberOfMappedInputs
in interface Layer
public QualityMeasure getQualityMeasure()
Layer
getQualityMeasure
in interface Layer
null
if not existent.public java.lang.String getRevision()
Layer
getRevision
in interface Layer
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
- TODOLayerAccessException
- if the coordinates are out of range.public Unit getUnitForDatum(java.lang.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 int getXSize()
Layer
public int getYSize()
Layer
public int getZSize()
Layer
public UnitDistance[] getWinnersAndDistances(InputDatum input, int numWinners)
public int getDim()
public java.util.Collection<? extends GrowingCellStructures> getAllSubMaps()
public QualityMeasure train(InputData data, float epsilonB, float epsilonN, float alpha, int lamda, float eta, SOMProperties props)
data
- InputDataepsilonB
- Adaption factor for best matching unitepsilonN
- Adaption factor for neighbours of best matching unitalpha
- Reduction factor for Signalcountlamda
- Interval between Adding/Removing of Unitseta
- Cutoff-Value for normalised probability densityprops
- Additional properties to use (numIterations==maximum number of epochs, quality measure name)private void mapCompleteData(InputData data)
data
- InputData to mapprivate void clearMappedInput()
private void trainNormal(InputData data, ProgressListener progressWriter)
data
- Data used for trainingprogressWriter
- ProgressListener for loggingprivate void updatePositions()
private void correctUnitPositions()
private void addAttractingForce(GrowingCellUnit unitToMove, GrowingCellUnit unitForcing, double[] attractingForce)
unitToMove
- unit to be movedunitForcing
- unit which applies the forceattractingForce
- vector to add the resulting force toprivate void addRepellingForce(GrowingCellUnit unitToMove, GrowingCellUnit unitForcing, double[] force)
unitToMove
- unit to be movedunitForcing
- unit which applies the foreforce
- vector to add the resulting force toprivate void removeUnits(java.util.List<GrowingCellUnit> unitsToRemove)
unitsToRemove
- the units that need to be removedprivate void checkConsistency()
private void updateInsertSignalCounters(GrowingCellUnit newUnit, java.util.List<GrowingCellUnit> neighbors)
newUnit
- the new inserted unitneighbors
- the neighbors of that unitprivate void calculateVoronoiEstimate(java.util.List<GrowingCellUnit> neighborsToBe)
neighborsToBe
- Units that get an updated estimateprivate double calculateVoronoiEstimate(GrowingCellUnit u)
u
- Unit to calculate the estimate forprivate java.util.List<GrowingCellTetraheder> getTouchedTetraheders(GrowingCellUnit u1, GrowingCellUnit u2)
u1
- CellUnit 1u2
- CellUnit 2private java.util.List<GrowingCellUnit> getInsertionTopologicalNeighbors(GrowingCellUnit sfwinner, GrowingCellUnit sfpartner)
private GrowingCellUnit getSignalFrequencyWinner()
private void decreaseSignalCounters()
private void updateWinnerAndNeighbors(GrowingCellUnit winner, InputDatum currentInput)
winner
- the winning unitcurrentInput
- current input vectorprivate java.util.List<GrowingCellUnit> getTopologicalNeighbors(GrowingCellUnit unit)
private GrowingCellUnit getWinner(InputDatum input)
private GrowingCellUnit getFarthestNeighbor(GrowingCellUnit unit)
private double getDistance(double[] v1, double[] v2)
public InputData getData()
private void prepareForOutput()
private void analyzeDimension(GrowingCellUnit[][] data, int[] dimandoffset)
data
- array with units (with null Objects)private void analyzeDimension(java.util.List<GrowingCellUnit> units, int[] dimandoffset)
units
- List of Units without null elementspublic Layer.GridLayout getGridLayout()
getGridLayout
in interface Layer
public Layer.GridTopology getGridTopology()
getGridTopology
in interface Layer