Package weka.classifiers.meta
Class MultiScheme
java.lang.Object
weka.classifiers.AbstractClassifier
weka.classifiers.MultipleClassifiersCombiner
weka.classifiers.RandomizableMultipleClassifiersCombiner
weka.classifiers.meta.MultiScheme
- All Implemented Interfaces:
Serializable,Cloneable,Classifier,BatchPredictor,CapabilitiesHandler,CapabilitiesIgnorer,CommandlineRunnable,OptionHandler,Randomizable,RevisionHandler
Class for selecting a classifier from among several using cross validation on the training data or the performance on the training data. Performance is measured based on percent correct (classification) or mean-squared error (regression).
Valid options are:
-X <number of folds> Use cross validation for model selection using the given number of folds. (default 0, is to use training error)
-S <num> Random number seed. (default 1)
-B <classifier specification> Full class name of classifier to include, followed by scheme options. May be specified multiple times. (default: "weka.classifiers.rules.ZeroR")
-D If set, classifier is run in debug mode and may output additional info to the console
- Version:
- $Revision: 10141 $
- Author:
- Len Trigg (trigg@cs.waikato.ac.nz)
- See Also:
-
Field Summary
Fields inherited from class weka.classifiers.AbstractClassifier
BATCH_SIZE_DEFAULT, NUM_DECIMAL_PLACES_DEFAULT -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidbuildClassifier(Instances data) Buildclassifier selects a classifier from the set of classifiers by minimising error on the training data.Returns the tip text for this propertyReturns the tip text for this propertydouble[]distributionForInstance(Instance instance) Returns class probabilities.intGet the index of the classifier that was determined as best during cross-validation.getClassifier(int index) Gets a single classifier from the set of available classifiers.Gets the list of possible classifers to choose from.booleangetDebug()Get whether debugging is turned onintGets the number of folds for cross-validation.String[]Gets the current settings of the Classifier.Returns the revision string.intgetSeed()Gets the random number seed.Returns a string describing classifierReturns an enumeration describing the available options.static voidMain method for testing this class.Returns the tip text for this propertyReturns the tip text for this propertyvoidsetClassifiers(Classifier[] classifiers) Sets the list of possible classifers to choose from.voidsetDebug(boolean debug) Set debugging modevoidsetNumFolds(int numFolds) Sets the number of folds for cross-validation.voidsetOptions(String[] options) Parses a given list of options.voidsetSeed(int seed) Sets the seed for random number generation.toString()Output a representation of this classifierMethods inherited from class weka.classifiers.MultipleClassifiersCombiner
getCapabilities, postExecution, preExecutionMethods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, classifyInstance, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setBatchSize, setDoNotCheckCapabilities, setNumDecimalPlaces
-
Constructor Details
-
MultiScheme
public MultiScheme()
-
-
Method Details
-
globalInfo
Returns a string describing classifier- Returns:
- a description suitable for displaying in the explorer/experimenter gui
-
listOptions
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classRandomizableMultipleClassifiersCombiner- Returns:
- an enumeration of all the available options.
-
setOptions
Parses a given list of options. Valid options are:-X <number of folds> Use cross validation for model selection using the given number of folds. (default 0, is to use training error)
-S <num> Random number seed. (default 1)
-B <classifier specification> Full class name of classifier to include, followed by scheme options. May be specified multiple times. (default: "weka.classifiers.rules.ZeroR")
-D If set, classifier is run in debug mode and may output additional info to the console
- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classRandomizableMultipleClassifiersCombiner- Parameters:
options- the list of options as an array of strings- Throws:
Exception- if an option is not supported
-
getOptions
Gets the current settings of the Classifier.- Specified by:
getOptionsin interfaceOptionHandler- Overrides:
getOptionsin classRandomizableMultipleClassifiersCombiner- Returns:
- an array of strings suitable for passing to setOptions
-
classifiersTipText
Returns the tip text for this property- Overrides:
classifiersTipTextin classMultipleClassifiersCombiner- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setClassifiers
Sets the list of possible classifers to choose from.- Overrides:
setClassifiersin classMultipleClassifiersCombiner- Parameters:
classifiers- an array of classifiers with all options set.
-
getClassifiers
Gets the list of possible classifers to choose from.- Overrides:
getClassifiersin classMultipleClassifiersCombiner- Returns:
- the array of Classifiers
-
getClassifier
Gets a single classifier from the set of available classifiers.- Overrides:
getClassifierin classMultipleClassifiersCombiner- Parameters:
index- the index of the classifier wanted- Returns:
- the Classifier
-
seedTipText
Returns the tip text for this property- Overrides:
seedTipTextin classRandomizableMultipleClassifiersCombiner- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setSeed
public void setSeed(int seed) Sets the seed for random number generation.- Specified by:
setSeedin interfaceRandomizable- Overrides:
setSeedin classRandomizableMultipleClassifiersCombiner- Parameters:
seed- the random number seed
-
getSeed
public int getSeed()Gets the random number seed.- Specified by:
getSeedin interfaceRandomizable- Overrides:
getSeedin classRandomizableMultipleClassifiersCombiner- Returns:
- the random number seed
-
numFoldsTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
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
-
debugTipText
Returns the tip text for this property- Overrides:
debugTipTextin classAbstractClassifier- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
setDebug
public void setDebug(boolean debug) Set debugging mode- Overrides:
setDebugin classAbstractClassifier- Parameters:
debug- true if debug output should be printed
-
getDebug
public boolean getDebug()Get whether debugging is turned on- Overrides:
getDebugin classAbstractClassifier- Returns:
- true if debugging output is on
-
getBestClassifierIndex
public int getBestClassifierIndex()Get the index of the classifier that was determined as best during cross-validation.- Returns:
- the index in the classifier array
-
buildClassifier
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:
Exception- if the classifier could not be built successfully
-
distributionForInstance
Returns class probabilities.- Specified by:
distributionForInstancein interfaceClassifier- Overrides:
distributionForInstancein classAbstractClassifier- Parameters:
instance- the instance to be classified- Returns:
- the distribution for the instance
- Throws:
Exception- if instance could not be classified successfully
-
toString
Output a representation of this classifier -
getRevision
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classAbstractClassifier- Returns:
- the revision
-
main
Main method for testing this class.- Parameters:
argv- should contain the following arguments: -t training file [-T test file] [-c class index]
-