edu.stanford.nlp.classify
Class NaiveBayesClassifier<L,F>
java.lang.Object
edu.stanford.nlp.classify.NaiveBayesClassifier<L,F>
- All Implemented Interfaces:
- Classifier<L,F>, RVFClassifier<L,F>, Serializable
public class NaiveBayesClassifier<L,F>
- extends Object
- implements Classifier<L,F>, RVFClassifier<L,F>
- 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, Sarah Spikes (sdspikes@cs.stanford.edu) - Templatization. Not sure what the weights counter
is supposed to hold; given the weights function it seems to hold Pair, Object>
but this seems like a strange thing to expect to be passed in.
- See Also:
- Serialized Form
Constructor Summary |
NaiveBayesClassifier(Counter<Pair<Pair<L,F>,Number>> weights,
Counter<L> priors,
Set<L> labels)
|
NaiveBayesClassifier(Counter<Pair<Pair<L,F>,Number>> weights,
Counter<L> priors,
Set<L> labels,
Set<F> features,
boolean addZero)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NaiveBayesClassifier
public NaiveBayesClassifier(Counter<Pair<Pair<L,F>,Number>> weights,
Counter<L> priors,
Set<L> labels,
Set<F> features,
boolean addZero)
NaiveBayesClassifier
public NaiveBayesClassifier(Counter<Pair<Pair<L,F>,Number>> weights,
Counter<L> priors,
Set<L> labels)
labels
public Collection<L> labels()
- Specified by:
labels
in interface Classifier<L,F>
classOf
public L classOf(RVFDatum<L,F> example)
- Specified by:
classOf
in interface RVFClassifier<L,F>
scoresOf
public ClassicCounter<L> scoresOf(RVFDatum<L,F> example)
- Specified by:
scoresOf
in interface RVFClassifier<L,F>
classOf
public L classOf(Datum<L,F> example)
- Specified by:
classOf
in interface Classifier<L,F>
scoresOf
public ClassicCounter<L> scoresOf(Datum<L,F> example)
- Specified by:
scoresOf
in interface Classifier<L,F>
accuracy
public float accuracy(Iterator<RVFDatum<L,F>> exampleIterator)
print
public void print(PrintStream pw)
print
public void print()
Stanford NLP Group