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