类 CheckKernel

java.lang.Object
weka.core.Check
weka.core.CheckScheme
weka.classifiers.functions.supportVector.CheckKernel
所有已实现的接口:
OptionHandler, RevisionHandler

public class CheckKernel extends CheckScheme
Class for examining the capabilities and finding problems with kernels. If you implement an kernels 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 kernels don't exist, but this will help find some common ones.

Typical usage:

java weka.classifiers.functions.supportVector.CheckKernel -W kernel_name -- kernel_options

CheckKernel reports on the following:

  • Kernel abilities
    • Possible command line options to the kernels
    • Whether the kernels can predict nominal, numeric, string, date or relational class attributes.
    • Whether the kernels can handle numeric predictor attributes
    • Whether the kernels can handle nominal predictor attributes
    • Whether the kernels can handle string predictor attributes
    • Whether the kernels can handle date predictor attributes
    • Whether the kernels can handle relational predictor attributes
    • Whether the kernels can handle multi-instance data
    • Whether the kernels can handle missing predictor values
    • Whether the kernels can handle missing class values
    • Whether a nominal kernels only handles 2 class problems
    • Whether the kernels can handle instance weights
  • Correct functioning
    • Correct initialisation during buildKernel (i.e. no result changes when buildKernel called repeatedly)
    • Whether the kernels alters the data passed to it (number of instances, instance order, instance weights, etc)
  • Degenerate cases
    • building kernels with zero training instances
    • all but one predictor attribute values missing
    • all predictor attribute values missing
    • all but one class values missing
    • all class values missing
Running CheckKernel with the debug option set will output the training and test datasets for any failed tests.

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

Valid options are:

 -D
  Turn on debugging output.
 -S
  Silent mode - prints nothing to stdout.
 -N <num>
  The number of instances in the datasets (default 20).
 -nominal <num>
  The number of nominal attributes (default 2).
 -nominal-values <num>
  The number of values for nominal attributes (default 1).
 -numeric <num>
  The number of numeric attributes (default 1).
 -string <num>
  The number of string attributes (default 1).
 -date <num>
  The number of date attributes (default 1).
 -relational <num>
  The number of relational attributes (default 1).
 -num-instances-relational <num>
  The number of instances in relational/bag attributes (default 10).
 -words <comma-separated-list>
  The words to use in string attributes.
 -word-separators <chars>
  The word separators to use in string attributes.
 -W
  Full name of the kernel analysed.
  eg: weka.classifiers.functions.supportVector.RBFKernel
  (default weka.classifiers.functions.supportVector.RBFKernel)
 
 Options specific to kernel weka.classifiers.functions.supportVector.RBFKernel:
 
 -D
  Enables debugging output (if available) to be printed.
  (default: off)
 -no-checks
  Turns off all checks - use with caution!
  (default: checks on)
 -C <num>
  The size of the cache (a prime number), 0 for full cache and 
  -1 to turn it off.
  (default: 250007)
 -G <num>
  The Gamma parameter.
  (default: 0.01)
Options after -- are passed to the designated kernel.

版本:
$Revision: 1.3 $
作者:
Len Trigg (trigg@cs.waikato.ac.nz), FracPete (fracpete at waikato dot ac dot nz)
另请参阅:
  • 构造器详细资料

    • CheckKernel

      public CheckKernel()
  • 方法详细资料

    • listOptions

      public Enumeration listOptions()
      Returns an enumeration describing the available options.
      指定者:
      listOptions 在接口中 OptionHandler
      覆盖:
      listOptions 在类中 CheckScheme
      返回:
      an enumeration of all the available options.
    • setOptions

      public void setOptions(String[] options) throws Exception
      Parses a given list of options. Valid options are:

       -D
        Turn on debugging output.
       -S
        Silent mode - prints nothing to stdout.
       -N <num>
        The number of instances in the datasets (default 20).
       -nominal <num>
        The number of nominal attributes (default 2).
       -nominal-values <num>
        The number of values for nominal attributes (default 1).
       -numeric <num>
        The number of numeric attributes (default 1).
       -string <num>
        The number of string attributes (default 1).
       -date <num>
        The number of date attributes (default 1).
       -relational <num>
        The number of relational attributes (default 1).
       -num-instances-relational <num>
        The number of instances in relational/bag attributes (default 10).
       -words <comma-separated-list>
        The words to use in string attributes.
       -word-separators <chars>
        The word separators to use in string attributes.
       -W
        Full name of the kernel analysed.
        eg: weka.classifiers.functions.supportVector.RBFKernel
        (default weka.classifiers.functions.supportVector.RBFKernel)
       
       Options specific to kernel weka.classifiers.functions.supportVector.RBFKernel:
       
       -D
        Enables debugging output (if available) to be printed.
        (default: off)
       -no-checks
        Turns off all checks - use with caution!
        (default: checks on)
       -C <num>
        The size of the cache (a prime number), 0 for full cache and 
        -1 to turn it off.
        (default: 250007)
       -G <num>
        The Gamma parameter.
        (default: 0.01)
      指定者:
      setOptions 在接口中 OptionHandler
      覆盖:
      setOptions 在类中 CheckScheme
      参数:
      options - the list of options as an array of strings
      抛出:
      Exception - if an option is not supported
    • getOptions

      public String[] getOptions()
      Gets the current settings of the CheckKernel.
      指定者:
      getOptions 在接口中 OptionHandler
      覆盖:
      getOptions 在类中 CheckScheme
      返回:
      an array of strings suitable for passing to setOptions
    • doTests

      public void doTests()
      Begin the tests, reporting results to System.out
      指定者:
      doTests 在类中 CheckScheme
    • setKernel

      public void setKernel(Kernel value)
      Set the lernel to test.
      参数:
      value - the kernel to use.
    • getKernel

      public Kernel getKernel()
      Get the kernel being tested
      返回:
      the kernel being tested
    • getRevision

      public String getRevision()
      Returns the revision string.
      返回:
      the revision
    • main

      public static void main(String[] args)
      Test method for this class
      参数:
      args - the commandline parameters