weka.classifiers
Class DistributionClassifier

java.lang.Object
  extended by weka.classifiers.Classifier
      extended by weka.classifiers.DistributionClassifier
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable
Direct Known Subclasses:
FilteredClassifier, NaiveBayesSimple

public abstract class DistributionClassifier
extends Classifier

Abstract classification model that produces (for each test instance) an estimate of the membership in each class (ie. a probability distribution).

Version:
$Revision: 1.1 $
Author:
Eibe Frank ([email protected]), Len Trigg ([email protected])
See Also:
Serialized Form

Constructor Summary
DistributionClassifier()
           
 
Method Summary
 double classifyInstance(Instance instance)
          Classifies the given test instance.
abstract  double[] distributionForInstance(Instance instance)
          Predicts the class memberships for a given instance.
 
Methods inherited from class weka.classifiers.Classifier
buildClassifier, forName, makeCopies
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

DistributionClassifier

public DistributionClassifier()
Method Detail

distributionForInstance

public abstract double[] distributionForInstance(Instance instance)
                                          throws java.lang.Exception
Predicts the class memberships for a given instance. If an instance is unclassified, the returned array elements must be all zero. If the class is numeric, the array must consist of only one element, which contains the predicted value.

Parameters:
instance - the instance to be classified
Returns:
an array containing the estimated membership probabilities of the test instance in each class (this should sum to at most 1)
Throws:
java.lang.Exception - if distribution could not be computed successfully

classifyInstance

public double classifyInstance(Instance instance)
                        throws java.lang.Exception
Classifies the given test instance. The instance has to belong to a dataset when it's being classified.

Specified by:
classifyInstance in class Classifier
Parameters:
instance - the instance to be classified
Returns:
the predicted most likely class for the instance or Instance.missingValue() if no prediction is made
Throws:
java.lang.Exception - if an error occurred during the prediction