edu.stanford.nlp.classify
Class NaiveBayesClassifier

java.lang.Object
  extended by edu.stanford.nlp.classify.NaiveBayesClassifier
All Implemented Interfaces:
Classifier, RVFClassifier, Serializable

public class NaiveBayesClassifier
extends Object
implements Classifier, RVFClassifier

Author:
Kristina Toutanova (kristina@cs.stanford.edu) A Naive Bayes classifier with a fixed number of features. The features are assumed to have integer values even though RVFDatum will return doubles
See Also:
Serialized Form

Constructor Summary
NaiveBayesClassifier(Counter weights, Counter priors, Set labels)
           
NaiveBayesClassifier(Counter weights, Counter priors, Set labels, Set features, boolean addZero)
           
 
Method Summary
 float accuracy(Iterator exampleIterator)
           
 Object classOf(Datum example)
           
 Object classOf(RVFDatum example)
           
 Collection labels()
           
 void print()
           
 void print(PrintStream pw)
           
 Counter scoresOf(Datum example)
           
 Counter scoresOf(RVFDatum example)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NaiveBayesClassifier

public NaiveBayesClassifier(Counter weights,
                            Counter priors,
                            Set labels,
                            Set features,
                            boolean addZero)

NaiveBayesClassifier

public NaiveBayesClassifier(Counter weights,
                            Counter priors,
                            Set labels)
Method Detail

labels

public Collection labels()
Specified by:
labels in interface Classifier

classOf

public Object classOf(RVFDatum example)
Specified by:
classOf in interface RVFClassifier

scoresOf

public Counter scoresOf(RVFDatum example)
Specified by:
scoresOf in interface RVFClassifier

classOf

public Object classOf(Datum example)
Specified by:
classOf in interface Classifier

scoresOf

public Counter scoresOf(Datum example)
Specified by:
scoresOf in interface Classifier

accuracy

public float accuracy(Iterator exampleIterator)

print

public void print(PrintStream pw)

print

public void print()


Stanford NLP Group