Package ann4j
Class LayerManager
java.lang.Object
ann4j.LayerManager
-
Field Summary
Modifier and TypeFieldDescriptionstatic double
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
For each layer in the network, starting from the last layer, call the backwardPropagate function of that layerdouble
This function calculates the mean squared error of the networkvoid
The forwardPropagate() method is called on every layer in the listOfLayers ArrayList, except the input layervoid
The function calculates the relevance of each pixel in the input image by excluding each pixel and calculating the loss functiondouble
It returns the confidence of the most significant neuron in the output layerThis function returns the input layer of the neural network.getLayer
(int layerNum) This function returns the layer at the specified indexIt returns the index of the most significant neuron in the hidden layerint
It returns the index of the neuron in the output layer that has the highest activation valuestatic Double
This function returns the number of neurons to be tested in relevance propagationReturn the last layer in the listOfLayers ArrayList.This function returns the output layer of the neural networkvoid
relevancePropagate
(int layerNumber, int neuronNumber) The function takes in the layer number and the neuron number of the output layer and then calculates the relevance of each pixel in the input layervoid
setExpectedOutputArray
(ArrayList<Double> expectedOutputArrayList) This function takes an ArrayList of Doubles as an argument and sets the ExpectedOutputArrayList variable to the argumentvoid
setInputLayer
(ArrayList<Double> inputLayerArray) This function takes an ArrayList of Doubles and sets the inputLayer's input to that ArrayListstatic void
setNeuronNumberToBeTestedinRelavancePropagation
(Double neuronNumberToBeTestedinRelavancePropagation) This function sets the number of neurons to be tested in relevance propagationtoString()
This function returns a string representation of the neural network
-
Field Details
-
lossFunction
public static double lossFunction -
listOfLayers
-
inputLayer
-
outputLayer
-
ExpectedOutputArrayList
-
-
Constructor Details
-
LayerManager
LayerManager(int[] layerLengths)
-
-
Method Details
-
getOutputLayer
This function returns the output layer of the neural network- Returns:
- The output layer of the neural network.
-
getInputLayer
This function returns the input layer of the neural network.- Returns:
- The input layer of the neural network.
-
calculateMSE
public double calculateMSE()This function calculates the mean squared error of the network- Returns:
- The mean squared error of the output layer.
-
setExpectedOutputArray
This function takes an ArrayList of Doubles as an argument and sets the ExpectedOutputArrayList variable to the argument- Parameters:
expectedOutputArrayList
- This is the array list of expected outputs.
-
setInputLayer
This function takes an ArrayList of Doubles and sets the inputLayer's input to that ArrayList- Parameters:
inputLayerArray
- The input layer array.
-
forwardPropagate
public void forwardPropagate()The forwardPropagate() method is called on every layer in the listOfLayers ArrayList, except the input layer -
forwardPropagatewithExclusionInputLayer
public void forwardPropagatewithExclusionInputLayer()The function calculates the relevance of each pixel in the input image by excluding each pixel and calculating the loss function -
toString
This function returns a string representation of the neural network -
getOutput
Return the last layer in the listOfLayers ArrayList.- Returns:
- The last layer in the listOfLayers ArrayList.
-
backwardPropagate
public void backwardPropagate()For each layer in the network, starting from the last layer, call the backwardPropagate function of that layer -
relevancePropagate
public void relevancePropagate(int layerNumber, int neuronNumber) The function takes in the layer number and the neuron number of the output layer and then calculates the relevance of each pixel in the input layer- Parameters:
layerNumber
- The layer number of the neuron that you want to calculate the relevance of.neuronNumber
- The number of the neuron in the output layer that you want to find the relevance of.
-
getNeuronNumberToBeTestedinRelavancePropagation
This function returns the number of neurons to be tested in relevance propagation- Returns:
- The number of neurons to be tested in relevance propagation.
-
setNeuronNumberToBeTestedinRelavancePropagation
public static void setNeuronNumberToBeTestedinRelavancePropagation(Double neuronNumberToBeTestedinRelavancePropagation) This function sets the number of neurons to be tested in relevance propagation- Parameters:
neuronNumberToBeTestedinRelavancePropagation
- This is the number of neurons that you want to test in the relevance propagation.
-
getLayer
This function returns the layer at the specified index- Parameters:
layerNum
- The layer number you want to get.- Returns:
- The layer at the specified index.
-
getMostSignificantNeuronNumAsPrediction
public int getMostSignificantNeuronNumAsPrediction()It returns the index of the neuron in the output layer that has the highest activation value- Returns:
- The most significant neuron number in the output layer.
-
getconfidence
public double getconfidence()It returns the confidence of the most significant neuron in the output layer- Returns:
- The most significant neuron confidance in the output layer.
-
getMostSignificantNeuronAsPredictionInHiddenLayer
It returns the index of the most significant neuron in the hidden layer- Returns:
- The index of the most significant neuron in the hidden layer.
-