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

com.ibm.able.beans.knn
Class AbleNaiveBayesClassifierAgent

java.lang.Object
  |
  +--com.ibm.able.AbleObject
        |
        +--com.ibm.able.AbleDefaultAgent
              |
              +--com.ibm.able.beans.knn.AbleNaiveBayesClassifierAgent
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 AbleNaiveBayesClassifierAgent
extends AbleDefaultAgent
implements java.io.Serializable

See Also:
Serialized Form

Field Summary
static java.lang.String defaultName
          Value assigned to name by default.
 
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
AbleNaiveBayesClassifierAgent()
          Constructor for AbleNaiveBayesClassifierAgent
AbleNaiveBayesClassifierAgent(java.lang.String theName)
          Constructor for AbleNaiveBayesClassifierAgent
 
Method Summary
static java.lang.String Copyright()
          Determine the copyright of this class.
 int getBufferSize()
          Get the buffer size
 int getDiscretization()
          Get the discretization value
 int getM()
          Get the m parameter
 int getMode()
          get the internal config for either TRAIN = training (storing data) from an external data file TEST = testing (using stored data) from an external data file or RUN = running (using stored data) from data placed in the input buffer
 AbleNaiveBayes getNaiveBayesBean()
          Get the NaiveBayes bean
 AbleFilter getNaiveBayesFil1()
          Get the filter 1 bean
 AbleFilter getNaiveBayesFil2()
          Get the filter 2 bean
 AbleImport getNaiveBayesImp1()
          Get the import 1 bean
 AbleImport getNaiveBayesImp2()
          Get the import 2 bean
 int getNumAttributes()
          Get the number of attributes
 int getNumClasses()
          Get the number of classes
 long getNumRecords()
          Get the number of records
 java.lang.String getTestDataFileName()
          Get the name of the test/run data file
 java.lang.String getTrainDataFileName()
          Get the name of the training data file
 void handleAbleEvent(AbleEvent theAbleEvent)
          Handle an Able event.
 void init()
          Generate a naive bayes Classifier agent bean.
static void main(java.lang.String[] args)
          Main method for testing
 void reset()
          Reset each bean created when the agent was initialized.
 void setBufferSize(int size)
          Set the buffer size
protected  void setDefaults()
          Set default values for parameters
 void setDiscretization(int aDiscr)
          Set the discretization value from agent
 void setM(int aM)
          Set the m parameter from agent
 void setMode(int mode)
          set the internal config for either TRAIN = readind data from an external data file TEST = testing (using stored data) from an external data file or RUN = running (using stored data) from data placed in the input buffer
 void setTestDataFileName(java.lang.String aFileName)
          Set the name of the test/run data file
 void setTrainDataFileName(java.lang.String aFileName)
          Set the name of the training data file
 
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, invokeUserDefinedFunction, isActiveDataSource, process, 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, processTimerEvent, 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, processTimerEvent
 
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.
Constructor Detail

AbleNaiveBayesClassifierAgent

public AbleNaiveBayesClassifierAgent()
                              throws AbleException
Constructor for AbleNaiveBayesClassifierAgent

AbleNaiveBayesClassifierAgent

public AbleNaiveBayesClassifierAgent(java.lang.String theName)
                              throws AbleException
Constructor for AbleNaiveBayesClassifierAgent
Method Detail

setDefaults

protected void setDefaults()
                    throws AbleException
Set default values for parameters

init

public void init()
          throws AbleException
Generate a naive bayes Classifier agent bean. If the training data file is not set, no action is taken. If the test data file is not set, the test import and filter beans are not generated. The following attributes must be set before initialization:
  1. trainDataFileName
  2. testDataFileName
The value for 'm' may also be set before initialization.
Overrides:
init in class AbleObject
Following copied from interface: com.ibm.able.AbleBean
Throws:
AbleException - If an error occurs.

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.

handleAbleEvent

public void handleAbleEvent(AbleEvent theAbleEvent)
                     throws AbleException
Handle an Able event. All events are passed up to the superclass (AbleObject) for processing.
Overrides:
handleAbleEvent in class AbleDefaultAgent
Parameters:
theAbleEvent - The event to handle.


setTrainDataFileName

public void setTrainDataFileName(java.lang.String aFileName)
                          throws AbleException
Set the name of the training data file

getTrainDataFileName

public java.lang.String getTrainDataFileName()
Get the name of the training data file

setTestDataFileName

public void setTestDataFileName(java.lang.String aFileName)
                         throws AbleException
Set the name of the test/run data file

getTestDataFileName

public java.lang.String getTestDataFileName()
Get the name of the test/run data file

setBufferSize

public void setBufferSize(int size)
Set the buffer size

getBufferSize

public int getBufferSize()
Get the buffer size

getNaiveBayesBean

public AbleNaiveBayes getNaiveBayesBean()
Get the NaiveBayes bean

getNaiveBayesImp1

public AbleImport getNaiveBayesImp1()
Get the import 1 bean

getNaiveBayesImp2

public AbleImport getNaiveBayesImp2()
Get the import 2 bean

getNaiveBayesFil1

public AbleFilter getNaiveBayesFil1()
Get the filter 1 bean

getNaiveBayesFil2

public AbleFilter getNaiveBayesFil2()
Get the filter 2 bean

setM

public void setM(int aM)
Set the m parameter from agent

getM

public int getM()
Get the m parameter

setDiscretization

public void setDiscretization(int aDiscr)
Set the discretization value from agent

getDiscretization

public int getDiscretization()
Get the discretization value

getNumRecords

public long getNumRecords()
Get the number of records

getNumClasses

public int getNumClasses()
Get the number of classes

getNumAttributes

public int getNumAttributes()
Get the number of attributes

setMode

public void setMode(int mode)
             throws AbleException
set the internal config for either TRAIN = readind data from an external data file TEST = testing (using stored data) from an external data file or RUN = running (using stored data) from data placed in the input buffer

getMode

public int getMode()
            throws AbleException
get the internal config for either TRAIN = training (storing data) from an external data file TEST = testing (using stored data) from an external data file or RUN = running (using stored data) from data placed in the input buffer

Copyright

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

main

public static void main(java.lang.String[] args)
Main method for testing

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

(C) Copyright IBM Corporation 1999, 2003