relational.classifier
Class WeightedNaiveBayes
java.lang.Object
weka.classifiers.Classifier
weka.classifiers.bayes.NaiveBayesSimple
relational.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
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 |
WeightedNaiveBayes
public WeightedNaiveBayes()
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 classificationweightArray
- - 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 classifiedweightArray
- - weights of edges in the graphprobabilities
- - here the class probabilities will be stored
- Returns:
- - the estimated category
- Throws:
java.lang.Exception