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)

Constructor Index

 o CVParameterSelection()

Method Index

 o addCVParameter(String)
Adds a scheme parameter to the list of parameters to be set by cross-validation
 o buildClassifier(Instances)
Generates the classifier.
 o classifyInstance(Instance)
Predicts the class value for the given test instance.
 o getClassifier()
Get the classifier used as the classifier
 o getCVParameter(int)
Gets the scheme paramter with the given index.
 o getDebug()
Gets whether debugging is turned on
 o getNumFolds()
Get the number of folds used 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 setClassifier(Classifier)
Set the classifier for boosting.
 o setDebug(boolean)
Sets debugging mode
 o setNumFolds(int)
Set the number of folds used for cross-validation.
 o setOptions(String[])
Parses a given list of options.
 o setSeed(int)
Sets the seed for random number generation.
 o toString()
Returns description of the cross-validated classifier.
 o toSummaryString()

Constructors

 o CVParameterSelection
 public CVParameterSelection()

Methods

 o listOptions
 public Enumeration listOptions()
Returns an enumeration describing the available options

Returns:
an enumeration of all the available options
 o 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
 o getOptions
 public String[] getOptions()
Gets the current settings of the Classifier.

Returns:
an array of strings suitable for passing to setOptions
 o 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
 o 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
 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 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
 o getCVParameter
 public String getCVParameter(int index)
Gets the scheme paramter with the given index.

 o setDebug
 public void setDebug(boolean debug)
Sets debugging mode

Parameters:
debug - true if debug output should be printed
 o getDebug
 public boolean getDebug()
Gets whether debugging is turned on

Returns:
true if debugging output is on
 o getNumFolds
 public int getNumFolds()
Get the number of folds used for cross-validation.

Returns:
the number of folds used for cross-validation.
 o 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.
 o setClassifier
 public void setClassifier(Classifier newClassifier)
Set the classifier for boosting.

Parameters:
newClassifier - the Classifier to use.
 o getClassifier
 public Classifier getClassifier()
Get the classifier used as the classifier

Returns:
the classifier used as the classifier
 o 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
 o toSummaryString
 public String toSummaryString()
 o 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