relational.classifier
Class WeightedNaiveBayes

java.lang.Object
  extended byweka.classifiers.Classifier
      extended byweka.classifiers.bayes.NaiveBayesSimple
          extended byrelational.classifier.WeightedNaiveBayes
All Implemented Interfaces:
java.lang.Cloneable, weka.core.OptionHandler, java.io.Serializable

public class WeightedNaiveBayes
extends weka.classifiers.bayes.NaiveBayesSimple

Class contains Weighted Naive Bayes classifier

See Also:
Serialized Form

Constructor Summary
WeightedNaiveBayes()
           
 
Method Summary
 void buildClassifier(weka.core.Instances instances, java.lang.Object[] weights)
          Generates the classifier.
 int classifyInstance(weka.core.Instance instance, double[] weightArray, java.util.HashMap probabilities)
           
 double[] distributionForInstance(weka.core.Instance instance, double[] weightArray)
          Calculates the class probability distribution for an instance using Weighted Naive Bayes
 
Methods inherited from class weka.classifiers.bayes.NaiveBayesSimple
buildClassifier, distributionForInstance, globalInfo, main, toString
 
Methods inherited from class weka.classifiers.Classifier
classifyInstance, debugTipText, forName, getDebug, getOptions, listOptions, makeCopies, makeCopy, setDebug, setOptions
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

WeightedNaiveBayes

public WeightedNaiveBayes()
Method Detail

buildClassifier

public void buildClassifier(weka.core.Instances instances,
                            java.lang.Object[] weights)
                     throws java.lang.Exception
Generates the classifier.

Parameters:
instances - set of instances serving as training data
Throws:
java.lang.Exception - if the classifier has not been generated successfully

distributionForInstance

public double[] distributionForInstance(weka.core.Instance instance,
                                        double[] weightArray)
                                 throws java.lang.Exception
Calculates the class probability distribution for an instance using Weighted Naive Bayes

Parameters:
instance - - instance to be considered for classification
weightArray - - weights of the edges in the graph
Returns:
class probability distribution
Throws:
java.lang.Exception

classifyInstance

public int classifyInstance(weka.core.Instance instance,
                            double[] weightArray,
                            java.util.HashMap probabilities)
                     throws java.lang.Exception
Parameters:
instance - - data instance to be classified
weightArray - - weights of edges in the graph
probabilities - - here the class probabilities will be stored
Returns:
- the estimated category
Throws:
java.lang.Exception