havBpNet:J
|
All Packages Class Hierarchy This Package Previous Next Index
havBpNet:J Home Page
Class havNN.havBpNet.havBpNodeList
java.lang.Object
|
+----havNN.havBpNet.havBpNodeList
- public class havBpNodeList
- extends Object
When network layers are created and connected to each other, a lattice of object references is
created. In havBpNet, this lattice consists entirely of references to nodes... instances of
class havBpNode. These references would typically be implemented as simple pointers; however,
since we must be able to save and then later restore a network (for further training or
consultation), we have a problem.
The problem is that when restoring a network, the actual addresses of the various instances of
havBpNode may change...that is, an instance of havBpNode may not be restored to exactly the
same location in memory that it was saved from.
The havBpNodeList class is provided simply as a mechanism for resolving references to instances
of havBpNode which comprise the network. As instances of havBpNode are created, they are added
to an instance of havBpNodeList and assigned an index value. The index value of an instance of
havBpNode is the position in the havBpNodeList to which it is assigned.
Design, Implementation, and Usage Notes
An instance of havBpNodeList is, as its name implies, simply a list of pointers to instances of
havBpNode.
The typical application developer’s entire interaction with instances of havBpNodeList will be
restricted to creating, restoring or saving instances, and specifying the havBp-NodeList to
which a newly created or restored layer is assigned. Typical use of instances of havBpNodeList
will depend, in part, on how you specify connections between layers. All layers that are
explicitly connected (using the Connect(...) method) must belong to the same instance of
havBpNodeList. Conversely, if your application contains definition of several networks and if
there are no explicit connections between these networks, then the networks may belong to the
same or different instances of havBpNodeList.
Instances of havBpNode make extensive use of the instance of havBpNodeList to which they belong
in order to accomplish inter-node communication of error and activation values.
- Version:
- 1.1(java) 1/1/98
-
havBpNodeList()
- Standard Constructor.
-
havBpNodeList(int)
- Alternate Constructor.
-
havBpNodeList(StreamTokenizer)
- Restore Constructor.
Scans in the number of nodes and last used index of a saved nodelist
and allocates the appropriate size node pointer list.
-
AddLayer(int, havBpNode[])
- Add references to the nodes in a layer.
-
ConnectBack(int, int)
- Establish a backward (downward) connections from a node (src) to another node (target).
-
Cycle()
- Forward cycle all nodes in the NodeList in a purely random order.
-
Dump()
- Print simple report of NodeList contents on stdout.
-
GetNodeError(int)
- Get the error value of the node at index position [i].
-
GetNodeIndex(havBpNode)
- Return the index of the node whose pointer (address) equals the argument.
-
GetNodePointer(int)
- Get the reference (address) of the node located at index position [i].
-
GetNodeValue(int)
- Get the value of the node whose reference is at index position [i].
-
GetNumberOfNodes()
- Get the size (number of node references allocated) of the node list.
-
GetWeightedError(int, int)
- Get the connection weight between two nodes.
-
PutNodePointer(int, havBpNode)
- Puts a reference at index position [i].
-
PutNodeValue(int, double)
- Set the value of the node at index position [i].
-
Restore(StreamTokenizer)
- Read in the number of nodes and last used index of a saved nodelist
and allocates the appropriate size node pointer list.
-
Save(FileOutputStream)
- Save the number of nodes and last used index of the nodelist.
-
Train()
- Train all nodes in the NodeList in a purely random order.
havBpNodeList
public havBpNodeList()
- Standard Constructor.
havBpNodeList
public havBpNodeList(int n)
- Alternate Constructor.
- Parameters:
- n - number of node slots to allocate
havBpNodeList
public havBpNodeList(StreamTokenizer in) throws IOException
- Restore Constructor.
Scans in the number of nodes and last used index of a saved nodelist
and allocates the appropriate size node pointer list.
- Parameters:
- in - the SAVE file from which the node list is to be restored.
- Throws: IOException
- Throws an exception if any errors occur.
AddLayer
public int AddLayer(int n,
havBpNode list[])
- Add references to the nodes in a layer.
- Parameters:
- n - the number of node references to be added
- list - an array of node recerences to be added
- Returns:
- the index of the layer's first node
GetNodeIndex
public int GetNodeIndex(havBpNode n)
- Return the index of the node whose pointer (address) equals the argument.
- Parameters:
- n - address of the node instance to find in the NodeList.
- Returns:
- -1 if no matching pointer is found in the list.
ConnectBack
public int ConnectBack(int in,
int out)
- Establish a backward (downward) connections from a node (src) to another node (target).
Presumably, the target node is an input node of the src node.
- Parameters:
- in - the NodeList index of the src node.
- out - the NodeList index of the target node.
- Returns:
- havTRUE is returned if the connection is valid; else havFALSE is returned.
Save
public int Save(FileOutputStream out) throws IOException
- Save the number of nodes and last used index of the nodelist.
Notice that the node pointer list IS NOT saved since it may be modified
upon restore.
- Parameters:
- out - the SAVE file into which data is to be written
- Throws: IOException
- Throws an exception if any errors occur.
Restore
public int Restore(StreamTokenizer in) throws IOException
- Read in the number of nodes and last used index of a saved nodelist
and allocates the appropriate size node pointer list.
- Parameters:
- in - the SAVE file from which values are to be read.
- Throws: IOException
- Throws an exception if any errors occur.
PutNodePointer
public int PutNodePointer(int i,
havBpNode nd)
- Puts a reference at index position [i].
- Parameters:
- i - index at which the reference is to be placed.
- nd - the reference (node address) tobe placed at index [i].
- Returns:
- havTRUE if i is within the range of existing node indexes; else returns havFALSE
GetNodePointer
public havBpNode GetNodePointer(int i)
- Get the reference (address) of the node located at index position [i].
- Parameters:
- i - index of the node reference to be returned.
- Returns:
- (havBpNode *)null is returned if i is not within the range of existing node
indexes.
GetNumberOfNodes
public int GetNumberOfNodes()
- Get the size (number of node references allocated) of the node list.
GetNodeValue
public double GetNodeValue(int i)
- Get the value of the node whose reference is at index position [i].
- Parameters:
- i - the index of the node who's value is to be returned.
- Returns:
- 0.0 if i is not within the range of existing indexes.
PutNodeValue
public int PutNodeValue(int i,
double v)
- Set the value of the node at index position [i].
- Parameters:
- i - the index of the node whose value is to be set.
- v - the value to be assigned to the node.
- Returns:
- havTRUE if i is within the range of existingindexes; else returns havFALSE
GetNodeError
public double GetNodeError(int i)
- Get the error value of the node at index position [i].
- Parameters:
- i - the index of the node whose error is to be returned.
- Returns:
- 0.0 if i is not within the range of existing indexes.
GetWeightedError
public double GetWeightedError(int from,
int to)
- Get the connection weight between two nodes.
- Parameters:
- from - index of the "from" node.
- to - index of the "to" node.
- Returns:
- 0.0 is returned if either node index is not within the range of existing
indexes.
Dump
public void Dump()
- Print simple report of NodeList contents on stdout.
Cycle
public void Cycle()
- Forward cycle all nodes in the NodeList in a purely random order.
NOTE: nodes in havINPUT layers are not cycled.
Train
public void Train()
- Train all nodes in the NodeList in a purely random order.
Training specifics are controled by the Layer Type (Input, Hidden, Output) of the layer in
which a node exists. Training involves error calculation, backpropagation and weight
updates.
NOTE: nodes in havINPUT layers are not trained.
All Packages Class Hierarchy This Package Previous Next Index
Copyright © 1998 by hav.Software. All Rights Reserved.