Package weka.classifiers.meta
Class CVParameterSelection
java.lang.Object
weka.classifiers.AbstractClassifier
weka.classifiers.SingleClassifierEnhancer
weka.classifiers.RandomizableSingleClassifierEnhancer
weka.classifiers.meta.CVParameterSelection
- All Implemented Interfaces:
Serializable,Cloneable,Classifier,BatchPredictor,CapabilitiesHandler,CapabilitiesIgnorer,CommandlineRunnable,Drawable,OptionHandler,Randomizable,RevisionHandler,Summarizable,TechnicalInformationHandler
public class CVParameterSelection
extends RandomizableSingleClassifierEnhancer
implements Drawable, Summarizable, TechnicalInformationHandler
Class for performing parameter selection by cross-validation for any classifier.
For more information, see:
R. Kohavi (1995). Wrappers for Performance Enhancement and Oblivious Decision Graphs. Department of Computer Science, Stanford University. BibTeX:
For more information, see:
R. Kohavi (1995). Wrappers for Performance Enhancement and Oblivious Decision Graphs. Department of Computer Science, Stanford University. BibTeX:
@phdthesis{Kohavi1995,
address = {Department of Computer Science, Stanford University},
author = {R. Kohavi},
school = {Stanford University},
title = {Wrappers for Performance Enhancement and Oblivious Decision Graphs},
year = {1995}
}
Valid options are:
-X <number of folds> Number of folds used for cross validation (default 10).
-P <classifier parameter> Classifier parameter options. eg: "N 1 5 10" Sets an optimisation parameter for the classifier with name -N, with lower bound 1, upper bound 5, and 10 optimisation steps. The upper bound may be the character 'A' or 'I' to substitute the number of attributes or instances in the training data, respectively. This parameter may be supplied more than once to optimise over several classifier options simultaneously.
-S <num> Random number seed. (default 1)
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.rules.ZeroR)
Options specific to classifier weka.classifiers.rules.ZeroR:
-D If set, classifier is run in debug mode and may output additional info to the consoleOptions after -- are passed to the designated sub-classifier.
- Version:
- $Revision: 15520 $
- 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_DEFAULTFields inherited from interface weka.core.Drawable
BayesNet, Newick, NOT_DRAWABLE, TREE -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddCVParameter(String cvParam) Adds a scheme parameter to the list of parameters to be set by cross-validationvoidbuildClassifier(Instances instances) Generates the classifier.Returns the tip text for this propertydouble[]distributionForInstance(Instance instance) Predicts the class distribution for the given test instance.String[]Returns (a copy of) the best options found for the classifier.Returns default capabilities of the classifier.getCVParameter(int index) Gets the scheme paramter with the given index.Object[]Get method for CVParameters.intGets the number of folds for the cross-validation.String[]Gets the current settings of the Classifier.Returns the revision string.Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.Returns a string describing this classifiergraph()Returns graph describing the classifier (if possible).intReturns the type of graph this classifier represents.Returns an enumeration describing the available options.static voidMain method for testing this class.Returns the tip text for this propertyvoidsetCVParameters(Object[] params) Set method for CVParameters.voidsetNumFolds(int numFolds) Sets the number of folds for the cross-validation.voidsetOptions(String[] options) Parses a given list of options.toString()Returns description of the cross-validated classifier.A concise description of the model.Methods inherited from class weka.classifiers.RandomizableSingleClassifierEnhancer
getSeed, seedTipText, setSeedMethods inherited from class weka.classifiers.SingleClassifierEnhancer
classifierTipText, getClassifier, postExecution, preExecution, setClassifierMethods inherited from class weka.classifiers.AbstractClassifier
batchSizeTipText, classifyInstance, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces
-
Constructor Details
-
CVParameterSelection
public CVParameterSelection()
-
-
Method Details
-
globalInfo
Returns a string describing this classifier- Returns:
- a description of the classifier suitable for displaying in the explorer/experimenter gui
-
getTechnicalInformation
Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.- Specified by:
getTechnicalInformationin interfaceTechnicalInformationHandler- Returns:
- the technical information about this class
-
listOptions
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Overrides:
listOptionsin classRandomizableSingleClassifierEnhancer- Returns:
- an enumeration of all the available options.
-
setOptions
Parses a given list of options. Valid options are:-X <number of folds> Number of folds used for cross validation (default 10).
-P <classifier parameter> Classifier parameter options. eg: "N 1 5 10" Sets an optimisation parameter for the classifier with name -N, with lower bound 1, upper bound 5, and 10 optimisation steps. The upper bound may be the character 'A' or 'I' to substitute the number of attributes or instances in the training data, respectively. This parameter may be supplied more than once to optimise over several classifier options simultaneously.
-S <num> Random number seed. (default 1)
-D If set, classifier is run in debug mode and may output additional info to the console
-W Full name of base classifier. (default: weka.classifiers.rules.ZeroR)
Options specific to classifier weka.classifiers.rules.ZeroR:
-D If set, classifier is run in debug mode and may output additional info to the console
Options after -- are passed to the designated sub-classifier.- Specified by:
setOptionsin interfaceOptionHandler- Overrides:
setOptionsin classRandomizableSingleClassifierEnhancer- 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 classRandomizableSingleClassifierEnhancer- Returns:
- an array of strings suitable for passing to setOptions
-
getBestClassifierOptions
Returns (a copy of) the best options found for the classifier.- Returns:
- the best options
-
getCapabilities
Returns default capabilities of the classifier.- Specified by:
getCapabilitiesin interfaceCapabilitiesHandler- Specified by:
getCapabilitiesin interfaceClassifier- Overrides:
getCapabilitiesin classSingleClassifierEnhancer- Returns:
- the capabilities of this classifier
- See Also:
-
buildClassifier
Generates the classifier.- Specified by:
buildClassifierin interfaceClassifier- Parameters:
instances- set of instances serving as training data- Throws:
Exception- if the classifier has not been generated successfully
-
distributionForInstance
Predicts the class distribution for the given test instance.- Specified by:
distributionForInstancein interfaceClassifier- Overrides:
distributionForInstancein classAbstractClassifier- Parameters:
instance- the instance to be classified- Returns:
- the predicted class value
- Throws:
Exception- if an error occurred during the prediction
-
addCVParameter
Adds a scheme parameter to the list of parameters to be set by cross-validation- Parameters:
cvParam- the string representation of a scheme parameter. The format is:
param_char lower_bound upper_bound number_of_steps
eg to search a parameter -P from 1 to 10 by increments of 1:
P 1 10 11- Throws:
Exception- if the parameter specifier is of the wrong format
-
getCVParameter
Gets the scheme paramter with the given index.- Parameters:
index- the index for the parameter- Returns:
- the scheme parameter
-
CVParametersTipText
Returns the tip text for this property- Returns:
- tip text for this property suitable for displaying in the explorer/experimenter gui
-
getCVParameters
Get method for CVParameters.- Returns:
- the CVParameters
-
setCVParameters
Set method for CVParameters.- Parameters:
params- the CVParameters to use- Throws:
Exception- if the setting of the CVParameters fails
-
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 the cross-validation.- Returns:
- the number of folds for the cross-validation
-
setNumFolds
Sets the number of folds for the cross-validation.- Parameters:
numFolds- the number of folds for the cross-validation- Throws:
Exception- if parameter illegal
-
graphType
public int graphType()Returns the type of graph this classifier represents. -
graph
Returns graph describing the classifier (if possible). -
toString
Returns description of the cross-validated classifier. -
toSummaryString
A concise description of the model.- Specified by:
toSummaryStringin interfaceSummarizable- Returns:
- a concise description of the model
-
getRevision
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Overrides:
getRevisionin classAbstractClassifier- Returns:
- the revision
-
main
Main method for testing this class.- Parameters:
argv- the options
-