N
- Type of neurons in layerpublic class Layer extends Object implements Iterable<Neuron>, Serializable
Layer of neurons in a neural network. The Layer is basic neuron container (a collection of neurons), and it provides methods for manipulating neurons (add, remove, get, set, calculate, ...).
Neuron
,
Serialized FormModifier and Type | Field and Description |
---|---|
protected List<Neuron> |
neurons
Collection of neurons in this layer
|
Constructor and Description |
---|
Layer()
Creates an instance of empty Layer
|
Layer(int neuronsCount)
Creates an instance of empty Layer for specified number of neurons
|
Layer(int neuronsCount,
NeuronProperties neuronProperties)
Creates an instance of Layer with the specified number of neurons with
specified neuron properties
|
Modifier and Type | Method and Description |
---|---|
void |
addNeuron(int index,
Neuron neuron)
Adds specified neuron to this layer,at specified index position
Throws IllegalArgumentException if neuron is null, or index is
illegal value (index<0 or index>neuronsCount)
|
void |
addNeuron(Neuron neuron)
Adds specified neuron to this layer
|
void |
calculate()
Performs calculaton for all neurons in this layer
|
String |
getLabel()
Get layer label
|
Neuron |
getNeuronAt(int index)
Returns neuron at specified index position in this layer
|
List<Neuron> |
getNeurons()
Returns array neurons in this layer as array
|
int |
getNeuronsCount()
Returns number of neurons in this layer
|
NeuralNetwork |
getParentNetwork()
Returns reference to parent network
|
int |
indexOf(Neuron neuron)
Returns the index position in layer for the specified neuron
|
void |
initializeWeights(double value)
Initialize connection weights for the whole layer to to specified value
|
boolean |
isEmpty() |
Iterator<Neuron> |
iterator() |
void |
removeAllNeurons() |
void |
removeNeuron(Neuron neuron)
Removes neuron from layer
|
void |
removeNeuronAt(int index)
Removes neuron at specified index position in this layer
|
void |
reset()
Resets the activation and input levels for all neurons in this layer
|
void |
setLabel(String label)
Set layer label
|
void |
setNeuron(int index,
Neuron neuron)
Sets (replace) the neuron at specified position in layer
|
void |
setParentNetwork(NeuralNetwork parent)
Sets reference on parent network
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
forEach, spliterator
public Layer()
public Layer(int neuronsCount)
neuronsCount
- number of neurons in this layerpublic Layer(int neuronsCount, NeuronProperties neuronProperties)
neuronsCount
- number of neurons in layerneuronProperties
- properties of neurons in layerpublic final void setParentNetwork(NeuralNetwork parent)
parent
- parent networkpublic final NeuralNetwork getParentNetwork()
public final List<Neuron> getNeurons()
public final void addNeuron(Neuron neuron)
neuron
- neuron to addpublic final void addNeuron(int index, Neuron neuron)
neuron
- neuron to addindex
- index position at which neuron should be addedpublic final void setNeuron(int index, Neuron neuron)
index
- index position to set/replaceneuron
- new Neuron object to setpublic final void removeNeuron(Neuron neuron)
neuron
- neuron to removepublic final void removeNeuronAt(int index)
index
- index position of neuron to removepublic final void removeAllNeurons()
public Neuron getNeuronAt(int index)
index
- neuron index positionpublic int indexOf(Neuron neuron)
neuron
- neuron objectpublic int getNeuronsCount()
public void calculate()
public void reset()
public void initializeWeights(double value)
value
- the weight valuepublic String getLabel()
public void setLabel(String label)
label
- layer label to setpublic boolean isEmpty()
Copyright © 2019 Neuroph Project. All rights reserved.