Package weka.classifiers
Class CheckSource
java.lang.Object
weka.classifiers.CheckSource
- All Implemented Interfaces:
OptionHandler,RevisionHandler
A simple class for checking the source generated from Classifiers
implementing the
weka.classifiers.Sourcable interface.
It takes a classifier, the classname of the generated source
and the dataset the source was generated with as parameters and tests
the output of the built classifier against the output of the generated
source. Use option '-h' to display all available commandline options.
Valid options are:
-W <classname and options> The classifier (incl. options) that was used to generate the source code.
-S <classname> The classname of the generated source code.
-t <file> The training set with which the source code was generated.
-c <index> The class index of the training set. 'first' and 'last' are valid indices. (default: last)Options after -- are passed to the designated classifier (specified with -W).
- Version:
- $Revision: 10141 $
- Author:
- fracpete (fracpete at waikato dot ac dot nz)
- See Also:
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanexecute()performs the comparison testGets the classifier being used for the tests, can be null.intGets the class index of the dataset.Gets the dataset to use for testing, can be null.String[]Gets the current settings of the Classifier.Returns the revision string.Gets the class to test.Returns an enumeration describing the available options.static voidExecutes the tests, use "-h" to list the commandline options.voidsetClassifier(Classifier value) Sets the classifier to use for the comparison.voidsetClassIndex(int value) Sets the class index of the dataset.voidsetDataset(File value) Sets the dataset to use for testing.voidsetOptions(String[] options) Parses a given list of options.voidsetSourceCode(Classifier value) Sets the class to test.
-
Constructor Details
-
CheckSource
public CheckSource()
-
-
Method Details
-
listOptions
Returns an enumeration describing the available options.- Specified by:
listOptionsin interfaceOptionHandler- Returns:
- an enumeration of all the available options.
-
setOptions
Parses a given list of options. Valid options are:-W <classname and options> The classifier (incl. options) that was used to generate the source code.
-S <classname> The classname of the generated source code.
-t <file> The training set with which the source code was generated.
-c <index> The class index of the training set. 'first' and 'last' are valid indices. (default: last)
Options after -- are passed to the designated classifier (specified with -W).- Specified by:
setOptionsin interfaceOptionHandler- 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- Returns:
- an array of strings suitable for passing to setOptions
-
setClassifier
Sets the classifier to use for the comparison.- Parameters:
value- the classifier to use
-
getClassifier
Gets the classifier being used for the tests, can be null.- Returns:
- the currently set classifier
-
setSourceCode
Sets the class to test.- Parameters:
value- the class to test
-
getSourceCode
Gets the class to test.- Returns:
- the currently set class, can be null.
-
setDataset
Sets the dataset to use for testing.- Parameters:
value- the dataset to use.
-
getDataset
Gets the dataset to use for testing, can be null.- Returns:
- the dataset to use.
-
setClassIndex
public void setClassIndex(int value) Sets the class index of the dataset.- Parameters:
value- the class index of the dataset.
-
getClassIndex
public int getClassIndex()Gets the class index of the dataset.- Returns:
- the current class index.
-
execute
performs the comparison test- Returns:
- true if tests were successful
- Throws:
Exception- if tests fail
-
getRevision
Returns the revision string.- Specified by:
getRevisionin interfaceRevisionHandler- Returns:
- the revision
-
main
Executes the tests, use "-h" to list the commandline options.- Parameters:
args- the commandline parameters- Throws:
Exception- if something goes wrong
-