Package ann4j

Class LayerManager

java.lang.Object
ann4j.LayerManager

public class LayerManager extends Object
  • Field Details

    • lossFunction

      public static double lossFunction
    • listOfLayers

      ArrayList<Layer> listOfLayers
    • inputLayer

      public InputLayer inputLayer
    • outputLayer

      public OutputLayer outputLayer
    • ExpectedOutputArrayList

      public static ArrayList<Double> ExpectedOutputArrayList
  • Constructor Details

    • LayerManager

      LayerManager(int[] layerLengths)
  • Method Details

    • getOutputLayer

      public OutputLayer getOutputLayer()
      This function returns the output layer of the neural network
      Returns:
      The output layer of the neural network.
    • getInputLayer

      public InputLayer 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

      public void setExpectedOutputArray(ArrayList<Double> expectedOutputArrayList)
      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

      public void setInputLayer(ArrayList<Double> inputLayerArray)
      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

      public String toString()
      This function returns a string representation of the neural network
      Overrides:
      toString in class Object
      Returns:
      The string representation of the network.
    • getOutput

      public Layer 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

      public static Double 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

      public Layer getLayer(int layerNum)
      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

      public ArrayList 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.