|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.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, 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 Looks at the parent's data source to find the fields Can return null if the parent is null |
void |
calcPriorProb()
Calculate prior probability for all the elements of the attribute-value-class table (uniform distribution is assumed) |
static java.lang.String |
Copyright()
Determine the copyright of this class. |
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 No timer processing and no asynch event processing |
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
Name
- 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
public int getNaiveBayesMode()
public void setNaiveBayesMode(int mode)
Mode
- The current operating mode, train/test/run
public void setNaiveBayesParameters(int newAttr, int newCl, long newRec)
parameter
- newRec that defines the number of recordsparameter
- newAttr that defines the number of attributesparameter
- newCl that defines the number of classespublic void setM(int newM) throws AbleException
parameter
- mpublic int getM()
public void setDiscretization(int newDiscr) throws AbleException
public 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 class AbleObject
com.ibm.able.AbleObject
AbleException
- If an error occurs.AbleObject.startEnabledEventProcessing()
public void reset() throws AbleException
reset
in class AbleObject
com.ibm.able.AbleObject
AbleException
- 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
public double[] calcPriorClassProb() throws AbleException
public java.util.Vector setAllTable() throws AbleException
public void calcPriorProb() throws AbleException
public int getNumInstances(int clasS)
public void calcPosteriorProb() throws AbleException
public void process() throws AbleException
AbleObject
This base method implementation provides tracing only.
process
in class AbleObject
com.ibm.able.AbleObject
AbleObject.inputBuffer
,
AbleObject.outputBuffer
,
AbleBean.process()
public void generateTranslateTemplates(AbleFilter inFilt, AbleFilter outFilt, java.util.Vector fields) throws AbleException
generateTranslateTemplates
in interface AbleTranslateTemplateProvider
com.ibm.able.beans.filter.AbleTranslateTemplateProvider
inFilter
- The AbleFilter used to convert incoming data.outFilter
- The AbleFilter used to convert outgoing data.fields
- A vector of AbleFields from which to derive the translation template.public static java.lang.String Copyright()
|
ABLE 2.0.0 07/02/2003 10:25:01 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |