clarion.system
Class BPNet

java.lang.Object
  extended by clarion.system.AbstractImplicitModule
      extended by clarion.system.AbstractTrainableImplicitModule
          extended by clarion.system.AbstractNeuralNet
              extended by clarion.system.BPNet
All Implemented Interfaces:
InterfaceTrainable
Direct Known Subclasses:
AbstractRuntimeTrainableBPNet

public class BPNet
extends AbstractNeuralNet

This class implements a 3-layer standard backpropagating neural network within CLARION. It extends the AbstractNeuralNetwork class.

Usage:

A standard backpropagating neural network is the base type of network in CLARION and while it can be used as the neural network for the bottom level of any subsystem of CLARION, it is not considered to be capable of "ONLINE" (or runtime) learning. Therefore, the network should be pre-trained "offline" before it is added to the appropriate CLARION subsystem. The weight vectors and thresholds for the network can be hardcoded if they were recorded from a previous training session.

The Input for the neural network is a collection of dimension-values where each value represents one node.

If the network is being used as an action network in the ACS and you are using goals or specialized working memory chunks, remember that the input space must also contain all dimension-value pairs within those chunks that differ from the sensory information space.

Once the input space has been defined it cannot be changed. At any given forward pass through the network, the network can accept an arbitrary collection of dimension-values as input, but it will only adjust the activations of the inputs that were specified during initialization.

The nodes in the output layer are represented as output chunks.

The general procedure when using this class is:

  1. setInput
  2. forwardPass
  3. setDesiredOutput
  4. backwardPass
  5. Goto Step 1

Note: The current implementation of CLARION does not allow for multiple action dimensions on the bottom level as stipulated in the CLARION tutorial. However, actions that contain multiple action dimensions are still possible by simply specifying action chunks on the top level that contain multiple activated action dimensions. This is the case because the output of the bottom level only specifies actions and not action dimension-values.

Known Subclasses:

This class contains both global (static) and local constants. The default is to use the local constants. If you want to change any of the global constants, you need to do so before any instances of this class are initialized.

Version:
6.0.4
Author:
Nick Wilson

Field Summary
private  java.util.ArrayList<java.lang.Double> Errors
          The errors of the output
static double GLOBAL_LEARNING_RATE
          Learning rate.
static double GLOBAL_MOMENTUM
          Momentum.
static double GLOBAL_RZERO
          Tolerance of error.
private  java.util.ArrayList<java.lang.Double> HiddenDeriv
          The derivative of the hidden layers.
private  java.util.ArrayList<java.lang.Double> HiddenErrors
          The errors of the hidden layer.
private  java.util.ArrayList<java.lang.Double> HiddenMomentum
          The momentum for the hidden layers.
private  java.util.ArrayList<java.util.ArrayList<java.lang.Double>> HiddenToOutputMomentum
          The hidden to output momentum matrix.
private  java.util.ArrayList<java.util.ArrayList<java.lang.Double>> InputToHiddenMomentum
          The input to hidden momentum matrix.
 double LEARNING_RATE
          Learning rate.
 double MOMENTUM
          Momentum.
private  java.util.ArrayList<java.lang.Double> OutputDeriv
          The derivative of the output layers.
private  java.util.ArrayList<java.lang.Double> OutputMomentum
          The momentum from the output layers.
 double RZERO
          Tolerance of error.
 
Fields inherited from class clarion.system.AbstractNeuralNet
GLOBAL_LOWER_INIT_THRESHOLD, GLOBAL_LOWER_INIT_WEIGHT, GLOBAL_UPPER_INIT_THRESHOLD, GLOBAL_UPPER_INIT_WEIGHT, Hidden, HiddenThresholds, HiddenToOutputWeights, InputToHiddenWeights, LOWER_INIT_THRESHOLD, LOWER_INIT_WEIGHT, OutputThresholds, UPPER_INIT_THRESHOLD, UPPER_INIT_WEIGHT
 
Fields inherited from class clarion.system.AbstractTrainableImplicitModule
DesiredOutput
 
Fields inherited from class clarion.system.AbstractImplicitModule
ACTUATION_TIME, ChosenOutput, DECISION_TIME, GLOBAL_ACTUATION_TIME, GLOBAL_DECISION_TIME, GLOBAL_PERCEPTION_TIME, InputAsCollection, Output, PERCEPTION_TIME
 
Constructor Summary
BPNet(java.util.Collection<Dimension> InputSpace, int NumHidden, AbstractOutputChunkCollection<? extends AbstractOutputChunk> Outputs)
          Initializes a backpropagating neural network.
 
Method Summary
 void backwardPass()
          Updates the neural network using standard backpropagation.
private  void computeErrors()
          Computes the errors of the output layer.
protected  void computeHiddenActivation()
          Calculates the hidden derivative.
private  void computeHiddenErrors()
          Computes the errors of the hidden layer.
protected  void computeOutputActivation()
          Calculates the output derivative.
private  double derivative(double input)
          The derivative of the activation function.
protected  void modifyHiddenToOutput()
          Modifies the weights of the hidden to output layer.
protected  void modifyInputToHidden()
          Modifies the weights of the input to hidden layer.
 
Methods inherited from class clarion.system.AbstractNeuralNet
forwardPass, getHiddenThresholds, getHtoOWeightMatrix, getItoHWeightMatrix, getNumHidden, getOutputThresholds, hardcodeWeights
 
Methods inherited from class clarion.system.AbstractTrainableImplicitModule
getSumSqErrors, setDesiredOutput, setDesiredOutput
 
Methods inherited from class clarion.system.AbstractImplicitModule
getChosenOutput, getInput, getNumInput, getNumOutput, getOutput, getOutput, getResponseTime, setChosenOutput, setInput, setInput, setInput
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

HiddenMomentum

private java.util.ArrayList<java.lang.Double> HiddenMomentum
The momentum for the hidden layers.


OutputMomentum

private java.util.ArrayList<java.lang.Double> OutputMomentum
The momentum from the output layers.


InputToHiddenMomentum

private java.util.ArrayList<java.util.ArrayList<java.lang.Double>> InputToHiddenMomentum
The input to hidden momentum matrix.


HiddenToOutputMomentum

private java.util.ArrayList<java.util.ArrayList<java.lang.Double>> HiddenToOutputMomentum
The hidden to output momentum matrix.


HiddenDeriv

private java.util.ArrayList<java.lang.Double> HiddenDeriv
The derivative of the hidden layers.


OutputDeriv

private java.util.ArrayList<java.lang.Double> OutputDeriv
The derivative of the output layers.


HiddenErrors

private java.util.ArrayList<java.lang.Double> HiddenErrors
The errors of the hidden layer.


Errors

private java.util.ArrayList<java.lang.Double> Errors
The errors of the output


GLOBAL_MOMENTUM

public static double GLOBAL_MOMENTUM
Momentum. used for the updating of weights.


MOMENTUM

public double MOMENTUM
Momentum. used for the updating of weights.


GLOBAL_LEARNING_RATE

public static double GLOBAL_LEARNING_RATE
Learning rate.


LEARNING_RATE

public double LEARNING_RATE
Learning rate.


GLOBAL_RZERO

public static double GLOBAL_RZERO
Tolerance of error.


RZERO

public double RZERO
Tolerance of error.

Constructor Detail

BPNet

public BPNet(java.util.Collection<Dimension> InputSpace,
             int NumHidden,
             AbstractOutputChunkCollection<? extends AbstractOutputChunk> Outputs)
Initializes a backpropagating neural network.

The Input for the neural network is a collection of dimension-values where each value represents one node.

If the network is being used as an action network in the ACS and you are using goals or specialized working memory chunks, remember that the input space must also contain all dimension-value pairs within those chunks that differ from the sensory information space.

Once the input space has been defined it cannot be changed. At any given forward pass through the network, the network can accept an arbitrary collection of dimension-values as input, but it will only adjust the activations of the inputs that were specified during initialization.

The nodes in the output layer are represented as output chunks.

Parameters:
InputSpace - A collection of dimension-value pairs to set as the input nodes.
NumHidden - The number of hidden nodes.
Outputs - The chunks to associate with the output layer.
Method Detail

backwardPass

public void backwardPass()
Updates the neural network using standard backpropagation. This method should not be called until the setDesiredOutput method has been called.

Specified by:
backwardPass in interface InterfaceTrainable
Specified by:
backwardPass in class AbstractNeuralNet

computeHiddenActivation

protected void computeHiddenActivation()
Calculates the hidden derivative.

Specified by:
computeHiddenActivation in class AbstractNeuralNet

computeOutputActivation

protected void computeOutputActivation()
Calculates the output derivative.

Specified by:
computeOutputActivation in class AbstractNeuralNet

computeErrors

private void computeErrors()
Computes the errors of the output layer.


computeHiddenErrors

private void computeHiddenErrors()
Computes the errors of the hidden layer.


modifyHiddenToOutput

protected void modifyHiddenToOutput()
Modifies the weights of the hidden to output layer.

Specified by:
modifyHiddenToOutput in class AbstractNeuralNet

modifyInputToHidden

protected void modifyInputToHidden()
Modifies the weights of the input to hidden layer.

Specified by:
modifyInputToHidden in class AbstractNeuralNet

derivative

private double derivative(double input)
The derivative of the activation function. For updating input to hidden layer weights.

Parameters:
input - The weighted input to the node.
Returns:
The value of the derivative of the activation function for a node given the weighted input.