All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.classifiers.meta.DistributionMetaClassifier

java.lang.Object
    |
    +----weka.classifiers.Classifier
            |
            +----weka.classifiers.DistributionClassifier
                    |
                    +----weka.classifiers.meta.DistributionMetaClassifier

public class DistributionMetaClassifier
extends DistributionClassifier
implements OptionHandler
Class for wrapping a Classifier to make it return a distribution. Simply outputs a probabiltry of 1 for the predicted class and 0 for the others.

Version:
$Revision: 1.8 $
Author:
Richard Kirkby (rkirkby@cs.waikato.ac.nz)

Constructor Index

 o DistributionMetaClassifier()
Default constructor.
 o DistributionMetaClassifier(Classifier)
Contructs a DistributionMetaClassifier wrapping a given Classifier.

Method Index

 o buildClassifier(Instances)
Builds a classifier for a set of instances.
 o distributionForInstance(Instance)
Returns the class probability distribution for an instance.
 o getClassifier()
Gets the classifier being wrapped.
 o getOptions()
Gets the current settings of the classifier.
 o listOptions()
Returns an enumeration describing the available options..
 o main(String[])
Main method for testing this class.
 o setClassifier(Classifier)
Sets the classifier to wrap.
 o setOptions(String[])
Parses a given list of options.
 o toString()
Returns a description of the classifier.

Constructor Detail

 o DistributionMetaClassifier
public DistributionMetaClassifier()
          Default constructor.
 o DistributionMetaClassifier
public DistributionMetaClassifier(Classifier toWrap)
          Contructs a DistributionMetaClassifier wrapping a given Classifier.
Parameters:
toWrap - the classifier to wrap around

Method Detail

 o buildClassifier
public void buildClassifier(Instances data) throws java.lang.Exception
          Builds a classifier for a set of instances.
Parameters:
instances - the instances to train the classifier with
Throws:
java.lang.Exception - if the classifier hasn't been set or something goes wrong
Overrides:
buildClassifier in class Classifier
 o distributionForInstance
public double[] distributionForInstance(Instance instance) throws java.lang.Exception
          Returns the class probability distribution for an instance. Will simply have a probability of 1 for the predicted class and 0 for the others.
Parameters:
instance - the instance to be classified
Returns:
the probability distribution
Overrides:
distributionForInstance in class DistributionClassifier
 o toString
public java.lang.String toString()
          Returns a description of the classifier.
Returns:
a string containing a description of the classifier
Overrides:
toString in class java.lang.Object
 o setClassifier
public void setClassifier(Classifier toWrap)
          Sets the classifier to wrap.
Parameters:
toWrap - the classifier
 o getClassifier
public Classifier getClassifier()
          Gets the classifier being wrapped.
Returns:
the classifier
 o listOptions
public java.util.Enumeration listOptions()
          Returns an enumeration describing the available options..
Returns:
an enumeration of all the available options.
 o setOptions
public void setOptions(java.lang.String options[]) throws java.lang.Exception
          Parses a given list of options. Valid options are:

-W classifier name
Classifier to wrap. (required)

Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported
 o getOptions
public java.lang.String[] getOptions()
          Gets the current settings of the classifier.
Returns:
an array of strings suitable for passing to setOptions()
 o main
public static void main(java.lang.String argv[])
          Main method for testing this class.
Parameters:
argv - the options

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home