Package ann4j
Class Layer
java.lang.Object
ann4j.Layer
- Direct Known Subclasses:
HiddenLayer
,InputLayer
,OutputLayer
-
Field Summary
Modifier and TypeFieldDescriptionint
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
This function adds a neuron to the list of neuronsvoid
This function iterates through the list of neurons and calls the backwardPropagate method on each neuronvoid
The forwardPropagate function iterates through the list of neurons and calls the forwardPropagate method on each neuronThis function returns the list of neurons in the layergetNeuron
(int neuronNum) This function returns the neuron at the specified index in the list of neuronsint
getSize()
This function returns the number of neurons in the layerIt prints the weights of the neuronsvoid
This function iterates through the list of neurons and calls the relevancePropagate method on each neuronabstract void
The setBehaviour() function is an abstract function that is used to set the behaviour of the animal.void
setLayerNum
(int layerNum) This function sets the layer number for each neuron in the layertoString()
This function returns a string that contains the layer number, the length of the list of neurons, and the toString() function of each neuron in the list of neurons
-
Field Details
-
listOfNeurons
-
layerNum
public int layerNum -
myBehaviour
-
-
Constructor Details
-
Layer
Layer(int numOfNeurons)
-
-
Method Details
-
getSize
public int getSize()This function returns the number of neurons in the layer- Returns:
- The size of the list of neurons.
-
getNeuron
This function returns the neuron at the specified index in the list of neurons- Parameters:
neuronNum
- The index of the neuron you want to get.- Returns:
- The neuron at the given index.
-
setBehaviour
public abstract void setBehaviour()The setBehaviour() function is an abstract function that is used to set the behaviour of the animal. -
getListOfNeurons
This function returns the list of neurons in the layer- Returns:
- The list of neurons in the layer.
-
setLayerNum
public void setLayerNum(int layerNum) This function sets the layer number for each neuron in the layer- Parameters:
layerNum
- The layer number of the layer.
-
addNeuron
This function adds a neuron to the list of neurons- Parameters:
toBeAdded
- The neuron to be added to the list of neurons.
-
forwardPropagate
public void forwardPropagate()The forwardPropagate function iterates through the list of neurons and calls the forwardPropagate method on each neuron -
toString
This function returns a string that contains the layer number, the length of the list of neurons, and the toString() function of each neuron in the list of neurons -
printWeights
It prints the weights of the neurons- Returns:
- The weights of the neurons.
-
backwardPropagate
public void backwardPropagate()This function iterates through the list of neurons and calls the backwardPropagate method on each neuron -
relevancePropagate
public void relevancePropagate()This function iterates through the list of neurons and calls the relevancePropagate method on each neuron
-