## org.apache.mahout.classifier.naivebayes.trainer
Class NaiveBayesTrainer

    java.lang.Object
      org.apache.mahout.classifier.naivebayes.trainer.NaiveBayesTrainer

    public final class NaiveBayesTrainer

extends java.lang.Object

This class trains a Naive Bayes Classifier (Parameters for both Naive Bayes and Complementary Naive Bayes)

Field Summary
`static java.lang.String` `ALPHA_I`
`static java.lang.String` `CLASS_VECTORS`
`static java.lang.String` `LABEL_MAP`
`static java.lang.String` `SUM_VECTORS`
`static java.lang.String` `THETA_SUM`

Constructor Summary
`NaiveBayesTrainer()`

Method Summary
`static org.apache.hadoop.fs.Path` `createLabelMapFile(java.util.List<java.lang.String> labels, org.apache.hadoop.conf.Configuration conf, org.apache.hadoop.fs.Path labelMapPathBase)` Write the list of labels into a map file
`static void` `trainNaiveBayes(org.apache.hadoop.fs.Path input, org.apache.hadoop.conf.Configuration conf, java.util.List<java.lang.String> inputLabels, org.apache.hadoop.fs.Path output, int numReducers, float alphaI, boolean trainComplementary)`

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### THETA_SUM

    public static final java.lang.String THETA_SUM

See Also:
  Constant Field Values

### SUM_VECTORS

    public static final java.lang.String SUM_VECTORS

See Also:
  Constant Field Values

### CLASS_VECTORS

    public static final java.lang.String CLASS_VECTORS

See Also:
  Constant Field Values

### LABEL_MAP

    public static final java.lang.String LABEL_MAP

See Also:
  Constant Field Values

### ALPHA_I

    public static final java.lang.String ALPHA_I

See Also:
  Constant Field Values

Constructor Detail

### NaiveBayesTrainer

    public NaiveBayesTrainer()

Method Detail

### trainNaiveBayes

    public static void trainNaiveBayes(org.apache.hadoop.fs.Path input,
                                       org.apache.hadoop.conf.Configuration conf,
                                       java.util.List<java.lang.String> inputLabels,
                                       org.apache.hadoop.fs.Path output,
                                       int numReducers,
                                       float alphaI,
                                       boolean trainComplementary)
                                throws java.io.IOException,
                                       java.lang.InterruptedException,
                                       java.lang.ClassNotFoundException

  Throws:
    `java.io.IOException`
    `java.lang.InterruptedException`
    `java.lang.ClassNotFoundException`

### createLabelMapFile

    public static org.apache.hadoop.fs.Path createLabelMapFile(java.util.List<java.lang.String> labels,
                                                               org.apache.hadoop.conf.Configuration conf,
                                                               org.apache.hadoop.fs.Path labelMapPathBase)
                                                        throws java.io.IOException

  Write the list of labels into a map file

  Parameters:
    `wordCountPath` -
    `dictionaryPathBase` -
  Throws:
    `java.io.IOException`

Copyright © 2008-2010 The Apache Software Foundation. All Rights Reserved.