Class NeuronString
- java.lang.Object
-
- org.apache.commons.math4.neuralnet.oned.NeuronString
-
public class NeuronString extends Object
Neural network with the topology of a one-dimensional line. Each neuron defines one point on the line.- Since:
- 3.3
-
-
Constructor Summary
Constructors Constructor Description 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
All Methods Instance Methods Concrete Methods Modifier and Type Method Description double[]
getFeatures(int i)
Retrieves the features set from the neuron at locationi
in the map.Network
getNetwork()
Retrieves the underlying network.int
getSize()
Gets the number of neurons.boolean
isWrapped()
Indicates whether the line of neurons is wrapped.
-
-
-
Constructor Detail
-
NeuronString
public 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.
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:
IllegalArgumentException
- ifnum < 2
.
-
-
Method Detail
-
getNetwork
public Network 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.
-
isWrapped
public boolean isWrapped()
Indicates whether the line of neurons is wrapped.- Returns:
true
if the last neuron is linked to the first neuron.
-
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:
IllegalArgumentException
- ifi
is out of range.
-
-