clarion.common
Class BPNet

java.lang.Object
  extended byclarion.common.BPNet
Direct Known Subclasses:
AMNet, QBPNet

public class BPNet
extends java.lang.Object


Field Summary
protected  int BLAT
          variables for RT.
protected  int BLDT
          variables for RT.
protected  int BLPT
          variables for RT.
protected  int BLRT
          variables for RT.
protected  boolean debug
           
protected  double[] DesiredOutput
          the desired output.
protected  double[] Errors
          the errors of output and hidden.
protected  double Eta
          learning rate.
protected  Global global
          global settings.
protected  double[] Hidden
          the input, hidden and output.
protected  double[] HiddenDeriv
          the derivative of output and hidden.
protected  double[] HiddenErrors
          the errors of output and hidden.
protected  double[] HiddenMomentum
          the momentum for hidden and output.
protected  double[] HiddenThresholds
          the thresholds of output and hidden.
protected  double[][] HiddenToOutputMomentum
          the momentums.
protected  double[][] HiddenToOutputWeights
          the weights.
protected  double HINITTHRESHOLD
           
protected  double HINITWEIGHT
           
protected  double[][] HtoOWeights
           
protected  double[] Input
          the input, hidden and output.
protected  short[] inputDVs
          variables for information of dimensional values.
protected  double[][] InputToHiddenMomentum
          the momentums.
protected  double[][] InputToHiddenWeights
          the weights.
protected  double[][] ItoHWeights
           
protected  double LINITTHRESHOLD
           
protected  double LINITWEIGHT
           
protected  double Momentum
          momentum.
protected  int nHidden
          the numbers of units in the layer of input, hidden and output.
protected  int nInput
          the numbers of units in the layer of input, hidden and output.
protected  double NM
          variables for success rate.
protected  int nOutput
          the numbers of units in the layer of input, hidden and output.
protected  double[] Output
          the input, hidden and output.
protected  double[] OutputDeriv
          the derivative of output and hidden.
protected  short[] outputDVs
          variables for information of dimensional values.
protected  double[] OutputMomentum
          the momentum for hidden and output.
protected  short[] outputOffsets
          the start index of each action's dim in net output.
protected  double[] OutputThresholds
          the thresholds of output and hidden.
protected  double PM
          variables for success rate.
protected  double RZero
          tolerance of error...sorta
protected  double SUCC_C3
          parameters for success rate.
protected  double SUCC_C4
          parameters for success rate.
protected  double succRate
          variables for success rate.
protected  double sumSqErrors
           
 
Constructor Summary
BPNet(int inputNum, int netIdx, Global global, int netType)
          new constructor.
BPNet(int numInput, int numHidden, int numOutput)
           
 
Method Summary
 void backwardPass()
          update all of the weights inside the network triggered by the difference between desired output and the actual output.
 void calcRT(int BLAT)
          calculate the response time.
protected  void computeErrors()
          computes the errors of output layer.
protected  void computeHiddenActivation()
          calculates the hidden derivative.
protected  void computeHiddenErrors()
          computes the errors of hidden layer.
protected  void computeOutputActivation()
          calculates the output derivative.
 void forwardPass()
          calculate the actual output given current input.
 void getInput(double[] fillMe)
          returns current input.
 int getnHidden()
          returns the nubmer of hidden units.
 int getnInput()
          returns the nubmer of input units.
 double getNM()
          get the number of negative match.
 int getnOutput()
          returns the nubmer of output units.
 double[] getOutput()
          returns current output.
 void getOutput(double[] out)
          returns current output.
 void getOutput(double[] fillMe, int start, int length)
          Returns a part of current output.
 double getOutput(int idx)
          returns a particular output.
 double getOutput(int dimIdx, int offset)
          returns a particular output.
 double getPM()
          get the number of positive match.
 int getResponseTime()
          get the response time.
 double getSuccRate()
          get the success rate.
 double getSumSqErrors()
           
protected  void modifyHiddenToOutput()
          modifies the weights of hidden to output layer
protected  void modifyInputToHidden()
          modifies the weights of input to hidden layer
 void reinitWeights()
          reinitializes the weights.
 void resetMatches()
          resets the matches.
 void restoreInitWeights()
          restores the weights.
 void setDesiredOutput(double[] dOutputs)
          set the desired output.
 void setDesiredOutput(Feature[] output)
          set the desired output with an array of desired features.
 void setDesiredOutput(int index, double value)
          set one desired element in the output.
 void setDesiredOutput(short[] action)
          set the desired output with an array of desired acions.
 void setInput(double[] newInputs)
          set current input.
 void setInput(int[] newInputs)
          Sets current input.
 void setInput(int index, double value)
          set particular element in the input.
 void setLearningRate(double value)
          sets the learning rate.
 void setMomentum(double value)
          sets the momentum.
 void updateMatches(boolean flag)
          updates the matches.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

global

protected Global global
global settings.


nInput

protected int nInput
the numbers of units in the layer of input, hidden and output.


nHidden

protected int nHidden
the numbers of units in the layer of input, hidden and output.


nOutput

protected int nOutput
the numbers of units in the layer of input, hidden and output.


Input

protected double[] Input
the input, hidden and output.


Output

protected double[] Output
the input, hidden and output.


Hidden

protected double[] Hidden
the input, hidden and output.


OutputMomentum

protected double[] OutputMomentum
the momentum for hidden and output.


HiddenMomentum

protected double[] HiddenMomentum
the momentum for hidden and output.


OutputThresholds

protected double[] OutputThresholds
the thresholds of output and hidden.


HiddenThresholds

protected double[] HiddenThresholds
the thresholds of output and hidden.


OutputDeriv

protected double[] OutputDeriv
the derivative of output and hidden.


HiddenDeriv

protected double[] HiddenDeriv
the derivative of output and hidden.


Errors

protected double[] Errors
the errors of output and hidden.


HiddenErrors

protected double[] HiddenErrors
the errors of output and hidden.


DesiredOutput

protected double[] DesiredOutput
the desired output.


InputToHiddenWeights

protected double[][] InputToHiddenWeights
the weights.


HiddenToOutputWeights

protected double[][] HiddenToOutputWeights
the weights.


ItoHWeights

protected double[][] ItoHWeights

HtoOWeights

protected double[][] HtoOWeights

InputToHiddenMomentum

protected double[][] InputToHiddenMomentum
the momentums.


HiddenToOutputMomentum

protected double[][] HiddenToOutputMomentum
the momentums.


HINITWEIGHT

protected double HINITWEIGHT

LINITWEIGHT

protected double LINITWEIGHT

HINITTHRESHOLD

protected double HINITTHRESHOLD

LINITTHRESHOLD

protected double LINITTHRESHOLD

Momentum

protected double Momentum
momentum. used for update of weights.


Eta

protected double Eta
learning rate.


RZero

protected double RZero
tolerance of error...sorta


debug

protected boolean debug

sumSqErrors

protected double sumSqErrors

BLRT

protected int BLRT
variables for RT.


BLPT

protected int BLPT
variables for RT.


BLDT

protected int BLDT
variables for RT.


BLAT

protected int BLAT
variables for RT.


PM

protected double PM
variables for success rate.


NM

protected double NM
variables for success rate.


succRate

protected double succRate
variables for success rate.


SUCC_C3

protected double SUCC_C3
parameters for success rate.


SUCC_C4

protected double SUCC_C4
parameters for success rate.


inputDVs

protected short[] inputDVs
variables for information of dimensional values.


outputDVs

protected short[] outputDVs
variables for information of dimensional values.


outputOffsets

protected short[] outputOffsets
the start index of each action's dim in net output.

Constructor Detail

BPNet

public BPNet(int numInput,
             int numHidden,
             int numOutput)

BPNet

public BPNet(int inputNum,
             int netIdx,
             Global global,
             int netType)
new constructor.

Parameters:
inputNum - number of input units.
netIdx - net index.
global - the global settings.
netType - net type.
Method Detail

reinitWeights

public void reinitWeights()
reinitializes the weights.


restoreInitWeights

public void restoreInitWeights()
restores the weights.


getnInput

public int getnInput()
returns the nubmer of input units.

Returns:
the nubmer of input units.

getnHidden

public int getnHidden()
returns the nubmer of hidden units.

Returns:
the nubmer of hidden units.

getnOutput

public int getnOutput()
returns the nubmer of output units.

Returns:
the nubmer of output units.

setLearningRate

public void setLearningRate(double value)
sets the learning rate.

Parameters:
value - the value to set.

setMomentum

public void setMomentum(double value)
sets the momentum.

Parameters:
value - the value to set.

getInput

public void getInput(double[] fillMe)
returns current input.

Parameters:
fillMe - the array to store current input.

getOutput

public double[] getOutput()
returns current output.

Returns:
current output in the format of an array.

getOutput

public void getOutput(double[] out)
returns current output.

Parameters:
out - the array to store current output.

getOutput

public double getOutput(int idx)
returns a particular output.

Parameters:
idx - the index in the output array.
Returns:
the particular output.

getOutput

public double getOutput(int dimIdx,
                        int offset)
returns a particular output.

Parameters:
dimIdx - the index on a dimension in the output.
offset - the offset inside the dimension.
Returns:
the particular output.

getOutput

public void getOutput(double[] fillMe,
                      int start,
                      int length)
Returns a part of current output.


setInput

public void setInput(int[] newInputs)
Sets current input.


setInput

public void setInput(double[] newInputs)
set current input.


setInput

public void setInput(int index,
                     double value)
set particular element in the input.


setDesiredOutput

public void setDesiredOutput(double[] dOutputs)
set the desired output.


setDesiredOutput

public void setDesiredOutput(int index,
                             double value)
set one desired element in the output.


setDesiredOutput

public void setDesiredOutput(short[] action)
set the desired output with an array of desired acions.


setDesiredOutput

public void setDesiredOutput(Feature[] output)
set the desired output with an array of desired features.


getSumSqErrors

public double getSumSqErrors()

getPM

public double getPM()
get the number of positive match.


getNM

public double getNM()
get the number of negative match.


getSuccRate

public double getSuccRate()
get the success rate.


getResponseTime

public int getResponseTime()
get the response time.


resetMatches

public void resetMatches()
resets the matches.


updateMatches

public void updateMatches(boolean flag)
updates the matches.


forwardPass

public void forwardPass()
calculate the actual output given current input.


backwardPass

public void backwardPass()
update all of the weights inside the network triggered by the difference between desired output and the actual output.


calcRT

public void calcRT(int BLAT)
calculate the response time.


computeHiddenActivation

protected void computeHiddenActivation()
calculates the hidden derivative.


computeOutputActivation

protected void computeOutputActivation()
calculates the output derivative.


computeErrors

protected void computeErrors()
computes the errors of output layer.


computeHiddenErrors

protected void computeHiddenErrors()
computes the errors of hidden layer.


modifyHiddenToOutput

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


modifyInputToHidden

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