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

Class weka.classifiers.meta.MultiClassClassifier

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

public class MultiClassClassifier
extends DistributionClassifier
implements OptionHandler
Class for handling multi-class datasets with 2-class distribution classifiers.

Valid options are:

-M num
Sets the method to use. Valid values are 0 (1-against-all), 1 (random codes), 2 (exhaustive code), and 3 (1-against-1). (default 0)

-R num
Sets the multiplier when using random codes. (default 2.0)

-W classname
Specify the full class name of a classifier as the basis for the multi-class classifier (required).

-Q seed
Random number seed (default 1).

Version:
$Revision: 1.30 $
Author:
Eibe Frank (eibe@cs.waikato.ac.nz)
Author:
Len Trigg (len@reeltwo.com)
Author:
Richard Kirkby (rkirkby@cs.waikato.ac.nz)

Variable Index

 o METHOD_1_AGAINST_1
 
 o METHOD_1_AGAINST_ALL
The error correction modes
 o METHOD_ERROR_EXHAUSTIVE
 
 o METHOD_ERROR_RANDOM
 
 o TAGS_METHOD
 

Constructor Index

 o MultiClassClassifier()
 

Method Index

 o buildClassifier(Instances)
Builds the classifiers.
 o distributionClassifierTipText()
 
 o distributionForInstance(Instance)
Returns the distribution for an instance.
 o getDistributionClassifier()
Get the classifier used as the classifier
 o getMethod()
Gets the method used.
 o getOptions()
Gets the current settings of the Classifier.
 o getRandomWidthFactor()
Gets the multiplier when generating random codes.
 o getSeed()
Gets the random number seed.
 o globalInfo()
 
 o individualPredictions(Instance)
Returns the individual predictions of the base classifiers for an instance.
 o listOptions()
Returns an enumeration describing the available options
 o main(String[])
Main method for testing this class.
 o methodTipText()
 
 o randomWidthFactorTipText()
 
 o setDistributionClassifier(DistributionClassifier)
Set the base classifier.
 o setMethod(SelectedTag)
Sets the method used.
 o setOptions(String[])
Parses a given list of options.
 o setRandomWidthFactor(double)
Sets the multiplier when generating random codes.
 o setSeed(int)
Sets the seed for random number generation.
 o toString()
Prints the classifiers.

Field Detail

 o METHOD_1_AGAINST_ALL
public static final int METHOD_1_AGAINST_ALL
          The error correction modes
 o METHOD_ERROR_RANDOM
public static final int METHOD_ERROR_RANDOM
 o METHOD_ERROR_EXHAUSTIVE
public static final int METHOD_ERROR_EXHAUSTIVE
 o METHOD_1_AGAINST_1
public static final int METHOD_1_AGAINST_1
 o TAGS_METHOD
public static final Tag[] TAGS_METHOD

Constructor Detail

 o MultiClassClassifier
public MultiClassClassifier()

Method Detail

 o buildClassifier
public void buildClassifier(Instances insts) throws java.lang.Exception
          Builds the classifiers.
Parameters:
insts - the training data.
Throws:
java.lang.Exception - if a classifier can't be built
Overrides:
buildClassifier in class Classifier
 o individualPredictions
public double[] individualPredictions(Instance inst) throws java.lang.Exception
          Returns the individual predictions of the base classifiers for an instance. Used by StackedMultiClassClassifier. Returns the probability for the second "class" predicted by each base classifier.
Throws:
java.lang.Exception - if the predictions can't be computed successfully
 o distributionForInstance
public double[] distributionForInstance(Instance inst) throws java.lang.Exception
          Returns the distribution for an instance.
Throws:
java.lang.Exception - if the distribution can't be computed successfully
Overrides:
distributionForInstance in class DistributionClassifier
 o toString
public java.lang.String toString()
          Prints the classifiers.
Overrides:
toString in class java.lang.Object
 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:

-M num
Sets the method to use. Valid values are 0 (1-against-all), 1 (random codes), 2 (exhaustive code), and 3 (1-against-1). (default 0)

-R num
Sets the multiplier when using random codes. (default 2.0)

-W classname
Specify the full class name of a learner as the basis for the multiclassclassifier (required).

-Q seed
Random number seed (default 1).

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 globalInfo
public java.lang.String globalInfo()
Returns:
a description of the classifier suitable for displaying in the explorer/experimenter gui
 o randomWidthFactorTipText
public java.lang.String randomWidthFactorTipText()
Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui
 o getRandomWidthFactor
public double getRandomWidthFactor()
          Gets the multiplier when generating random codes. Will generate numClasses * m_RandomWidthFactor codes.
Returns:
the width multiplier
 o setRandomWidthFactor
public void setRandomWidthFactor(double newRandomWidthFactor)
          Sets the multiplier when generating random codes. Will generate numClasses * m_RandomWidthFactor codes.
Parameters:
newRandomWidthFactor - the new width multiplier
 o methodTipText
public java.lang.String methodTipText()
Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui
 o getMethod
public SelectedTag getMethod()
          Gets the method used. Will be one of METHOD_1_AGAINST_ALL, METHOD_ERROR_RANDOM, METHOD_ERROR_EXHAUSTIVE, or METHOD_1_AGAINST_1.
Returns:
the current method.
 o setMethod
public void setMethod(SelectedTag newMethod)
          Sets the method used. Will be one of METHOD_1_AGAINST_ALL, METHOD_ERROR_RANDOM, METHOD_ERROR_EXHAUSTIVE, or METHOD_1_AGAINST_1.
Parameters:
newMethod - the new method.
 o distributionClassifierTipText
public java.lang.String distributionClassifierTipText()
Returns:
tip text for this property suitable for displaying in the explorer/experimenter gui
 o setDistributionClassifier
public void setDistributionClassifier(DistributionClassifier newClassifier)
          Set the base classifier.
Parameters:
newClassifier - the Classifier to use.
 o getDistributionClassifier
public DistributionClassifier getDistributionClassifier()
          Get the classifier used as the classifier
Returns:
the classifier used as the classifier
 o setSeed
public void setSeed(int seed)
          Sets the seed for random number generation.
Parameters:
seed - the random number seed
 o getSeed
public int getSeed()
          Gets the random number seed.
Returns:
the random number seed
 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