Class NaiveBayes
java.lang.Object
Classifier
NaiveBayes
public class NaiveBayes
- extends Classifier
The NaiveBayes class implements the naive Bayes classification algorithm
(i.e. computes posterior probabilities by assuming that attribute values are
conditionally independent given the class value)
- Author:
- jmac
Method Summary |
java.util.Hashtable<java.lang.String,java.lang.Double> |
computeClassProbabilities(Instance instance)
|
java.lang.String |
decide(Instance instance)
|
void |
learn(InstanceSet trainingSet)
Learn a classifier from the given training set |
void |
print()
print out a legible form of the classifier |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
NaiveBayes
public NaiveBayes(AttributeSet attributeSet)
- Parameters:
attributeSet
- the attribute set to be used for this machine learning problem
learn
public void learn(InstanceSet trainingSet)
- Description copied from class:
Classifier
- Learn a classifier from the given training set
- Specified by:
learn
in class Classifier
- Parameters:
trainingSet
- the training set from which to learn the classifier
decide
public java.lang.String decide(Instance instance)
- Specified by:
decide
in class Classifier
- Parameters:
instance
- the instance whose class is to be decided
- Returns:
- the class value of the instance
computeClassProbabilities
public java.util.Hashtable<java.lang.String,java.lang.Double> computeClassProbabilities(Instance instance)
- Specified by:
computeClassProbabilities
in class Classifier
- Parameters:
instance
- the instance whose class probabilities are to be computed
- Returns:
- a table mapping class values to their probabilities
print
public void print()
- Description copied from class:
Classifier
- print out a legible form of the classifier
- Specified by:
print
in class Classifier