|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectedu.umass.cs.mallet.base.classify.ClassifierTrainer
edu.umass.cs.mallet.base.classify.IncrementalClassifierTrainer
edu.umass.cs.mallet.base.classify.NaiveBayesTrainer
Class used to generate a NaiveBayes classifier from a set of training data. In an Bayes classifier, the p(Classification|Data) = p(Data|Classification)p(Classification)/p(Data)
To compute the likelihood:
p(Data|Classification) = p(d1,d2,..dn | Classification)
Naive Bayes makes the assumption that all of the data are conditionally
independent given the Classification:
p(d1,d2,...dn | Classification) = p(d1|Classification)p(d2|Classification)..
As with other classifiers in Mallet, NaiveBayes is implemented as two classes: a trainer and a classifier. The NaiveBayesTrainer produces estimates of the various p(dn|Classifier) and contructs this class with those estimates.
A call to train() or incrementalTrain() produces a
NaiveBayes
classifier that can
can be used to classify instances. A call to incrementalTrain() does not throw
away the internal state of the trainer; subsequent calls to incrementalTrain()
train by extending the previous training set.
A NaiveBayesTrainer can be persisted using serialization.
NaiveBayes
,
Serialized FormConstructor Summary | |
NaiveBayesTrainer()
|
Method Summary | |
Multinomial.Estimator |
getFeatureMultinomialEstimator()
Get the MultinomialEstimator instance used to specify the type of estimator for features. |
Multinomial.Estimator |
getPriorMultinomialEstimator()
Get the MultinomialEstimator instance used to specify the type of estimator for priors. |
Classifier |
incrementalTrain(InstanceList trainingList,
InstanceList validationList,
InstanceList testSet,
ClassifierEvaluating evaluator,
Classifier initialClassifier)
Create a NaiveBayes classifier from a set of training data and the previous state of the trainer. |
void |
reset()
clears the internal state of the trainer. |
void |
setFeatureMultinomialEstimator(Multinomial.Estimator me)
Set the Multinomial Estimator used for features. |
void |
setPriorMultinomialEstimator(Multinomial.Estimator me)
Set the Multinomial Estimator used for priors. |
java.lang.String |
toString()
|
Classifier |
train(InstanceList trainingList,
InstanceList validationList,
InstanceList testSet,
ClassifierEvaluating evaluator,
Classifier initialClassifier)
Create a NaiveBayes classifier from a set of training data. |
Methods inherited from class edu.umass.cs.mallet.base.classify.IncrementalClassifierTrainer |
incrementalTrain, incrementalTrain, incrementalTrain, incrementalTrain |
Methods inherited from class edu.umass.cs.mallet.base.classify.ClassifierTrainer |
main, train, train, train, train |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public NaiveBayesTrainer()
Method Detail |
public Multinomial.Estimator getFeatureMultinomialEstimator()
public void setFeatureMultinomialEstimator(Multinomial.Estimator me)
me
- to be cloned on next call to train() or first call
to incrementalTrain()public Multinomial.Estimator getPriorMultinomialEstimator()
public void setPriorMultinomialEstimator(Multinomial.Estimator me)
me
- to be cloned on next call to train() or first call
to incrementalTrain()public void reset()
reset
in class IncrementalClassifierTrainer
public Classifier train(InstanceList trainingList, InstanceList validationList, InstanceList testSet, ClassifierEvaluating evaluator, Classifier initialClassifier)
train
in class ClassifierTrainer
trainingList
- The InstanceList to be used to train the classifier.
Within each instance the data slot is an instance of FeatureVector and the
target slot is an instance of LabelingvalidationList
- Currently unusedtestSet
- Currently unusedevaluator
- Currently unusedinitialClassifier
- Currently unused
public Classifier incrementalTrain(InstanceList trainingList, InstanceList validationList, InstanceList testSet, ClassifierEvaluating evaluator, Classifier initialClassifier)
incrementalTrain
in class IncrementalClassifierTrainer
trainingList
- The InstanceList to be used to train the classifier.
Within each instance the data slot is an instance of FeatureVector and the
target slot is an instance of LabelingvalidationList
- Currently unusedtestSet
- Currently unusedevaluator
- Currently unusedinitialClassifier
- Currently unused
public java.lang.String toString()
toString
in class ClassifierTrainer
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |