public class NeuronSquareMesh2D
extends java.lang.Object
implements java.io.Serializable
org.apache.commons.math3.ml.neuralnet.sofm
,
Serialized FormModifier and Type | Class and Description |
---|---|
private static class |
NeuronSquareMesh2D.SerializationProxy
Serialization.
|
Modifier and Type | Field and Description |
---|---|
private long[][] |
identifiers
Mapping of the 2D coordinates (in the rectangular mesh) to
the neuron identifiers (attributed by the
network
instance). |
private SquareNeighbourhood |
neighbourhood
Neighbourhood type.
|
private Network |
network
Underlying network.
|
private int |
numberOfColumns
Number of columns.
|
private int |
numberOfRows
Number of rows.
|
private boolean |
wrapColumns
Wrap.
|
private boolean |
wrapRows
Wrap.
|
Constructor and Description |
---|
NeuronSquareMesh2D(boolean wrapRowDim,
boolean wrapColDim,
SquareNeighbourhood neighbourhoodType,
double[][][] featuresList)
Constructor with restricted access, solely used for deserialization.
|
NeuronSquareMesh2D(int numRows,
boolean wrapRowDim,
int numCols,
boolean wrapColDim,
SquareNeighbourhood neighbourhoodType,
FeatureInitializer[] featureInit)
Creates a two-dimensional network composed of square cells:
Each neuron not located on the border of the mesh has four
neurons linked to it.
|
Modifier and Type | Method and Description |
---|---|
private void |
createLinks()
Creates the neighbour relationships between neurons.
|
Network |
getNetwork()
Retrieves the underlying network.
|
Neuron |
getNeuron(int i,
int j)
Retrieves the neuron at location
(i, j) in the map. |
int |
getNumberOfColumns()
Gets the number of neurons in each column of this map.
|
int |
getNumberOfRows()
Gets the number of neurons in each row of this map.
|
private void |
readObject(java.io.ObjectInputStream in)
Prevents proxy bypass.
|
private java.lang.Object |
writeReplace()
Custom serialization.
|
private final Network network
private final int numberOfRows
private final int numberOfColumns
private final boolean wrapRows
private final boolean wrapColumns
private final SquareNeighbourhood neighbourhood
private final long[][] identifiers
network
instance).NeuronSquareMesh2D(boolean wrapRowDim, boolean wrapColDim, SquareNeighbourhood neighbourhoodType, double[][][] featuresList)
wrapRowDim
- Whether to wrap the first dimension (i.e the first
and last neurons will be linked together).wrapColDim
- Whether to wrap the second dimension (i.e the first
and last neurons will be linked together).neighbourhoodType
- Neighbourhood type.featuresList
- Arrays that will initialize the features sets of
the network's neurons.NumberIsTooSmallException
- if numRows < 2
or
numCols < 2
.public NeuronSquareMesh2D(int numRows, boolean wrapRowDim, int numCols, boolean wrapColDim, SquareNeighbourhood neighbourhoodType, FeatureInitializer[] featureInit)
numRows
- Number of neurons in the first dimension.wrapRowDim
- Whether to wrap the first dimension (i.e the first
and last neurons will be linked together).numCols
- Number of neurons in the second dimension.wrapColDim
- Whether to wrap the second dimension (i.e the first
and last neurons will be linked together).neighbourhoodType
- Neighbourhood type.featureInit
- Array of functions that will initialize the
corresponding element of the features set of each newly created
neuron. In particular, the size of this array defines the size of
feature set.NumberIsTooSmallException
- if numRows < 2
or
numCols < 2
.public Network getNetwork()
Network
topology may cause this class to become inconsistent.public int getNumberOfRows()
public int getNumberOfColumns()
public Neuron getNeuron(int i, int j)
(i, j)
in the map.i
- Row index.j
- Column index.(i, j)
.OutOfRangeException
- if i
or j
is
out of range.private void createLinks()
private void readObject(java.io.ObjectInputStream in)
in
- Input stream.private java.lang.Object writeReplace()