|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mahout.classifier.AbstractVectorClassifier
org.apache.mahout.classifier.naivebayes.AbstractNaiveBayesClassifier
public abstract class AbstractNaiveBayesClassifier
Class implementing the Naive Bayes Classifier Algorithm
Constructor Summary | |
---|---|
protected |
AbstractNaiveBayesClassifier(NaiveBayesModel model)
|
Method Summary | |
---|---|
Vector |
classify(Vector instance)
Classify a vector returning a vector of numCategories-1 scores. |
Vector |
classifyFull(Vector instance)
Returns n probabilities, one for each category. |
Vector |
classifyFull(Vector r,
Vector instance)
Returns n probabilities, one for each category into a pre-allocated vector. |
double |
classifyScalar(Vector instance)
Classifies a vector in the special case of a binary classifier where AbstractVectorClassifier.classify(Vector) would return a vector with only one element. |
protected NaiveBayesModel |
getModel()
|
protected abstract double |
getScoreForLabelFeature(int label,
int feature)
|
protected double |
getScoreForLabelInstance(int label,
Vector instance)
|
int |
numCategories()
Returns the number of categories for the target variable. |
Methods inherited from class org.apache.mahout.classifier.AbstractVectorClassifier |
---|
classify, classifyFull, classifyNoLink, classifyScalar, logLikelihood |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
protected AbstractNaiveBayesClassifier(NaiveBayesModel model)
Method Detail |
---|
protected NaiveBayesModel getModel()
protected abstract double getScoreForLabelFeature(int label, int feature)
protected double getScoreForLabelInstance(int label, Vector instance)
public int numCategories()
AbstractVectorClassifier
numCategories
in class AbstractVectorClassifier
public Vector classifyFull(Vector instance)
AbstractVectorClassifier
classifyFull
in class AbstractVectorClassifier
instance
- A vector of features to be classified.
AbstractVectorClassifier.classify(Vector)
,
AbstractVectorClassifier.classifyFull(Vector r, Vector instance)
public Vector classifyFull(Vector r, Vector instance)
AbstractVectorClassifier
classifyFull
in class AbstractVectorClassifier
r
- Where to put the results.instance
- A vector of features to be classified.
public double classifyScalar(Vector instance)
AbstractVectorClassifier
AbstractVectorClassifier.classify(Vector)
would return a vector with only one element. As such,
using this method can void the allocation of a vector.
classifyScalar
in class AbstractVectorClassifier
instance
- The feature vector to be classified.
AbstractVectorClassifier.classify(Vector)
public Vector classify(Vector instance)
AbstractVectorClassifier
classify
in class AbstractVectorClassifier
instance
- A feature vector to be classified.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |