public class NeuronSquareMesh2D extends Object implements Iterable<Neuron>, Serializable
org.apache.commons.math3.ml.neuralnet.sofm
,
Serialized FormModifier and Type | Class and Description |
---|---|
static class |
NeuronSquareMesh2D.HorizontalDirection
Horizontal (along row) direction.
|
static class |
NeuronSquareMesh2D.VerticalDirection
Vertical (along column) direction.
|
Constructor and Description |
---|
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 |
---|---|
NeuronSquareMesh2D |
copy()
Performs a deep copy of this instance.
|
Network |
getNetwork()
Retrieves the underlying network.
|
Neuron |
getNeuron(int i,
int j)
Retrieves the neuron at location
(i, j) in the map. |
Neuron |
getNeuron(int row,
int col,
NeuronSquareMesh2D.HorizontalDirection alongRowDir,
NeuronSquareMesh2D.VerticalDirection alongColDir)
Retrieves the neuron at
(location[0], location[1]) 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.
|
Iterator<Neuron> |
iterator() |
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 NeuronSquareMesh2D copy()
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.
The neuron at position (0, 0)
is located at the upper-left
corner of the map.i
- Row index.j
- Column index.(i, j)
.OutOfRangeException
- if i
or j
is
out of range.getNeuron(int,int,HorizontalDirection,VerticalDirection)
public Neuron getNeuron(int row, int col, NeuronSquareMesh2D.HorizontalDirection alongRowDir, NeuronSquareMesh2D.VerticalDirection alongColDir)
(location[0], location[1])
in the map.
The neuron at position (0, 0)
is located at the upper-left
corner of the map.row
- Row index.col
- Column index.alongRowDir
- Direction along the given row
(i.e. an
offset will be added to the given column index.alongColDir
- Direction along the given col
(i.e. an
offset will be added to the given row index.null
if
the location is not on the map.getNeuron(int,int)
Copyright © 2003–2016 The Apache Software Foundation. All rights reserved.