Training and testing

Mallet implements a set of classifiers in the cc.mallet.classify package, including decision trees, Naive Bayes, AdaBoost, bagging, boosting, and many others. We'll start with a basic classifier, that is, a Naive Bayes classifier. A classifier is initialized by the ClassifierTrainer class, which returns a classifier when we invoke its train(Instances) method:

ClassifierTrainer classifierTrainer = new NaiveBayesTrainer(); 
Classifier classifier = classifierTrainer.train(instances); 

Now let's see how this classier works and evaluate its performance on a separate dataset.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.14.200