weka.classifiers
Class CheckClassifier

java.lang.Object
  extended by weka.classifiers.CheckClassifier
All Implemented Interfaces:
OptionHandler

public class CheckClassifier
extends java.lang.Object
implements OptionHandler

Class for examining the capabilities and finding problems with classifiers. If you implement a classifier using the WEKA.libraries, you should run the checks on it to ensure robustness and correct operation. Passing all the tests of this object does not mean bugs in the classifier don't exist, but this will help find some common ones.

Typical usage:

java weka.classifiers.CheckClassifier -W classifier_name classifier_options

CheckClassifier reports on the following:

Running CheckClassifier with the debug option set will output the training and test datasets for any failed tests.

The weka.classifiers.AbstractClassifierTest uses this class to test all the classifiers. Any changes here, have to be checked in that abstract test class, too.

Valid options are:

-D
Turn on debugging output.

-S
Silent mode, i.e., no output at all.

-N num
Number of instances to use for datasets (default 20).

-W classname
Specify the full class name of a classifier to perform the tests on (required).

Options after -- are passed to the designated classifier.

Version:
$Revision: 1.16.2.2 $
Author:
Len Trigg (trigg@cs.waikato.ac.nz)

Nested Class Summary
static class CheckClassifier.PostProcessor
          a class for postprocessing the test-data
 
Constructor Summary
CheckClassifier()
           
 
Method Summary
 void doTests()
          Begin the tests, reporting results to System.out
 Classifier getClassifier()
          Get the classifier used as the classifier
 boolean getDebug()
          Get whether debugging is turned on
 int getNumInstances()
          Gets the current number of instances to use for the datasets.
 java.lang.String[] getOptions()
          Gets the current settings of the CheckClassifier.
 CheckClassifier.PostProcessor getPostProcessor()
          returns the current PostProcessor, can be null
 boolean getSilent()
          Get whether silent mode is turned on
 java.util.Enumeration listOptions()
          Returns an enumeration describing the available options.
static void main(java.lang.String[] args)
          Test method for this class
 void setClassifier(Classifier newClassifier)
          Set the classifier for boosting.
 void setDebug(boolean debug)
          Set debugging mode
 void setNumInstances(int value)
          Sets the number of instances to use in the datasets (some classifiers might require more instances).
 void setOptions(java.lang.String[] options)
          Parses a given list of options.
 void setPostProcessor(CheckClassifier.PostProcessor value)
          sets the PostProcessor to use
 void setSilent(boolean value)
          Set slient mode, i.e., no output at all to stdout
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

CheckClassifier

public CheckClassifier()
Method Detail

listOptions

public java.util.Enumeration listOptions()
Returns an enumeration describing the available options.

Specified by:
listOptions in interface OptionHandler
Returns:
an enumeration of all the available options.

setOptions

public void setOptions(java.lang.String[] options)
                throws java.lang.Exception
Parses a given list of options.

Specified by:
setOptions in interface OptionHandler
Parameters:
options - the list of options as an array of strings
Throws:
java.lang.Exception - if an option is not supported

getOptions

public java.lang.String[] getOptions()
Gets the current settings of the CheckClassifier.

Specified by:
getOptions in interface OptionHandler
Returns:
an array of strings suitable for passing to setOptions

setPostProcessor

public void setPostProcessor(CheckClassifier.PostProcessor value)
sets the PostProcessor to use

Parameters:
value - the new PostProcessor
See Also:
m_PostProcessor

getPostProcessor

public CheckClassifier.PostProcessor getPostProcessor()
returns the current PostProcessor, can be null

Returns:
the current PostProcessor

doTests

public void doTests()
Begin the tests, reporting results to System.out


setDebug

public void setDebug(boolean debug)
Set debugging mode

Parameters:
debug - true if debug output should be printed

getDebug

public boolean getDebug()
Get whether debugging is turned on

Returns:
true if debugging output is on

setSilent

public void setSilent(boolean value)
Set slient mode, i.e., no output at all to stdout

Parameters:
value - whether silent mode is active or not

getSilent

public boolean getSilent()
Get whether silent mode is turned on

Returns:
true if silent mode is on

setNumInstances

public void setNumInstances(int value)
Sets the number of instances to use in the datasets (some classifiers might require more instances).

Parameters:
value - the number of instances to use

getNumInstances

public int getNumInstances()
Gets the current number of instances to use for the datasets.

Returns:
the number of instances

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

main

public static void main(java.lang.String[] args)
Test method for this class