Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## com.ibm.able.beans.bayes
Class AbleNaiveBayes

    java.lang.Object
      com.ibm.able.AbleObject
          com.ibm.able.beans.bayes.AbleNaiveBayes

All Implemented Interfaces:
  AbleBean, AbleDataBufferManager, AbleEventListener, AbleEventListenerManager, AbleEventQueueManager, AbleEventQueueProcessor, AblePropertyChangeManager, AbleSerializable, java.io.Serializable

public class AbleNaiveBayes
extends AbleObject

See Also:
  Serialized Form

Field Summary
`protected int[][]` | `data`
`protected int[]` | `inNum`
`protected int[]` | `labels`
`protected NaiveBayes` | `NB`
`protected int` | `netMode`
`protected int` | `netNumRecs`
`protected int` | `netRecInx`
`protected int` | `nfeatures`
`protected int` | `ninst`
`protected int` | `nlabels`
`protected int` | `numInputs`
`protected int` | `numOutputs`
`protected int[]` | `nvals`
`protected int` | `nvalues`
`protected double[]` | `outNum`

Fields inherited from class com.ibm.able.AbleObject
`changed, chgSupport, comment, dataFlowEnabled, defaultName, destBufferConnections, eventQueue, fileName, inputBuffer, listeners, logger, name, outputBuffer, parent, properties, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport, trace`

Constructor Summary
`AbleNaiveBayes()` construct an AbleNaiveBayes bean
`AbleNaiveBayes(int ncls, int nftr, int[] nval, int m, double[] cpriors, double[][][] ppriors)` construct AbleNaiveBayes bean with the explicitly specified parameters ncls - number of class labels nftr - number of features nval - number of values per each feature (assuming nominal - discrete finite-valued - features) cpriors - prior probability distribution over class labels m - equivalent sample size ppriors - prior estimates of the probabilities P(f|C) (used for Bayesian parameter estimation with equivalent sample size method)
`AbleNaiveBayes(java.lang.String name)` construct an AbleNaiveBayes bean

Method Summary
`double` | `getAccuracy()`
`double` | `getAvgLikelihood()`
`double` | `getAvgLogLikelihood()`
`double[]` | `getClassPriors()`
`double[]` | `getClassProb()`
`int[][]` | `getConfusionMatrix()`
`double[][][]` | `getCPT()`
`double[]` | `getEqSampleSize()`
`int` | `getNClasses()`
`int` | `getNetMode()`
`int` | `getNetNumRecs()`
`int` | `getNetRecInx()`
`int` | `getNFeatures()`
`int[]` | `getNFValues()`
`void` | `init()` Initialize the bean Read in the file and create the Naive Bayes Network
`protected void` | `initFromImport()` try to figure out the Bayes network architecture from an AbleImport and DataSet object
`void` | `process()` Process a single record from the input buffer if in train mode, add info to the network if in test mode, classify it and place the class index in the output buffer
`void` | `processTimerEvent()` Not used in this class
`void` | `reset()` Reset this bean to its "initialized" state.
`void` | `setClassPriors(double[] cpriors)`
`void` | `setNClasses(int ncls)`
`void` | `setNetMode(int mode)` train (build hypothesis) or test(classify) modes
`void` | `setNFeatures(int nftr, int[] nfv)`

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, getInputBufferAsString, getInputBufferAsStringArray, getInputBufferContents, getLogger, getName, getOutputBuffer, getOutputBuffer, getOutputBufferAsString, getOutputBufferAsStringArray, getOutputBufferContents, getParent, getProperties, getProperty, getPropertyChangeListeners, getPropertyConnectionManager, getSleepTime, getSourceBufferConnections, getState, getTraceLogger, handleAbleEvent, hasInputBuffer, hasOutputBuffer, init, isAbleEventPostingEnabled, isAbleEventProcessingEnabled, isChanged, isConnectable, isDataFlowEnabled, isTimerEventProcessingEnabled, notifyAbleEventListeners, process, processAbleEvent, processBufferConnections, processNoEventProcessingEnabledSituation, quitAll, quitEnabledEventProcessing, removeAbleEventListener, removeAllAbleEventListeners, removeAllBufferConnections, removeAllConnections, removeAllPropertyConnections, removeDestBufferConnection, removeProperty, removePropertyChangeListener, removePropertyConnection, removeSourceBufferConnection, removeStateChangeListener, restartEnabledEventProcessing, restoreFromFile, restoreFromFile, restoreFromSerializedFile, restoreFromStream, resumeAll, resumeEnabledEventProcessing, saveToFile, saveToFile, setAbleEventProcessingEnabled, setChanged, setComment, setDataFlowEnabled, setFileName, setInputBuffer, setInputBuffer, setLogger, setName, setOutputBuffer, setOutputBuffer, setParent, setProperties, setProperty, setSleepTime, setState, setTimerEventProcessingEnabled, setTraceLogger, sourceConnectionsOK, startEnabledEventProcessing, suspendAll, suspendEnabledEventProcessing`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### NB

    protected NaiveBayes NB

### data

    protected int[][] data

### labels

    protected int[] labels

### nvals

    protected int[] nvals

### nlabels

    protected int nlabels

### nfeatures

    protected int nfeatures

### nvalues

    protected int nvalues

### ninst

    protected int ninst

### numInputs

    protected int numInputs

### numOutputs

    protected int numOutputs

### inNum

    protected int[] inNum

### outNum

    protected double[] outNum

### netMode

    protected int netMode

### netNumRecs

    protected int netNumRecs

### netRecInx

    protected int netRecInx

Constructor Detail

### AbleNaiveBayes

    public AbleNaiveBayes()
                   throws AbleException

  construct an AbleNaiveBayes bean

### AbleNaiveBayes

    public AbleNaiveBayes(java.lang.String name)
                   throws AbleException

  construct an AbleNaiveBayes bean

### AbleNaiveBayes

    public AbleNaiveBayes(int ncls,
                          int nftr,
                          int[] nval,
                          int m,
                          double[] cpriors,
                          double[][][] ppriors)
                   throws AbleException

  construct AbleNaiveBayes bean with the explicitly specified parameters ncls - number of class labels nftr - number of features nval - number of values per each feature (assuming nominal - discrete finite-valued - features) cpriors - prior probability distribution over class labels m - equivalent sample size ppriors - prior estimates of the probabilities P(f|C) (used for Bayesian parameter estimation with equivalent sample size method)

Method Detail

### getNetMode

    public int getNetMode()

### getNetNumRecs

    public int getNetNumRecs()

### getNetRecInx

    public int getNetRecInx()

### setNetMode

    public void setNetMode(int mode)

  train (build hypothesis) or test(classify) modes

### init

    public void init()
              throws AbleException

  Initialize the bean Read in the file and create the Naive Bayes Network

  Specified by:
    `init` in interface `AbleBean`
  Overrides:
    `init` in class `AbleObject`
  Throws:
    `AbleException` - If an error occurs.
  See Also:
    `AbleObject.startEnabledEventProcessing()`

### reset

    public void reset()

  Description copied from class: `AbleObject`
  Reset this bean to its "initialized" state.

  This base method has no default implementation. It only provides tracing.

  Specified by:
    `reset` in interface `AbleBean`
  Overrides:
    `reset` in class `AbleObject`
  See Also:
    `AbleBean.reset()`

### process

    public void process()
                 throws AbleException

  Process a single record from the input buffer if in train mode, add info to the network if in test mode, classify it and place the class index in the output buffer

  Specified by:
    `process` in interface `AbleBean`
  Overrides:
    `process` in class `AbleObject`
  Throws:
    `AbleException`
  See Also:
    `AbleObject.inputBuffer`, `AbleObject.outputBuffer`, `AbleBean.process()`

### processTimerEvent

    public void processTimerEvent()

  Not used in this class

  Specified by:
    `processTimerEvent` in interface `AbleEventQueueProcessor`
  Overrides:
    `processTimerEvent` in class `AbleObject`

### initFromImport

    protected void initFromImport()
                           throws AbleException

  try to figure out the Bayes network architecture from an AbleImport and DataSet object

  Throws:
    `AbleException`

### getNClasses

    public int getNClasses()

### getNFeatures

    public int getNFeatures()

### getNFValues

    public int[] getNFValues()

### getEqSampleSize

    public double[] getEqSampleSize()

### getCPT

    public double[][][] getCPT()

### getClassPriors

    public double[] getClassPriors()

### getAvgLikelihood

    public double getAvgLikelihood()

### getAvgLogLikelihood

    public double getAvgLogLikelihood()

### getAccuracy

    public double getAccuracy()

### getClassProb

    public double[] getClassProb()

### getConfusionMatrix

    public int[][] getConfusionMatrix()

### setNClasses

    public void setNClasses(int ncls)

### setNFeatures

    public void setNFeatures(int nftr,
                             int[] nfv)

### setClassPriors

    public void setClassPriors(double[] cpriors)

Overview | Package | Class | Use | Tree | Serialized | Deprecated | Index | Help
| ABLE 2.3.0 07/13/2005 14:21:00
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

(C) Copyright IBM Corporation 1999, 2005