|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.classifiers.Classifier | +--weka.classifiers.MultiScheme
Class for selecting a classifier from among several using cross validation on the training data.
Valid options from the command line are:
-D
Turn on debugging output.
-S seed
Random number seed (default 1).
-B classifierstring
Classifierstring should contain the full class name of a scheme
included for selection followed by options to the classifier
(required, option should be used once for each classifier).
-X num_folds
Use cross validation error as the basis for classifier selection.
(default 0, is to use error on the training data instead)
Field Summary | |
protected Classifier |
m_Classifier
The classifier that had the best performance on training data. |
protected int |
m_ClassifierIndex
The index into the vector for the selected scheme |
protected Classifier[] |
m_Classifiers
The list of classifiers |
protected boolean |
m_Debug
Debugging mode, gives extra output if true |
protected int |
m_NumXValFolds
Number of folds to use for cross validation (0 means use training error for selection) |
protected int |
m_Seed
Random number seed |
Constructor Summary | |
MultiScheme()
|
Method Summary | |
void |
buildClassifier(Instances data)
Buildclassifier selects a classifier from the set of classifiers by minimising error on the training data. |
double |
classifyInstance(Instance instance)
Classifies a given instance using the selected classifier. |
Classifier |
getClassifier(int index)
Gets a single classifier from the set of available classifiers. |
Classifier[] |
getClassifiers()
Gets the list of possible classifers to choose from. |
protected java.lang.String |
getClassifierSpec(int index)
Gets the classifier specification string, which contains the class name of the classifier and any options to the classifier |
boolean |
getDebug()
Get whether debugging is turned on |
int |
getNumFolds()
Gets the number of folds for cross-validation. |
java.lang.String[] |
getOptions()
Gets the current settings of the Classifier. |
int |
getSeed()
Gets the random number seed. |
java.util.Enumeration |
listOptions()
Returns an enumeration describing the available options |
static void |
main(java.lang.String[] argv)
Main method for testing this class. |
void |
setClassifiers(Classifier[] classifiers)
Sets the list of possible classifers to choose from. |
void |
setDebug(boolean debug)
Set debugging mode |
void |
setNumFolds(int numFolds)
Sets the number of folds for cross-validation. |
void |
setOptions(java.lang.String[] options)
Parses a given list of options. |
void |
setSeed(int seed)
Sets the seed for random number generation. |
java.lang.String |
toString()
Output a representation of this classifier |
Methods inherited from class weka.classifiers.Classifier |
forName, makeCopies |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected Classifier m_Classifier
protected Classifier[] m_Classifiers
protected int m_ClassifierIndex
protected int m_NumXValFolds
protected boolean m_Debug
protected int m_Seed
Constructor Detail |
public MultiScheme()
Method Detail |
public java.util.Enumeration listOptions()
listOptions
in interface OptionHandler
public void setOptions(java.lang.String[] options) throws java.lang.Exception
-D
Turn on debugging output.
-S seed
Random number seed (default 1).
-B classifierstring
Classifierstring should contain the full class name of a scheme
included for selection followed by options to the classifier
(required, option should be used once for each classifier).
-X num_folds
Use cross validation error as the basis for classifier selection.
(default 0, is to use error on the training data instead)
setOptions
in interface OptionHandler
options
- the list of options as an array of stringsjava.lang.Exception
- if an option is not supportedpublic java.lang.String[] getOptions()
getOptions
in interface OptionHandler
public void setClassifiers(Classifier[] classifiers)
classifiers
- an array of classifiers with all options set.public Classifier[] getClassifiers()
public Classifier getClassifier(int index)
index
- the index of the classifier wantedprotected java.lang.String getClassifierSpec(int index)
index
- the index of the classifier string to retrieve, starting from
0.public void setSeed(int seed)
seed
- the random number seedpublic int getSeed()
public int getNumFolds()
public void setNumFolds(int numFolds)
numFolds
- the number of folds for cross-validationpublic void setDebug(boolean debug)
debug
- true if debug output should be printedpublic boolean getDebug()
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in class Classifier
data
- the training data to be used for generating the
boosted classifier.java.lang.Exception
- if the classifier could not be built successfullypublic double classifyInstance(Instance instance) throws java.lang.Exception
classifyInstance
in class Classifier
instance
- the instance to be classifiedjava.lang.Exception
- if instance could not be classified
successfullypublic java.lang.String toString()
toString
in class java.lang.Object
public static void main(java.lang.String[] argv)
argv
- should contain the following arguments:
-t training file [-T test file] [-c class index]
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |