org.apache.mahout.classifier.naivebayes
Class NaiveBayesModel

java.lang.Object
  extended by org.apache.mahout.classifier.naivebayes.NaiveBayesModel

public class NaiveBayesModel
extends Object

NaiveBayesModel holds the weight Matrix, the feature and label sums and the weight normalizer vectors.


Constructor Summary
NaiveBayesModel(Matrix weightMatrix, Vector weightsPerFeature, Vector weightsPerLabel, Vector thetaNormalizer, float alphaI)
           
 
Method Summary
 float alphaI()
           
 Vector createScoringVector()
           
 double featureWeight(int feature)
           
 double labelWeight(int label)
           
static NaiveBayesModel materialize(org.apache.hadoop.fs.Path output, org.apache.hadoop.conf.Configuration conf)
           
 double numFeatures()
           
 int numLabels()
           
 void serialize(org.apache.hadoop.fs.Path output, org.apache.hadoop.conf.Configuration conf)
           
 double totalWeightSum()
           
 void validate()
           
 double weight(int label, int feature)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

NaiveBayesModel

public NaiveBayesModel(Matrix weightMatrix,
                       Vector weightsPerFeature,
                       Vector weightsPerLabel,
                       Vector thetaNormalizer,
                       float alphaI)
Method Detail

labelWeight

public double labelWeight(int label)

featureWeight

public double featureWeight(int feature)

weight

public double weight(int label,
                     int feature)

alphaI

public float alphaI()

numFeatures

public double numFeatures()

totalWeightSum

public double totalWeightSum()

numLabels

public int numLabels()

createScoringVector

public Vector createScoringVector()

materialize

public static NaiveBayesModel materialize(org.apache.hadoop.fs.Path output,
                                          org.apache.hadoop.conf.Configuration conf)
                                   throws IOException
Throws:
IOException

serialize

public void serialize(org.apache.hadoop.fs.Path output,
                      org.apache.hadoop.conf.Configuration conf)
               throws IOException
Throws:
IOException

validate

public void validate()


Copyright © 2008–2014 The Apache Software Foundation. All rights reserved.