All Packages Class Hierarchy This Package Previous Next Index WEKA's home
Class weka.classifiers.CVParameterSelection
java.lang.Object
|
+----weka.classifiers.Classifier
|
+----weka.classifiers.CVParameterSelection
- public class CVParameterSelection
- extends Classifier
- implements OptionHandler, Summarizable
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. PhD
Thesis. Department of Computer Science, Stanford University.
Valid options are:
-D
Turn on debugging output.
-W classname
Specify the full class name of classifier to perform cross-validation
selection on.
-X num
Number of folds used for cross validation (default 10).
-S seed
Random number seed (default 1).
-P "N 1 5 10"
Sets an optimisation parameter for the classifier with name -N,
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.
Options after -- are passed to the designated sub-classifier.
- Version:
- $Revision: 1.10 $
- Author:
- Len Trigg (trigg@cs.waikato.ac.nz)
-
CVParameterSelection()
-
-
addCVParameter(String)
- Adds a scheme parameter to the list of parameters to be set
by cross-validation
-
buildClassifier(Instances)
- Generates the classifier.
-
classifyInstance(Instance)
- Predicts the class value for the given test instance.
-
getClassifier()
- Get the classifier used as the classifier
-
getCVParameter(int)
- Gets the scheme paramter with the given index.
-
getDebug()
- Gets whether debugging is turned on
-
getNumFolds()
- Get the number of folds used 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.
-
setClassifier(Classifier)
- Set the classifier for boosting.
-
setDebug(boolean)
- Sets debugging mode
-
setNumFolds(int)
- Set the number of folds used for cross-validation.
-
setOptions(String[])
- Parses a given list of options.
-
setSeed(int)
- Sets the seed for random number generation.
-
toString()
- Returns description of the cross-validated classifier.
-
toSummaryString()
-
CVParameterSelection
public CVParameterSelection()
listOptions
public Enumeration listOptions()
- Returns an enumeration describing the available options
- Returns:
- an enumeration of all the available options
setOptions
public void setOptions(String options[]) throws Exception
- Parses a given list of options. Valid options are:
-D
Turn on debugging output.
-W classname
Specify the full class name of classifier to perform cross-validation
selection on.
-X num
Number of folds used for cross validation (default 10).
-S seed
Random number seed (default 1).
-P "N 1 5 10"
Sets an optimisation parameter for the classifier with name -N,
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.
Options after -- are passed to the designated sub-classifier.
- Parameters:
- options - the list of options as an array of strings
- Throws: Exception
- if an option is not supported
getOptions
public String[] getOptions()
- Gets the current settings of the Classifier.
- Returns:
- an array of strings suitable for passing to setOptions
buildClassifier
public void buildClassifier(Instances instances) throws Exception
- Generates the classifier.
- Parameters:
- instances - set of instances serving as training data
- Throws: Exception
- if the classifier has not been generated successfully
- Overrides:
- buildClassifier in class Classifier
classifyInstance
public double classifyInstance(Instance instance) throws Exception
- Predicts the class value for the given test instance.
- Parameters:
- instance - the instance to be classified
- Returns:
- the predicted class value
- Throws: Exception
- if an error occurred during the prediction
- Overrides:
- classifyInstance in class 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
addCVParameter
public void addCVParameter(String cvParam) throws Exception
- 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 increment
eg to search a parameter -P from 1 to 10 by increments of 2:
P 1 10 2
- Throws: Exception
- if the parameter specifier is of the wrong format
getCVParameter
public String getCVParameter(int index)
- Gets the scheme paramter with the given index.
setDebug
public void setDebug(boolean debug)
- Sets debugging mode
- Parameters:
- debug - true if debug output should be printed
getDebug
public boolean getDebug()
- Gets whether debugging is turned on
- Returns:
- true if debugging output is on
getNumFolds
public int getNumFolds()
- Get the number of folds used for cross-validation.
- Returns:
- the number of folds used for cross-validation.
setNumFolds
public void setNumFolds(int newNumFolds)
- Set the number of folds used for cross-validation.
- Parameters:
- newNumFolds - the number of folds used for cross-validation.
setClassifier
public void setClassifier(Classifier newClassifier)
- Set the classifier for boosting.
- Parameters:
- newClassifier - the Classifier to use.
getClassifier
public Classifier getClassifier()
- Get the classifier used as the classifier
- Returns:
- the classifier used as the classifier
toString
public String toString()
- Returns description of the cross-validated classifier.
- Returns:
- description of the cross-validated classifier as a string
- Overrides:
- toString in class Object
toSummaryString
public String toSummaryString()
main
public static void main(String argv[])
- Main method for testing this class.
- Parameters:
- argv - the options
All Packages Class Hierarchy This Package Previous Next Index WEKA's home