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

Class weka.classifiers.MultiScheme

java.lang.Object
    |
    +----weka.classifiers.Classifier
            |
            +----weka.classifiers.MultiScheme

public class MultiScheme
extends Classifier
implements OptionHandler
Class for selecting a classifier from among several using cross validation on the training data.

Valid options from the command line are:

-D
Turn on debugging output.

-S seed
Random number seed (default 1).

-B classifierstring
Classifierstring should contain the full class name of a scheme included for selection followed by options to the classifier (required, option should be used once for each classifier).

-X num_folds
Use cross validation error as the basis for classifier selection. (default 0, is to use error on the training data instead)

Version:
$Revision: 1.9 $
Author:
Len Trigg (trigg@cs.waikato.ac.nz)

Constructor Index

 o MultiScheme()
 

Method Index

 o buildClassifier(Instances)
Buildclassifier selects a classifier from the set of classifiers by minimising error on the training data.
 o classifyInstance(Instance)
Classifies a given instance using the selected classifier.
 o getClassifier(int)
Gets a single classifier from the set of available classifiers.
 o getClassifiers()
Gets the list of possible classifers to choose from.
 o getDebug()
Get whether debugging is turned on
 o getNumFolds()
Gets the number of folds for cross-validation.
 o getOptions()
Gets the current settings of the Classifier.
 o getSeed()
Gets the random number seed.
 o listOptions()
Returns an enumeration describing the available options
 o main(String[])
Main method for testing this class.
 o setClassifiers(Classifier[])
Sets the list of possible classifers to choose from.
 o setDebug(boolean)
Set debugging mode
 o setNumFolds(int)
Sets the number of folds for cross-validation.
 o setOptions(String[])
Parses a given list of options.
 o setSeed(int)
Sets the seed for random number generation.
 o toString()
Output a representation of this classifier

Constructor Detail

 o MultiScheme
public MultiScheme()

Method Detail

 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:

-D
Turn on debugging output.

-S seed
Random number seed (default 1).

-B classifierstring
Classifierstring should contain the full class name of a scheme included for selection followed by options to the classifier (required, option should be used once for each classifier).

-X num_folds
Use cross validation error as the basis for classifier selection. (default 0, is to use error on the training data instead)

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 setClassifiers
public void setClassifiers(Classifier classifiers[])
          Sets the list of possible classifers to choose from.
Parameters:
classifiers - an array of classifiers with all options set.
 o getClassifiers
public Classifier[] getClassifiers()
          Gets the list of possible classifers to choose from.
Returns:
the array of Classifiers
 o getClassifier
public Classifier getClassifier(int index)
          Gets a single classifier from the set of available classifiers.
Parameters:
index - the index of the classifier wanted
Returns:
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 getNumFolds
public int getNumFolds()
          Gets the number of folds for cross-validation. A number less than 2 specifies using training error rather than cross-validation.
Returns:
the number of folds for cross-validation
 o setNumFolds
public void setNumFolds(int numFolds)
          Sets the number of folds for cross-validation. A number less than 2 specifies using training error rather than cross-validation.
Parameters:
numFolds - the number of folds for cross-validation
 o setDebug
public void setDebug(boolean debug)
          Set debugging mode
Parameters:
debug - true if debug output should be printed
 o getDebug
public boolean getDebug()
          Get whether debugging is turned on
Returns:
true if debugging output is on
 o buildClassifier
public void buildClassifier(Instances data) throws java.lang.Exception
          Buildclassifier selects a classifier from the set of classifiers by minimising error on the training data.
Parameters:
data - the training data to be used for generating the boosted classifier.
Throws:
java.lang.Exception - if the classifier could not be built successfully
Overrides:
buildClassifier in class Classifier
 o classifyInstance
public double classifyInstance(Instance instance) throws java.lang.Exception
          Classifies a given instance using the selected classifier.
Parameters:
instance - the instance to be classified
Throws:
java.lang.Exception - if instance could not be classified successfully
Overrides:
classifyInstance in class Classifier
 o toString
public java.lang.String toString()
          Output a representation of this classifier
Overrides:
toString in class java.lang.Object
 o main
public static void main(java.lang.String argv[])
          Main method for testing this class.
Parameters:
argv - should contain the following arguments: -t training file [-T test file] [-c class index]

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