mark.nlp.weka
Class NaiveBayes

java.lang.Object
  |
  +--weka.classifiers.Classifier
        |
        +--mark.nlp.weka.NaiveBayes
All Implemented Interfaces:
java.lang.Cloneable, java.io.Serializable, weka.core.WeightedInstancesHandler
Direct Known Subclasses:
NBBernoulli, NBMultinomial

public abstract class NaiveBayes
extends weka.classifiers.Classifier
implements weka.core.WeightedInstancesHandler

A base class for weka NaiveBayes classifiers.

See Also:
Serialized Form

Field Summary
protected  double[][] fConditionals
           
protected  int fNumAtts
           
protected  int fNumCats
           
protected  double[] fPriors
           
protected static boolean fSmooth
           
protected static boolean fUsePriors
           
 
Constructor Summary
NaiveBayes()
           
 
Method Summary
 void buildClassifier(weka.core.Instances instances)
           
 double classifyInstance(weka.core.Instance instance)
          Calculates the most likely class for the given test instance.
protected abstract  double filterAttributeVal(double attVal)
           
protected abstract  void finishConditionals()
           
protected abstract  void finishScores(double[] scores, weka.core.Instance instance)
           
 
Methods inherited from class weka.classifiers.Classifier
forName, makeCopies
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fSmooth

protected static final boolean fSmooth
See Also:
Constant Field Values

fUsePriors

protected static final boolean fUsePriors
See Also:
Constant Field Values

fConditionals

protected double[][] fConditionals

fPriors

protected double[] fPriors

fNumCats

protected int fNumCats

fNumAtts

protected int fNumAtts
Constructor Detail

NaiveBayes

public NaiveBayes()
Method Detail

filterAttributeVal

protected abstract double filterAttributeVal(double attVal)

finishConditionals

protected abstract void finishConditionals()

finishScores

protected abstract void finishScores(double[] scores,
                                     weka.core.Instance instance)
                              throws java.lang.Exception
java.lang.Exception

buildClassifier

public void buildClassifier(weka.core.Instances instances)
                     throws java.lang.Exception
Specified by:
buildClassifier in class weka.classifiers.Classifier
java.lang.Exception

classifyInstance

public double classifyInstance(weka.core.Instance instance)
                        throws java.lang.Exception
Calculates the most likely class for the given test instance.

Specified by:
classifyInstance in class weka.classifiers.Classifier
Parameters:
instance - the instance to be classified
Returns:
predicted predicted class.
Throws:
java.lang.Exception - if there is a problem generating the prediction