org.joone.structure
Class NodesAndWeights.Weight

java.lang.Object
  extended by org.joone.structure.NodesAndWeights.Weight
Enclosing class:
NodesAndWeights

public class NodesAndWeights.Weight
extends java.lang.Object

A weight. In order to populate the weight matrix, we need to know where to find the weight in joone. The weight can either be a bias found inside a layer or a normal weight found inside a synapse. This class is used to store the weight as well as the indices needed to reference it inside the joone object. We also store a lot of indexing information, such as k and u, in this class for performance reasons. We try to iterate weights rather than loop some index i from 0 to n - 1 for example. This also applies elsewhere in this implementation.


Field Summary
protected  int i
          The joone i index of this weight
 int I
          The node I in Z into which this weight fires
protected  int j
          The joone j index of this weight
 int J
          The node J in Z from which this weight fires
protected  Layer layer
          The joone layer which is used if this weight is a bias
protected  double maximumWeightMagnitude
          The maximum weight magnitude.
protected  Synapse synapse
          The joone synapse which is used if this weight is a normal synaptical weight
 int w
          The position in the weights array at which this node is found
 
Constructor Summary
NodesAndWeights.Weight(Layer layer, int i, int I, int J)
          Initialise this weight from a joone layer
NodesAndWeights.Weight(Synapse synapse, int i, int j, int I, int J)
          Initialise this weight from a joone synapse.
 
Method Summary
 void addDelta(double delta)
          Add a given amount to this weight's delta
 void addWeight(double delta)
          Update this weight with the given delta amount, also update the weight delta
 double getDelta()
          Retrieve this weight's delta
 java.lang.String getDescription()
          Returns a description of the weight
 double getWeight()
          Retrieve this weight
 void setDelta(double delta)
          Set this weight's delta to a specific value
 void setWeight(double weight)
          Set this weight to a specific value
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

I

public int I
The node I in Z into which this weight fires


J

public int J
The node J in Z from which this weight fires


w

public int w
The position in the weights array at which this node is found


i

protected int i
The joone i index of this weight


j

protected int j
The joone j index of this weight


maximumWeightMagnitude

protected double maximumWeightMagnitude
The maximum weight magnitude. When weights are updated we ensure they remain below or equal to this magnitude. If this is zero, then no limit is enforced.


layer

protected Layer layer
The joone layer which is used if this weight is a bias


synapse

protected Synapse synapse
The joone synapse which is used if this weight is a normal synaptical weight

Constructor Detail

NodesAndWeights.Weight

public NodesAndWeights.Weight(Layer layer,
                              int i,
                              int I,
                              int J)
Initialise this weight from a joone layer

Parameters:
layer - the joone layer where this is found
i - the index into the layer at which this is found
I - the node into which this weight fires
J - the node from which this weight fires

NodesAndWeights.Weight

public NodesAndWeights.Weight(Synapse synapse,
                              int i,
                              int j,
                              int I,
                              int J)
Initialise this weight from a joone synapse. Note that joone stores its weights in columns and rows, not the usual rows and columns. So we swap i and j in this constructor.

Parameters:
synapse - the joone synapse where this is found
i - the row in the synapse at which the weight is found
j - the column in the synapse at which the weight is found
K - the node in Z from which this weight is coming
Method Detail

addWeight

public void addWeight(double delta)
Update this weight with the given delta amount, also update the weight delta


setWeight

public void setWeight(double weight)
Set this weight to a specific value


getWeight

public double getWeight()
Retrieve this weight


addDelta

public void addDelta(double delta)
Add a given amount to this weight's delta


setDelta

public void setDelta(double delta)
Set this weight's delta to a specific value


getDelta

public double getDelta()
Retrieve this weight's delta


getDescription

public java.lang.String getDescription()
Returns a description of the weight



Submit Feedback to pmarrone@users.sourceforge.net