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)
MultiScheme()
-
buildClassifier(Instances)
- Buildclassifier selects a classifier from the set of classifiers
by minimising error on the training data.
classifyInstance(Instance)
- Classifies a given instance using the selected classifier.
getClassifier(int)
- Gets a single classifier from the set of available classifiers.
getClassifiers()
- Gets the list of possible classifers to choose from.
getDebug()
- Get whether debugging is turned on
getNumFolds()
- Gets the number of folds for cross-validation.
getOptions()
- Gets the current settings of the Classifier.
getSeed()
- Gets the random number seed.
listOptions()
- Returns an enumeration describing the available options
main(String[])
- Main method for testing this class.
setClassifiers(Classifier[])
- Sets the list of possible classifers to choose from.
setDebug(boolean)
- Set debugging mode
setNumFolds(int)
- Sets the number of folds for cross-validation.
setOptions(String[])
- Parses a given list of options.
setSeed(int)
- Sets the seed for random number generation.
toString()
- Output a representation of this classifier
MultiScheme
public MultiScheme()
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:
-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
getOptions
public java.lang.String[] getOptions()
Gets the current settings of the Classifier.
- Returns:
- an array of strings suitable for passing to setOptions
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.
getClassifiers
public Classifier[] getClassifiers()
Gets the list of possible classifers to choose from.
- Returns:
- the array of Classifiers
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
setSeed
public void setSeed(int seed)
Sets the seed for random number generation.
- Parameters:
seed
- the random number seed
getSeed
public int getSeed()
Gets the random number seed.
- Returns:
- the random number seed
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
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
setDebug
public void setDebug(boolean debug)
Set debugging mode
- Parameters:
debug
- true if debug output should be printed
getDebug
public boolean getDebug()
Get whether debugging is turned on
- Returns:
- true if debugging output is on
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
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
toString
public java.lang.String toString()
Output a representation of this classifier
- Overrides:
- toString in class java.lang.Object
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