ABLE 2.0.0 07/02/2003 10:25:01

com.ibm.able.agents
Class AbleNeuralPredictionAgent

java.lang.Object
  |
  +--com.ibm.able.AbleObject
        |
        +--com.ibm.able.AbleDefaultAgent
              |
              +--com.ibm.able.agents.AbleNeuralPredictionAgent
All Implemented Interfaces:
AbleAgent, AbleBean, AbleBeanContainer, AbleDataBufferManager, AbleEventListener, AbleEventListenerManager, AbleEventQueueManager, AbleEventQueueProcessor, AblePropertyChangeManager, AbleSerializable, AbleUserDefinedFunctionManager, java.util.EventListener, java.beans.PropertyChangeListener, java.io.Serializable

public class AbleNeuralPredictionAgent
extends AbleDefaultAgent
implements java.io.Serializable

This class implements prediction using back propagation

See Also:
Serialized Form

Field Summary
 double avgRMSError
           
protected  int bufferSize
           
protected  java.lang.String dataFileName
           
static java.lang.String defaultName
          Value assigned to name by default.
protected  boolean explicitErrorMode
           
protected  int feedbackType
           
protected  AbleFilter filt1
           
protected  AbleFilter filt2
           
protected  boolean firstPass
           
protected  int horizon
           
protected  AbleImport imp1
           
protected  AbleImport imp2
           
protected  int lastNumPasses
           
protected  int maxNumPasses
           
protected  double maxRMSError
           
protected  AbleBackPropagation net
           
protected  java.lang.String netArch
           
 int numPasses
           
protected  java.lang.String testDataFileName
           
protected  boolean training
           
protected  boolean trainOK
           
protected  int trainToTestRatio
           
protected  AbleTimeSeriesFilter tsFilter
           
protected  int windowSize
           
 
Fields inherited from class com.ibm.able.AbleDefaultAgent
activeDataSource, eventConnections, myBeans, numEpochs, processList, processListOK, userDefinedFunctions
 
Fields inherited from class com.ibm.able.AbleObject
changed, chgSupport, comment, dataFlowEnabled, destBufferConnections, eventQueue, fileName, inputBuffer, listeners, logger, name, outputBuffer, parent, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport, trace
 
Constructor Summary
AbleNeuralPredictionAgent()
           
AbleNeuralPredictionAgent(java.lang.String aName)
           
 
Method Summary
protected  void autoTrain(int numPasses)
          this method toggles between train/test modes it is only called at the end of an epoch
static java.lang.String Copyright()
          Determine the copyright of this class.
 double getAvgRMSError()
           
 int getBufferSize()
           
 java.lang.String getDataFileName()
           
 boolean getExplicitErrorMode()
           
 int getHorizon()
          Get the horizon -- number of time steps in the future for the target field
 int getMaxNumPasses()
           
 double getMaxRMSError()
           
 int getMode()
          get the internal config for either NNTRAIN = training from an external data file NNTEST = testing (with network locked) from an external data file or NNRUN = running (with network locked) from data placed in the input buffer
 java.lang.String getNetArch()
          Return the number of hidden units specified.
 java.lang.String getNetArchitecture()
          Return the number of input, hidden, and output units.
 AbleBackPropagation getNetwork()
           
 int getNumPasses()
           
 java.lang.String getTestDataFileName()
           
 double getTolerance()
           
 int getTrainToTestRatio()
           
 int getWindowSize()
          Get the windowSize parameter -- number of time the input record is duplicated for presentation to the neural network
 void init()
          Generate a complete neural prediction agent bean The training source file is used to create filters.
 boolean isTraining()
          Check to see if the network is in the process of training.
 void process()
          Process a single input record ....
 void processTimerEvent()
          This method is called from the asynch thread It is only used for automated training of the neural agent
 void reset()
          Reset each bean created when the agent was initialized.
 void setBufferSize(int size)
           
 void setDataFileName(java.lang.String aFileName)
           
protected  void setDefaults()
           
 void setExplicitErrorMode(boolean state)
           
 void setFeedbackType(int type)
           
 void setHorizon(int horizon)
          Set the horizon parameter -- the number of time steps (records) into the future that the target fields are taken from.
 void setMaxNumPasses(int num)
           
 void setMaxRMSError(double err)
           
 void setMode(int mode)
          set the internal config for either NNTRAIN = training from an external data file NNTEST = testing (with network locked) from an external data file or NNRUN = running (with network locked) from data placed in the input buffer
 void setNetArch(java.lang.String arch)
           
 void setNumPasses(int num)
           
 void setTestDataFileName(java.lang.String aFileName)
           
 void setTolerance(double tol)
           
 void setTrainToTestRatio(int num)
           
 void setWindowSize(int windowSize)
          Set the windowSize parameter for time-series processing
 void startTraining()
          start automatically training the model from the external data
 void stopTraining()
          stop automatically training the model from the external data
 
Methods inherited from class com.ibm.able.AbleDefaultAgent
addBean, addBeans, addEventConnection, addUserDefinedFunction, buildProcessList, clsNm, containsBean, containsBean, containsUserDefinedFunction, debugTrace, generateUniqueName, getBean, getBeans, getDataSource, getNumEpochs, getProcessList, getUserDefinedFunction, getUserDefinedFunctions, handleAbleEvent, invokeUserDefinedFunction, isActiveDataSource, propertyChange, quitAll, quitEnabledEventProcessing, removeAllBeans, removeAllConnections, removeAllEventConnections, removeBean, removeBean, removeBeans, removeEventConnection, removeUserDefinedFunction, resumeAll, setActiveDataSource, setDataFlowEnabled, setProcessList, setUserDefinedFunctions, suspendAll
 
Methods inherited from class com.ibm.able.AbleObject
addAbleEventListener, addDestBufferConnection, addPropertyChangeListener, addPropertyConnection, addSourceBufferConnection, addStateChangeListener, dataChanged, firePropertyChange, flushAbleEventQueue, getAbleEventListeners, getAbleEventProcessingEnabled, getAbleEventQueueSize, getComment, getDestBufferConnections, getFileName, getInputBuffer, getInputBuffer, getInputBufferAsStringArray, getInputBufferContents, getLogger, getName, getOutputBuffer, getOutputBuffer, getOutputBufferAsStringArray, getOutputBufferContents, getParent, getPropertyConnectionManager, getSleepTime, getSourceBufferConnections, getState, getTraceLogger, hasInputBuffer, hasOutputBuffer, init, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isChanged, isConnectable, isDataFlowEnabled, isTimerEventProcessingEnabled, notifyAbleEventListeners, process, processAbleEvent, processBufferConnections, processNoEventProcessingEnabledSituation, removeAbleEventListener, removeAllAbleEventListeners, removeAllBufferConnections, removeAllPropertyConnections, removeDestBufferConnection, removePropertyChangeListener, removePropertyConnection, removeSourceBufferConnection, removeStateChangeListener, restartEnabledEventProcessing, restoreFromFile, restoreFromFile, restoreFromSerializedFile, restoreFromStream, resumeEnabledEventProcessing, saveToFile, saveToFile, setAbleEventProcessingEnabled, setChanged, setComment, setFileName, setInputBuffer, setInputBuffer, setLogger, setName, setOutputBuffer, setOutputBuffer, setParent, setSleepTime, setState, setTimerEventProcessingEnabled, setTraceLogger, sourceConnectionsOK, startEnabledEventProcessing, suspendEnabledEventProcessing
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.ibm.able.AbleBean
getComment, getLogger, getName, getParent, getState, getTraceLogger, init, isChanged, process, setChanged, setComment, setLogger, setName, setParent, setState, setTraceLogger
 
Methods inherited from interface com.ibm.able.AbleDataBufferManager
addDestBufferConnection, addSourceBufferConnection, getDestBufferConnections, getInputBuffer, getInputBuffer, getInputBufferAsStringArray, getInputBufferContents, getOutputBuffer, getOutputBuffer, getOutputBufferAsStringArray, getOutputBufferContents, getSourceBufferConnections, hasInputBuffer, hasOutputBuffer, isConnectable, isDataFlowEnabled, processBufferConnections, removeAllBufferConnections, removeDestBufferConnection, removeSourceBufferConnection, setInputBuffer, setInputBuffer, setOutputBuffer, setOutputBuffer
 
Methods inherited from interface com.ibm.able.AbleEventListenerManager
addAbleEventListener, dataChanged, getAbleEventListeners, notifyAbleEventListeners, removeAbleEventListener
 
Methods inherited from interface com.ibm.able.AbleEventQueueManager
flushAbleEventQueue, getAbleEventProcessingEnabled, getAbleEventQueueSize, getSleepTime, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isTimerEventProcessingEnabled, restartEnabledEventProcessing, resumeEnabledEventProcessing, setAbleEventProcessingEnabled, setSleepTime, setTimerEventProcessingEnabled, startEnabledEventProcessing, suspendEnabledEventProcessing
 
Methods inherited from interface com.ibm.able.AbleEventQueueProcessor
processAbleEvent, processNoEventProcessingEnabledSituation
 
Methods inherited from interface com.ibm.able.AblePropertyChangeManager
addPropertyChangeListener, addPropertyConnection, getPropertyConnectionManager, removeAllPropertyConnections, removePropertyChangeListener, removePropertyConnection
 
Methods inherited from interface com.ibm.able.AbleSerializable
getFileName, restoreFromFile, restoreFromFile, saveToFile, saveToFile, setFileName
 
Methods inherited from interface com.ibm.able.AbleBeanContainer
getName
 

Field Detail

defaultName

public static final java.lang.String defaultName
Value assigned to name by default.

dataFileName

protected java.lang.String dataFileName

testDataFileName

protected java.lang.String testDataFileName

bufferSize

protected int bufferSize

maxNumPasses

protected int maxNumPasses

maxRMSError

protected double maxRMSError

netArch

protected java.lang.String netArch

feedbackType

protected int feedbackType

imp1

protected AbleImport imp1

imp2

protected AbleImport imp2

filt1

protected AbleFilter filt1

filt2

protected AbleFilter filt2

tsFilter

protected AbleTimeSeriesFilter tsFilter

net

protected AbleBackPropagation net

avgRMSError

public double avgRMSError

numPasses

public int numPasses

training

protected boolean training

explicitErrorMode

protected boolean explicitErrorMode

lastNumPasses

protected int lastNumPasses

trainToTestRatio

protected int trainToTestRatio

trainOK

protected boolean trainOK

windowSize

protected int windowSize

horizon

protected int horizon

firstPass

protected boolean firstPass
Constructor Detail

AbleNeuralPredictionAgent

public AbleNeuralPredictionAgent()
                          throws AbleException

AbleNeuralPredictionAgent

public AbleNeuralPredictionAgent(java.lang.String aName)
                          throws AbleException
Method Detail

reset

public void reset()
           throws AbleException
Reset each bean created when the agent was initialized. Restore processing options to default values.
Overrides:
reset in class AbleDefaultAgent
Following copied from class: com.ibm.able.AbleDefaultAgent
Throws:
AbleException - If an error occurs when resetting a contained bean. All errors are collected and insert into the exception so that one bean's error does not prevent another from being reset.

setDefaults

protected void setDefaults()
                    throws AbleException

init

public void init()
          throws AbleException
Generate a complete neural prediction agent bean The training source file is used to create filters.
Overrides:
init in class AbleObject
Following copied from interface: com.ibm.able.AbleBean
Throws:
AbleException - If an error occurs.

process

public void process()
             throws AbleException
Process a single input record .... Special processing when windowSize > 1, and/or horizon > 0 for time-series filter
Overrides:
process in class AbleDefaultAgent
Following copied from class: com.ibm.able.AbleDefaultAgent
Throws:
AbleException - If an error occurs. Errors from each contained bean are accumulated.

processTimerEvent

public void processTimerEvent()
                       throws AbleException
This method is called from the asynch thread It is only used for automated training of the neural agent
Overrides:
processTimerEvent in class AbleObject
Following copied from interface: com.ibm.able.AbleEventQueueProcessor
Throws:
AbleException - If an error occurs.

autoTrain

protected void autoTrain(int numPasses)
this method toggles between train/test modes it is only called at the end of an epoch

setDataFileName

public void setDataFileName(java.lang.String aFileName)
                     throws AbleException

getDataFileName

public java.lang.String getDataFileName()

setTestDataFileName

public void setTestDataFileName(java.lang.String aFileName)
                         throws AbleException

getTestDataFileName

public java.lang.String getTestDataFileName()

setBufferSize

public void setBufferSize(int size)

getBufferSize

public int getBufferSize()

getNetwork

public AbleBackPropagation getNetwork()

getNumPasses

public int getNumPasses()

setNumPasses

public void setNumPasses(int num)

setMaxNumPasses

public void setMaxNumPasses(int num)

getMaxNumPasses

public int getMaxNumPasses()

setMaxRMSError

public void setMaxRMSError(double err)

getMaxRMSError

public double getMaxRMSError()

getAvgRMSError

public double getAvgRMSError()

setNetArch

public void setNetArch(java.lang.String arch)
                throws AbleException

setFeedbackType

public void setFeedbackType(int type)
                     throws AbleException

setTrainToTestRatio

public void setTrainToTestRatio(int num)

getTrainToTestRatio

public int getTrainToTestRatio()

getNetArch

public java.lang.String getNetArch()
Return the number of hidden units specified. Input and output units are calculated.

getNetArchitecture

public java.lang.String getNetArchitecture()
Return the number of input, hidden, and output units.

setExplicitErrorMode

public void setExplicitErrorMode(boolean state)

getExplicitErrorMode

public boolean getExplicitErrorMode()

setTolerance

public void setTolerance(double tol)

getTolerance

public double getTolerance()

setWindowSize

public void setWindowSize(int windowSize)
Set the windowSize parameter for time-series processing

getWindowSize

public int getWindowSize()
Get the windowSize parameter -- number of time the input record is duplicated for presentation to the neural network

setHorizon

public void setHorizon(int horizon)
Set the horizon parameter -- the number of time steps (records) into the future that the target fields are taken from.

getHorizon

public int getHorizon()
Get the horizon -- number of time steps in the future for the target field

setMode

public void setMode(int mode)
             throws AbleException
set the internal config for either NNTRAIN = training from an external data file NNTEST = testing (with network locked) from an external data file or NNRUN = running (with network locked) from data placed in the input buffer

getMode

public int getMode()
            throws AbleException
get the internal config for either NNTRAIN = training from an external data file NNTEST = testing (with network locked) from an external data file or NNRUN = running (with network locked) from data placed in the input buffer

isTraining

public boolean isTraining()
                   throws AbleException
Check to see if the network is in the process of training.

startTraining

public void startTraining()
                   throws AbleException
start automatically training the model from the external data

stopTraining

public void stopTraining()
                  throws AbleException
stop automatically training the model from the external data

Copyright

public static java.lang.String Copyright()
Determine the copyright of this class.
Returns:
A String containing this class's copyright statement.

ABLE 2.0.0 07/02/2003 10:25:01

(C) Copyright IBM Corporation 1999, 2003