Class Node

java.lang.Object
com.github.raimannma.architecture.Node

public class Node
extends Object
The type Node.
Author:
Manuel Raimann
  • Field Details

  • Constructor Details

    • Node

      public Node​(Node.NodeType type)
      Instantiates a new Node.
      Parameters:
      type - the type
  • Method Details

    • fromJSON

      @NotNull public static @NotNull Node fromJSON​(@NotNull @NotNull com.google.gson.JsonObject jsonObject)
      Convert a JsonObject to a node.
      Parameters:
      jsonObject - the json object which holds the information
      Returns:
      the node created from the information of the json object
    • activate

      public double activate()
      Activates the node.

      When a neuron activates, it computes its state from all its input connections and 'squashes' it using its activation function, and returns the output (activation).

      Returns:
      A neuron's squashed output value.
    • activate

      public void activate​(double input)
      Activates the node with input value.

      When a neuron activates, it computes its state from all its input connections and 'squashes' it using its activation function, and returns the output (activation).

      You can also provide the activation (a float between 0 and 1) as a parameter, which is useful for neurons in the input layer.

      Parameters:
      input - the input to this node
    • connect

      public Connection connect​(Node target, double weight)
      Connect this node to another node.
      Parameters:
      target - the target node
      weight - the weight value of the connection between this and the target node
      Returns:
      the created connection pointing from this node to the target node
    • isNotProjectingTo

      public boolean isNotProjectingTo​(Node target)
      Checks if there is no connection between this node and the target node.
      Parameters:
      target - the target node
      Returns:
      is there no connection
    • clear

      public void clear()
      Resets this node.
    • disconnect

      public void disconnect​(Node target)
      Disconnects this node from the target node.
      Parameters:
      target - the target node
    • removeGate

      public void removeGate​(Connection connection)
      Stops this node from gating (manipulating) the given connection.
      Parameters:
      connection - Connection to ungate
    • gate

      public void gate​(@NotNull @NotNull Connection connection)
      Set this node to gate (influences) the given connection.
      Parameters:
      connection - Connection to be gated (influenced) by a node.
    • toJSON

      public com.google.gson.JsonObject toJSON()
      Converts the node to a JsonObject that can later be converted back.
      Returns:
      the created JsonObject
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals​(Object o)
      Overrides:
      equals in class Object
    • toString

      public String toString()
      Overrides:
      toString in class Object