Package ann4j

Class Connection

java.lang.Object
ann4j.Connection

public class Connection extends Object
  • Field Details

    • leftNeuron

      public Neuron leftNeuron
    • rightNeuron

      public Neuron rightNeuron
    • changeWishlist

      public ArrayList<Double> changeWishlist
  • Constructor Details

    • Connection

      Connection(Neuron leftNeuron, Neuron rightNeuron)
  • Method Details

    • getWeight

      public double getWeight()
      This function returns the weight of the object
      Returns:
      The weight of the object.
    • initializeWeights

      public void initializeWeights()
      This function initializes the weight of the connection to a small random number
    • calculateActivationForwardPropagation

      public double calculateActivationForwardPropagation()
      Calculate the activation of the left neuron times the weight of the connection.
      Returns:
      The activation of the left neuron times the weight of the connection.
    • toString

      public String toString()
      This function returns a string that contains the neuron numbers of the neurons that are connected by this connection, as well as the weight of the connection
      Overrides:
      toString in class Object
      Returns:
      The string representation of the connection.
    • backPropagate

      public void backPropagate()
      The backpropagation algorithm is calculating the gradient of the loss function with respect to the weight. It then updates the weight by subtracting the learning rate times the gradient
    • getBackwardWeightedSum

      public double getBackwardWeightedSum()
      The function returns the gradient of the loss function with respect to the weight
      Returns:
      The gradient of the loss function with respect to the weight.