Package smile.vq.hebb

Class Neuron

java.lang.Object
smile.vq.hebb.Neuron
All Implemented Interfaces:
Serializable, Comparable<Neuron>

public class Neuron extends Object implements Comparable<Neuron>, Serializable
The neuron vertex in the growing neural gas network.
See Also:
  • Field Summary

    Fields
    Modifier and Type
    Field
    Description
    double
    The local counter variable (e.g.
    double
    The distance between the neuron and an input signal.
    final List<Edge>
    The direct connected neighbors.
    final double[]
    The reference vector.
  • Constructor Summary

    Constructors
    Constructor
    Description
    Neuron(double[] w)
    Constructor.
    Neuron(double[] w, double counter)
    Constructor.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    addEdge(Neuron neighbor)
    Adds an edge.
    void
    addEdge(Neuron neighbor, int age)
    Adds an edge.
    void
    age()
    Increments the age of all edges emanating from the neuron.
    int
     
    void
    distance(double[] x)
    Computes the distance between the neuron and a signal.
    void
    removeEdge(Neuron neighbor)
    Removes an edge.
    void
    setEdgeAge(Neuron neighbor, int age)
    Sets the age of edge.
    void
    update(double[] x, double eps)
    Updates the reference vector by w += eps * (x - w).

    Methods inherited from class java.lang.Object

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

    • w

      public final double[] w
      The reference vector.
    • edges

      public final List<Edge> edges
      The direct connected neighbors.
    • distance

      public transient double distance
      The distance between the neuron and an input signal.
    • counter

      public double counter
      The local counter variable (e.g. the accumulated error, freshness, etc.)
  • Constructor Details

    • Neuron

      public Neuron(double[] w)
      Constructor.
      Parameters:
      w - the reference vector.
    • Neuron

      public Neuron(double[] w, double counter)
      Constructor.
      Parameters:
      w - the reference vector.
      counter - the local counter.
  • Method Details

    • update

      public void update(double[] x, double eps)
      Updates the reference vector by w += eps * (x - w).
      Parameters:
      x - a signal.
      eps - the learning rate.
    • addEdge

      public void addEdge(Neuron neighbor)
      Adds an edge.
      Parameters:
      neighbor - the neighbor neuron.
    • addEdge

      public void addEdge(Neuron neighbor, int age)
      Adds an edge.
      Parameters:
      neighbor - the neighbor neuron.
      age - the age of edge.
    • removeEdge

      public void removeEdge(Neuron neighbor)
      Removes an edge.
      Parameters:
      neighbor - the neighbor neuron of the edge.
    • setEdgeAge

      public void setEdgeAge(Neuron neighbor, int age)
      Sets the age of edge.
      Parameters:
      neighbor - the neighbor neuron of the edge.
      age - the age of edge.
    • age

      public void age()
      Increments the age of all edges emanating from the neuron.
    • distance

      public void distance(double[] x)
      Computes the distance between the neuron and a signal.
      Parameters:
      x - the signal.
    • compareTo

      public int compareTo(Neuron o)
      Specified by:
      compareTo in interface Comparable<Neuron>