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)
DistributionMetaClassifier()
- Default constructor.
DistributionMetaClassifier(Classifier)
- Contructs a DistributionMetaClassifier wrapping a given Classifier.
buildClassifier(Instances)
- Builds a classifier for a set of instances.
distributionForInstance(Instance)
- Returns the class probability distribution for an instance.
getClassifier()
- Gets the classifier being wrapped.
getOptions()
- Gets the current settings of the classifier.
listOptions()
- Returns an enumeration describing the available options..
main(String[])
- Main method for testing this class.
setClassifier(Classifier)
- Sets the classifier to wrap.
setOptions(String[])
- Parses a given list of options.
toString()
- Returns a description of the classifier.
DistributionMetaClassifier
public DistributionMetaClassifier()
Default constructor.
DistributionMetaClassifier
public DistributionMetaClassifier(Classifier toWrap)
Contructs a DistributionMetaClassifier wrapping a given Classifier.
- Parameters:
toWrap - the classifier to wrap around
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
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
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
setClassifier
public void setClassifier(Classifier toWrap)
Sets the classifier to wrap.
- Parameters:
toWrap - the classifier
getClassifier
public Classifier getClassifier()
Gets the classifier being wrapped.
- Returns:
- the classifier
listOptions
public java.util.Enumeration listOptions()
Returns an enumeration describing the available options..
- Returns:
- an enumeration of all the available options.
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
getOptions
public java.lang.String[] getOptions()
Gets the current settings of the classifier.
- Returns:
- an array of strings suitable for passing to setOptions()
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