Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.classifiers.meta
Class MultiClassClassifier

    java.lang.Object
      weka.classifiers.Classifier
          weka.classifiers.SingleClassifierEnhancer
              weka.classifiers.RandomizableSingleClassifierEnhancer
                  weka.classifiers.meta.MultiClassClassifier

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, OptionHandler, Randomizable

    public class MultiClassClassifier

extends RandomizableSingleClassifierEnhancer
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).

-S seed
Random number seed (default 1).

Version:
  $Revision: 1.37.2.2 $
Author:
  Eibe Frank (eibe@cs.waikato.ac.nz), Len Trigg (len@reeltwo.com), Richard Kirkby (rkirkby@cs.waikato.ac.nz)
See Also:
  Serialized Form

Field Summary
`static int` | `METHOD_1_AGAINST_1`
`static int` | `METHOD_1_AGAINST_ALL` The error correction modes
`static int` | `METHOD_ERROR_EXHAUSTIVE`
`static int` | `METHOD_ERROR_RANDOM`
`static Tag[]` | `TAGS_METHOD`

Constructor Summary
`MultiClassClassifier()` Constructor.

Method Summary
`void` | `buildClassifier(Instances insts)` Builds the classifiers.
`double[]` | `distributionForInstance(Instance inst)` Returns the distribution for an instance.
`SelectedTag` | `getMethod()` Gets the method used.
`java.lang.String[]` | `getOptions()` Gets the current settings of the Classifier.
`double` | `getRandomWidthFactor()` Gets the multiplier when generating random codes.
`java.lang.String` | `globalInfo()`
`double[]` | `individualPredictions(Instance inst)` Returns the individual predictions of the base classifiers for an instance.
`java.util.Enumeration` | `listOptions()` Returns an enumeration describing the available options
`static void` | `main(java.lang.String[] argv)` Main method for testing this class.
`java.lang.String` | `methodTipText()`
`java.lang.String` | `randomWidthFactorTipText()`
`void` | `setMethod(SelectedTag newMethod)` Sets the method used.
`void` | `setOptions(java.lang.String[] options)` Parses a given list of options.
`void` | `setRandomWidthFactor(double newRandomWidthFactor)` Sets the multiplier when generating random codes.
`java.lang.String` | `toString()` Prints the classifiers.

Methods inherited from class weka.classifiers.RandomizableSingleClassifierEnhancer
`getSeed, seedTipText, setSeed`

Methods inherited from class weka.classifiers.SingleClassifierEnhancer
`classifierTipText, getClassifier, setClassifier`

Methods inherited from class weka.classifiers.Classifier
`classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Field Detail

### METHOD_1_AGAINST_ALL

    public static final int METHOD_1_AGAINST_ALL

  The error correction modes

  See Also:
    Constant Field Values

### METHOD_ERROR_RANDOM

    public static final int METHOD_ERROR_RANDOM

See Also:
  Constant Field Values

### METHOD_ERROR_EXHAUSTIVE

    public static final int METHOD_ERROR_EXHAUSTIVE

See Also:
  Constant Field Values

### METHOD_1_AGAINST_1

    public static final int METHOD_1_AGAINST_1

See Also:
  Constant Field Values

### TAGS_METHOD

    public static final Tag[] TAGS_METHOD

Constructor Detail

### MultiClassClassifier

    public MultiClassClassifier()

  Constructor.

Method Detail

### buildClassifier

    public void buildClassifier(Instances insts)
                         throws java.lang.Exception

  Builds the classifiers.

  Specified by:
    `buildClassifier` in class `Classifier`
  Parameters:
    `insts` - the training data.
  Throws:
    `java.lang.Exception` - if a classifier can't be built

### 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

### distributionForInstance

    public double[] distributionForInstance(Instance inst)
                                     throws java.lang.Exception

  Returns the distribution for an instance.

  Overrides:
    `distributionForInstance` in class `Classifier`
  Parameters:
    `inst` - the instance to be classified
  Returns:
    an array containing the estimated membership probabilities of the test instance in each class or the numeric prediction
  Throws:
    `java.lang.Exception` - if the distribution can't be computed successfully

### toString

    public java.lang.String toString()

  Prints the classifiers.

  Overrides:
    `toString` in class `java.lang.Object`

### listOptions

    public java.util.Enumeration listOptions()

  Returns an enumeration describing the available options

  Specified by:
    `listOptions` in interface `OptionHandler`
  Overrides:
    `listOptions` in class `RandomizableSingleClassifierEnhancer`
  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:

  -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).

  -S seed
  Random number seed (default 1).

  Specified by:
    `setOptions` in interface `OptionHandler`
  Overrides:
    `setOptions` in class `RandomizableSingleClassifierEnhancer`
  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.

  Specified by:
    `getOptions` in interface `OptionHandler`
  Overrides:
    `getOptions` in class `RandomizableSingleClassifierEnhancer`
  Returns:
    an array of strings suitable for passing to setOptions

### globalInfo

    public java.lang.String globalInfo()

  Returns:
    a description of the classifier suitable for displaying in the explorer/experimenter gui

### randomWidthFactorTipText

    public java.lang.String randomWidthFactorTipText()

  Returns:
    tip text for this property suitable for displaying in the explorer/experimenter gui

### getRandomWidthFactor

    public double getRandomWidthFactor()

  Gets the multiplier when generating random codes. Will generate numClasses * m_RandomWidthFactor codes.

  Returns:
    the width multiplier

### 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

### methodTipText

    public java.lang.String methodTipText()

  Returns:
    tip text for this property suitable for displaying in the explorer/experimenter gui

### 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.

### 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.

### main

    public static void main(java.lang.String[] argv)

  Main method for testing this class.

  Parameters:
    `argv` - the options

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD