|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.Classifier
weka.classifiers.SingleClassifierEnhancer
weka.classifiers.RandomizableSingleClassifierEnhancer
weka.classifiers.meta.CVParameterSelection
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.
Nested Class Summary | |
protected class |
CVParameterSelection.CVParameter
|
Field Summary | |
protected java.lang.String[] |
m_BestClassifierOptions
The set of all classifier options as determined by cross-validation |
protected double |
m_BestPerformance
The cross-validated performance of the best options |
protected java.lang.String[] |
m_ClassifierOptions
The base classifier options (not including those being set by cross-validation) |
protected FastVector |
m_CVParams
The set of parameters to cross-validate over |
protected java.lang.String[] |
m_InitOptions
The set of all options at initialization time. |
protected int |
m_NumAttributes
The number of attributes in the data |
protected int |
m_NumFolds
The number of folds used in cross-validation |
protected int |
m_TrainFoldSize
The number of instances in a training fold |
Fields inherited from class weka.classifiers.RandomizableSingleClassifierEnhancer |
m_Seed |
Fields inherited from class weka.classifiers.SingleClassifierEnhancer |
m_Classifier |
Fields inherited from class weka.classifiers.Classifier |
m_Debug |
Fields inherited from interface weka.core.Drawable |
BayesNet, NOT_DRAWABLE, TREE |
Constructor Summary | |
CVParameterSelection()
|
Method Summary | |
void |
addCVParameter(java.lang.String cvParam)
Adds a scheme parameter to the list of parameters to be set by cross-validation |
void |
buildClassifier(Instances instances)
Generates the classifier. |
protected java.lang.String[] |
createOptions()
Create the options array to pass to the classifier. |
java.lang.String |
CVParametersTipText()
Returns the tip text for this property |
double[] |
distributionForInstance(Instance instance)
Predicts the class distribution for the given test instance. |
protected void |
findParamsByCrossValidation(int depth,
Instances trainData,
java.util.Random random)
Finds the best parameter combination. |
java.lang.String |
getCVParameter(int index)
Gets the scheme paramter with the given index. |
java.lang.Object[] |
getCVParameters()
Get method for CVParameters. |
int |
getNumFolds()
Gets the number of folds for the cross-validation. |
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier. |
java.lang.String |
globalInfo()
Returns a string describing this classifier |
java.lang.String |
graph()
Returns graph describing the classifier (if possible). |
int |
graphType()
Returns the type of graph this classifier represents. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options. |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
java.lang.String |
numFoldsTipText()
Returns the tip text for this property |
void |
setCVParameters(java.lang.Object[] params)
Set method for CVParameters. |
void |
setNumFolds(int numFolds)
Sets the number of folds for the cross-validation. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
java.lang.String |
toString()
Returns description of the cross-validated classifier. |
java.lang.String |
toSummaryString()
Returns a string that summarizes the object. |
Methods inherited from class weka.classifiers.RandomizableSingleClassifierEnhancer |
getSeed, seedTipText, setSeed |
Methods inherited from class weka.classifiers.SingleClassifierEnhancer |
classifierTipText, defaultClassifierString, getClassifier, getClassifierSpec, setClassifier |
Methods inherited from class weka.classifiers.Classifier |
classifyInstance, debugTipText, forName, getDebug, makeCopies, setDebug |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected java.lang.String[] m_ClassifierOptions
protected java.lang.String[] m_BestClassifierOptions
protected java.lang.String[] m_InitOptions
protected double m_BestPerformance
protected FastVector m_CVParams
protected int m_NumAttributes
protected int m_TrainFoldSize
protected int m_NumFolds
Constructor Detail |
public CVParameterSelection()
Method Detail |
protected java.lang.String[] createOptions()
protected void findParamsByCrossValidation(int depth, Instances trainData, java.util.Random random) throws java.lang.Exception
depth
- the index of the parameter to be optimised at this level
java.lang.Exception
- if an error occurspublic java.lang.String globalInfo()
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
listOptions
in class RandomizableSingleClassifierEnhancer
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-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.
setOptions
in interface OptionHandler
setOptions
in class RandomizableSingleClassifierEnhancer
options
- the list of options as an array of strings
java.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
getOptions
in class RandomizableSingleClassifierEnhancer
public void buildClassifier(Instances instances) throws java.lang.Exception
buildClassifier
in class Classifier
instances
- set of instances serving as training data
java.lang.Exception
- if the classifier has not been generated successfullypublic double[] distributionForInstance(Instance instance) throws java.lang.Exception
distributionForInstance
in class Classifier
instance
- the instance to be classified
java.lang.Exception
- if an error occurred during the predictionpublic void addCVParameter(java.lang.String cvParam) throws java.lang.Exception
cvParam
- the string representation of a scheme parameter. The
format is: java.lang.Exception
- if the parameter specifier is of the wrong formatpublic java.lang.String getCVParameter(int index)
public java.lang.String CVParametersTipText()
public java.lang.Object[] getCVParameters()
public void setCVParameters(java.lang.Object[] params) throws java.lang.Exception
java.lang.Exception
public java.lang.String numFoldsTipText()
public int getNumFolds()
public void setNumFolds(int numFolds) throws java.lang.Exception
numFolds
- the number of folds for the cross-validation
java.lang.Exception
- if parameter illegalpublic int graphType()
graphType
in interface Drawable
public java.lang.String graph() throws java.lang.Exception
graph
in interface Drawable
java.lang.Exception
- if the classifier cannot be graphedpublic java.lang.String toString()
public java.lang.String toSummaryString()
Summarizable
toSummaryString
in interface Summarizable
public static void main(java.lang.String[] argv)
argv
- the options
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |