Package ann4j

Class Layer

java.lang.Object
ann4j.Layer
Direct Known Subclasses:
HiddenLayer, InputLayer, OutputLayer

abstract class Layer extends Object
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    int
     
     
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Layer(int numOfNeurons)
     
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addNeuron(Neuron toBeAdded)
    This function adds a neuron to the list of neurons
    void
    This function iterates through the list of neurons and calls the backwardPropagate method on each neuron
    void
    The forwardPropagate function iterates through the list of neurons and calls the forwardPropagate method on each neuron
    This function returns the list of neurons in the layer
    getNeuron(int neuronNum)
    This function returns the neuron at the specified index in the list of neurons
    int
    This function returns the number of neurons in the layer
    It prints the weights of the neurons
    void
    This function iterates through the list of neurons and calls the relevancePropagate method on each neuron
    abstract 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 layer
    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

    Methods inherited from class java.lang.Object

    clone, equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
  • Field Details

  • 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

      public Neuron getNeuron(int neuronNum)
      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

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

      public void addNeuron(Neuron toBeAdded)
      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

      public String 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
      Overrides:
      toString in class Object
      Returns:
      The string representation of the layer.
    • printWeights

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