|
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 | |||||||||||
java.lang.Objectcom.ibm.able.AbleObject
com.ibm.able.beans.knn.AbleNaiveBayes
| Field Summary | |
|---|---|
static java.lang.String |
defaultName
Value assigned to name by default. |
double[] |
inNum
The numeric input buffer. |
static java.lang.String[] |
MODE_NAMES
Labels for the train, test and run modes for GUI use. |
double[] |
outNum
The numeric output buffer. |
static java.lang.String |
PropertyDiscr
|
static int |
PropertyDiscrId
|
static java.lang.String |
PropertyM
|
static int |
PropertyMId
|
static int |
RUN
Application or Run mode output is produced. |
static int |
TEST
Test mode performance is tested (errors are computed). |
static int |
TRAIN
Training mode training data is stored. |
| Fields inherited from class com.ibm.able.AbleObject |
|---|
changed, chgSupport, comment, dataFlowEnabled, destBufferConnections, eventQueue, fileName, inputBuffer, listeners, logger, name, outputBuffer, parent, properties, propertyConnectionMgr, sourceBufferConnections, state, stateChgSupport, trace |
| Constructor Summary | |
|---|---|
AbleNaiveBayes()
Default constructor. |
|
AbleNaiveBayes(java.lang.String aName)
Construct a naive bayes bean with specified name. |
|
AbleNaiveBayes(java.lang.String aName,
int args)
|
|
| Method Summary | |
|---|---|
void |
calcPosteriorProb()
Calculate posterior probability for all the elements of the attribute-value-class table. |
double[] |
calcPriorClassProb()
Calculate prior class probability from training data. |
void |
calcPriorProb()
Calculate prior probability for all the elements of the attribute-value-class table (uniform distribution is assumed). |
void |
generateTranslateTemplates(AbleFilter inFilt,
AbleFilter outFilt,
java.util.Vector fields)
The next three methods change the default behaviour of the ABLE filters, making them appropriate for Naive Bayes algorithm. |
double |
getAccuracy()
Get the accuracy. |
double |
getClass(double[] x)
Find to which class the current test example is assigned by Naive Bayes algorithm. |
double |
getCurrentActualClass()
Get the current actual classes corresponding to the current test example. |
double |
getCurrentLearnedClass()
Get the current learned classes corresponding to the current test/run example. |
double[] |
getCurrentTestExample()
Get the current test example. |
double[] |
getCurrentTrainExample()
Get the current training example. |
int |
getDiscretization()
Get metric parameter. |
AttributeValueClass |
getElement(java.util.Vector v,
int attr,
int val,
int cl)
Find an Attribute-Value-Class element in a Vector of Attribute-Value-Class elements and return it. |
double |
getError()
Get the error. |
double[] |
getInNum()
|
int |
getM()
Get metric parameter. |
int |
getMaxProbIndex(double[] prob)
Given an array of class probabilities, get the index corresponding to the class with the largest probability value. |
int |
getNaiveBayesMode()
Get the current operating mode of the naive bayes bean. |
int |
getNumAttributes()
Get numAttr parameter. |
int |
getNumClasses()
Get numClasses parameter. |
long |
getNumCorrectTestExamples()
Get the number of correctly classified test examples. |
int |
getNumInstances(int clasS)
Calculates the number of instances in the training data set belonging to a given class based on information stored in the attribute-value-class table. |
long |
getNumRecords()
Get numRecords parameter. |
long |
getNumTestExamples()
Get the number of test examples seen so far. |
double[] |
getOutNum()
|
void |
init()
Get ready to process - init all the bean members. |
void |
process()
Performs the main, synchronous, standard processing function performed by this bean. |
void |
reset()
Reset the naive bayes bean. |
java.util.Vector |
setAllTable()
Constructs the vector containing all the possible attribute-value-class combinations, not just those found in the training data set (some of them may be found in the test data set and need to be initialized to 0). |
protected void |
setDefaults()
Set up the event queue behavior. |
void |
setDiscretization(int newDiscr)
Set discretization parameter. |
void |
setM(int newM)
Set m parameter - weight given to prior. |
void |
setNaiveBayesMode(int mode)
Set the operating mode of the naive bayes bean. |
void |
setNaiveBayesParameters(int newAttr,
int newCl,
long newRec)
Set the number records, number attributes and number classes for naive bayes bean. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final java.lang.String defaultName
public static final int PropertyMId
public static final java.lang.String PropertyM
public static final int PropertyDiscrId
public static final java.lang.String PropertyDiscr
public double[] inNum
public double[] outNum
public static final int TRAIN
public static final int TEST
public static final int RUN
public static final java.lang.String[] MODE_NAMES
| Constructor Detail |
public AbleNaiveBayes()
throws AbleException
public AbleNaiveBayes(java.lang.String aName)
throws AbleException
aName - The object name
public AbleNaiveBayes(java.lang.String aName,
int args)
throws AbleException
| Method Detail |
public double[] getInNum()
public double[] getOutNum()
protected void setDefaults()
throws AbleException
AbleExceptionpublic int getNaiveBayesMode()
public void setNaiveBayesMode(int mode)
mode - The current operating mode, train/test/run
public void setNaiveBayesParameters(int newAttr,
int newCl,
long newRec)
newAttr - that defines the number of attributesnewCl - that defines the number of classesnewRec - that defines the number of records
public void setM(int newM)
throws AbleException
newM -
AbleExceptionpublic int getM()
public void setDiscretization(int newDiscr)
throws AbleException
AbleExceptionpublic int getDiscretization()
public long getNumRecords()
public int getNumAttributes()
public int getNumClasses()
public long getNumTestExamples()
public long getNumCorrectTestExamples()
public double getAccuracy()
public double getError()
public double[] getCurrentTrainExample()
public double[] getCurrentTestExample()
public double getCurrentLearnedClass()
public double getCurrentActualClass()
public void init()
throws AbleException
init in interface AbleBeaninit in class AbleObjectAbleException - If an error occurs.AbleObject.startEnabledEventProcessing()
public void reset()
throws AbleException
reset in interface AbleBeanreset in class AbleObjectAbleException - If an error occurs.AbleBean.reset()public int getMaxProbIndex(double[] prob)
public AttributeValueClass getElement(java.util.Vector v,
int attr,
int val,
int cl)
public double getClass(double[] x)
throws AbleException
AbleException
public double[] calcPriorClassProb()
throws AbleException
AbleException
public java.util.Vector setAllTable()
throws AbleException
AbleException
public void calcPriorProb()
throws AbleException
AbleExceptionpublic int getNumInstances(int clasS)
public void calcPosteriorProb()
throws AbleException
AbleException
public void process()
throws AbleException
AbleObjectThis base method implementation provides tracing only.
process in interface AbleBeanprocess in class AbleObjectAbleExceptionAbleObject.inputBuffer,
AbleObject.outputBuffer,
AbleBean.process()
public void generateTranslateTemplates(AbleFilter inFilt,
AbleFilter outFilt,
java.util.Vector fields)
throws AbleException
generateTranslateTemplates in interface AbleTranslateTemplateProviderinFilt - The AbleFilter used to convert incoming data.outFilt - The AbleFilter used to convert outgoing data.fields - A vector of AbleFields from which to derive the translation template.
AbleException
|
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 | |||||||||||