havBpNet:J

All Packages  Class Hierarchy  This Package  Previous  Next  Index

havBpNet:J Home Page

Class havNN.havBpNet.havBpNode

java.lang.Object
   |
   +----havNN.havBpNet.havBpNode

public abstract class havBpNode
extends Object
Most of the actual processing performed by a neural network takes place in the nodes of the network. The havBpNode class and its sub-classes are designed to implement that processing which takes place in the nodes. NOTE: The havBpNode class is an abstract class used to provide the generalized form and the majority of the processing of a node in havBpNet:J. There are five subclasses of havBpNode which further specify certain processing characteristics. Each sub-class provides method implementations specific to its nature. The sub-classes of havBpNode are...

• havBpLinearNode
• havBpSigmoidNode
• havBpHtanNode
• havBpSinNode
• havBpHermiteNode

The only differences in these sub-classes are in implementation of their feed-forward and error calculation functions.

Typical application programs that use havBpNet need never deal directly with nodes. Node instance creation, deletion, and processing are handled automatically by instances of the havBpLayer class. There are several member functions of the havBpLayer class that allow the user to indicate that a particular node in the layer is to be targeted. For example, the user may assign an activation value to the third node in a particular layer.

havBpNode: Design, Implementation, and Usage Notes

The design of the havBpNode class is based on our desire to allow the user to deal with layers rather than with individual nodes. For example, certain information required by all nodes in a layer resides in the layer to which the nodes belong and is passed to nodes only when needed.

Another obvious issue with neural nets is processing speed. Since most processing in a neural network is performed by the nodes, certain design trade-offs were made. For example, we have chosen to employ sub-classing and overloading rather that using run-time conditional logic for things like controling which transfer function is used in a node.

Another example of these design trade-offs is that certain information that could be retrieved from the node’s parent layer when needed is, instead, copied to reside locally in each node in the layer.

The havBpNode class makes extensive use of the havBpNodeList class for inter-node communication - especially when establishing connections between nodes.

Version:
1.1(java) 1/1/98

Method Index

 o CalculateUpdates()
Calculates the weight changes for each input weight of the node.
 o Connect(havBpNodeList, int, double)
Establish a forward connection between the node (target) and one of its input nodes (source) using a specified fixed weight value.
 o Connect(havBpNodeList, int, double, double)
Establish a forward connection between the node (target) and one of its input nodes (source).
 o Dump()
Produces a report of certain node information to stdout.
 o Dump(String)
Produces an indented report of certain node information to stdout.
 o GetCascade()
Returns the node's current cascade coefficient value.
 o GetDecay()
Returns the node's current weight decay value.
 o GetError()
Returns the node's current Error.
 o GetErrorThreshold()
Returns the node's current error threshold.
 o GetExpectedValue()
Returns the node's current expected value.
 o GetInputWeights()
CAREFUL: this returns the ref to the node's weight member array.
 o GetLayerType()
Returns the layer type (havINPUT, havHIDDEN, havOUTPUT) of the node's parent layer.
 o GetNodeIndex()
Returns this node's havBpNodeList index (from 0).
 o GetNumberOfInputs()
Returns the number of inputs connected to the node.
 o GetRawValue()
Returns the unscalled value of the node.
 o GetScaledError(int)
Returns the node's error, (expected-actual), scaled by the indicated error function.
 o GetValue()
Return the node's current activation value.
 o GetWeightedError(int)
Returns the node's current Error value multiplied by a sp[ecified input weight.
 o NormalizeWeights()
Normalize the INPUT weights of a node such that their ABS VALUES sum to 1.
 o NormalizeWeights(double)
Normalize the INPUT weights of a node such that their ABS VALUES sum to a specified value.
 o PutBeta(double)
Set the node's learning rate.
 o PutCascade(double)
Sets the node's cascade coefficient.
 o PutDecay(double)
Sets the node's weight decay value.
 o PutEpochSize(int)
Sets the node's epoch (batch size).
 o PutErrorFunction(int)
Sets the node's error function.
 o PutErrorThreshold(double)
Set the node's error threshold.
 o PutExpectedValue(double)
Sets the expected value of the node.
 o PutMomentum(double)
Sets the node's learning momentum.
 o PutNodeIndex(int)
Inform the node of its index position in the havBpNodeList to which its parent layer belongs.
 o PutNodeList(havBpNodeList)
Sets the "pointer" to the havBpNodeList to which the nopde's parent layer belongs.
 o PutValue(double)
Set the node's activation value to some specified value.
 o Restore(StreamTokenizer)
Restore the node's data from a specified SAVE file.
 o Save(FileOutputStream)
Save the node in a specified SAVE file.
 o SetTraining(int)
Enable/disable INPUT weight adjustments for the node.
 o Train()
Calculate the node's error and update it's input weights.
 o UpdateWeights()
Apply weight changed that were calculated during error calculation.

Methods

 o UpdateWeights
 public void UpdateWeights()
Apply weight changed that were calculated during error calculation. If batch training is ON (i.e. epoch > 0) and the current batch is not finished, then simply add the current updates to the accumulated update values. If the batch is complete, then go ahead and apply the accumulated updates.

NOTE: Weight Decay is applied here.

 o CalculateUpdates
 public void CalculateUpdates()
Calculates the weight changes for each input weight of the node.

 o Train
 public void Train()
Calculate the node's error and update it's input weights. NOTE: This form of training is used during "interleved" training.

 o GetRawValue
 public double GetRawValue()
Returns the unscalled value of the node.

 o Connect
 public int Connect(havBpNodeList nlist,
                    int index,
                    double lo,
                    double hi)
Establish a forward connection between the node (target) and one of its input nodes (source). The connection weight is set to a random value between specified low and high values.

Parameters:
nlist - The havBpNodeList to which both the source and target nodes belong.
index - The havBpNodeList index of the source node.
lo - The low bounds for random weight selection.
hi - The high bounds for random weight selection.
 o NormalizeWeights
 public void NormalizeWeights()
Normalize the INPUT weights of a node such that their ABS VALUES sum to 1.

 o NormalizeWeights
 public void NormalizeWeights(double fact)
Normalize the INPUT weights of a node such that their ABS VALUES sum to a specified value.

Parameters:
fact - THe target value for the sum.
 o Connect
 public int Connect(havBpNodeList nlist,
                    int index,
                    double fixed_weight)
Establish a forward connection between the node (target) and one of its input nodes (source) using a specified fixed weight value.

Parameters:
nlist - The havBpNodeList to which both the source and target nodes belong.
index - The havBpNodeList index of the source node.
fixed_weight - The value to be set as the connection weight.
 o Save
 public int Save(FileOutputStream out) throws IOException
Save the node in a specified SAVE file.

Parameters:
out - The open and positioned SAVE file.
Throws: IOException
Throws an exception if any errors occur.
 o GetNodeIndex
 public int GetNodeIndex()
Returns this node's havBpNodeList index (from 0).

 o Restore
 public int Restore(StreamTokenizer in) throws IOException
Restore the node's data from a specified SAVE file.

Parameters:
in - The open and positioned SAVE file.
Throws: IOException
Throws an exception if any errors occur.
 o PutNodeIndex
 public void PutNodeIndex(int index)
Inform the node of its index position in the havBpNodeList to which its parent layer belongs.

Parameters:
index - The havBpNodeLlist index of the node (from 0).
 o PutValue
 public void PutValue(double v)
Set the node's activation value to some specified value. NOTE: The value supplied as an argument IS NOT "squashed" by any transfer function in this method!

Parameters:
v - The new activation value to be set.
 o GetValue
 public double GetValue()
Return the node's current activation value.

 o PutErrorThreshold
 public int PutErrorThreshold(double t)
Set the node's error threshold. If the parameter is < 0.0 then the error threshold is not changed and havFALSE is returned.

Parameters:
t - The new error threshold to be set.
 o GetError
 public double GetError()
Returns the node's current Error.

 o GetWeightedError
 public double GetWeightedError(int index)
Returns the node's current Error value multiplied by a sp[ecified input weight. This method is supplied for use in error back-propagation. It allows a non-OUTPUT node to retrieve the error of its output-nodes weighted by the appropriate connection weights.

Parameters:
index - The havBpNodeList index of the node to which the input weight connects.
 o GetScaledError
 public double GetScaledError(int errFunc)
Returns the node's error, (expected-actual), scaled by the indicated error function. If the node's parent layer is not an OUTPUT layer, then 0.0 is returned.

Parameters:
errfunc - The error function to be applied.
 o GetInputWeights
 public double[] GetInputWeights()
CAREFUL: this returns the ref to the node's weight member array.

 o GetNumberOfInputs
 public int GetNumberOfInputs()
Returns the number of inputs connected to the node.

 o Dump
 public void Dump(String indent)
Produces an indented report of certain node information to stdout.

Parameters:
indent - The number of spaces to be placed at the begining of each report line.
 o Dump
 public void Dump()
Produces a report of certain node information to stdout. No line indention specified or applied.

 o PutExpectedValue
 public void PutExpectedValue(double v)
Sets the expected value of the node. Not sensible for nodes not in an havOUTPUT layer - but no test is made.

Parameters:
v - The expected value to be set in the node.
 o GetExpectedValue
 public double GetExpectedValue()
Returns the node's current expected value.

 o PutEpochSize
 public void PutEpochSize(int e)
Sets the node's epoch (batch size).

Parameters:
e - the batch size to be set.
 o PutBeta
 public void PutBeta(double b)
Set the node's learning rate.

Parameters:
b - The new learning rate to be set.
 o PutMomentum
 public void PutMomentum(double mu)
Sets the node's learning momentum.

Parameters:
mu - The new momentum value to be set.
 o PutErrorFunction
 public int PutErrorFunction(int errFunc)
Sets the node's error function.

Parameters:
errFunc - The error function (havSQUARED, havCUBE, havQUAD) to be set.
 o PutNodeList
 public void PutNodeList(havBpNodeList nl)
Sets the "pointer" to the havBpNodeList to which the nopde's parent layer belongs.

Parameters:
nl - The havBpNodeList instance.
 o GetLayerType
 public int GetLayerType()
Returns the layer type (havINPUT, havHIDDEN, havOUTPUT) of the node's parent layer.

 o PutDecay
 public void PutDecay(double d)
Sets the node's weight decay value.

Parameters:
d - The decay value to be set.
 o GetDecay
 public double GetDecay()
Returns the node's current weight decay value.

 o PutCascade
 public void PutCascade(double c)
Sets the node's cascade coefficient.

Parameters:
c - The new cascade coefficient to be set.
 o GetCascade
 public double GetCascade()
Returns the node's current cascade coefficient value.

 o GetErrorThreshold
 public double GetErrorThreshold()
Returns the node's current error threshold.

 o SetTraining
 public void SetTraining(int state)
Enable/disable INPUT weight adjustments for the node.

Parameters:
state - The new state - if havON then enable adjustments - else disable adjustments.

All Packages  Class Hierarchy  This Package  Previous  Next  Index

Copyright © 1998 by hav.Software. All Rights Reserved.