Class NeuronString
java.lang.Object
org.apache.commons.math3.ml.neuralnet.oned.NeuronString
- All Implemented Interfaces:
Serializable
Neural network with the topology of a one-dimensional line.
Each neuron defines one point on the line.
- Since:
- 3.3
- See Also:
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
Serialization. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final long[]
Mapping of the 1D coordinate to the neuron identifiers (attributed by thenetwork
instance).private final Network
Underlying network.private static final long
Serial version IDprivate final int
Number of neurons.private final boolean
Wrap. -
Constructor Summary
ConstructorsConstructorDescriptionNeuronString
(boolean wrap, double[][] featuresList) Constructor with restricted access, solely used for deserialization.NeuronString
(int num, boolean wrap, FeatureInitializer[] featureInit) Creates a one-dimensional network: Each neuron not located on the border of the mesh has two neurons linked to it. -
Method Summary
Modifier and TypeMethodDescriptionprivate void
Creates the neighbour relationships between neurons.double[]
getFeatures
(int i) Retrieves the features set from the neuron at locationi
in the map.Retrieves the underlying network.int
getSize()
Gets the number of neurons.private void
Prevents proxy bypass.private Object
Custom serialization.
-
Field Details
-
serialVersionUID
private static final long serialVersionUIDSerial version ID- See Also:
-
network
Underlying network. -
size
private final int sizeNumber of neurons. -
wrap
private final boolean wrapWrap. -
identifiers
private final long[] identifiersMapping of the 1D coordinate to the neuron identifiers (attributed by thenetwork
instance).
-
-
Constructor Details
-
NeuronString
NeuronString(boolean wrap, double[][] featuresList) Constructor with restricted access, solely used for deserialization.- Parameters:
wrap
- Whether to wrap the dimension (i.e the first and last neurons will be linked together).featuresList
- Arrays that will initialize the features sets of the network's neurons.- Throws:
NumberIsTooSmallException
- ifnum < 2
.
-
NeuronString
Creates a one-dimensional network: Each neuron not located on the border of the mesh has two neurons linked to it.
The links are bi-directional. Neurons created successively are neighbours (i.e. there are links between them).
The topology of the network can also be a circle (if the dimension is wrapped).- Parameters:
num
- Number of neurons.wrap
- Whether to wrap the dimension (i.e the first and last neurons will be linked together).featureInit
- Arrays that will initialize the features sets of the network's neurons.- Throws:
NumberIsTooSmallException
- ifnum < 2
.
-
-
Method Details
-
getNetwork
Retrieves the underlying network. A reference is returned (enabling, for example, the network to be trained). This also implies that calling methods that modify theNetwork
topology may cause this class to become inconsistent.- Returns:
- the network.
-
getSize
public int getSize()Gets the number of neurons.- Returns:
- the number of neurons.
-
getFeatures
public double[] getFeatures(int i) Retrieves the features set from the neuron at locationi
in the map.- Parameters:
i
- Neuron index.- Returns:
- the features of the neuron at index
i
. - Throws:
OutOfRangeException
- ifi
is out of range.
-
createLinks
private void createLinks()Creates the neighbour relationships between neurons. -
readObject
Prevents proxy bypass.- Parameters:
in
- Input stream.
-
writeReplace
Custom serialization.- Returns:
- the proxy instance that will be actually serialized.
-