程序包 weka.clusterers

类 CheckClusterer

所有已实现的接口:
OptionHandler, RevisionHandler

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

Typical usage:

java weka.clusterers.CheckClusterer -W clusterer_name -- clusterer_options

CheckClusterer reports on the following:

  • Clusterer abilities
    • Possible command line options to the clusterer
    • Whether the clusterer can predict nominal, numeric, string, date or relational class attributes.
    • Whether the clusterer can handle numeric predictor attributes
    • Whether the clusterer can handle nominal predictor attributes
    • Whether the clusterer can handle string predictor attributes
    • Whether the clusterer can handle date predictor attributes
    • Whether the clusterer can handle relational predictor attributes
    • Whether the clusterer can handle multi-instance data
    • Whether the clusterer can handle missing predictor values
    • Whether the clusterer can handle instance weights
  • Correct functioning
    • Correct initialisation during buildClusterer (i.e. no result changes when buildClusterer called repeatedly)
    • Whether the clusterer alters the data pased to it (number of instances, instance order, instance weights, etc)
  • Degenerate cases
    • building clusterer 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 CheckClusterer with the debug option set will output the training dataset for any failed tests.

The weka.clusterers.AbstractClustererTest uses this class to test all the clusterers. 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 clusterer analyzed.
  eg: weka.clusterers.SimpleKMeans
  (default weka.clusterers.SimpleKMeans)
 
 Options specific to clusterer weka.clusterers.SimpleKMeans:
 
 -N <num>
  number of clusters.
  (default 2).
 -V
  Display std. deviations for centroids.
 
 -M
  Replace missing values with mean/mode.
 
 -S <num>
  Random number seed.
  (default 10)
Options after -- are passed to the designated clusterer.

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

    • CheckClusterer

      public CheckClusterer()
      default constructor
  • 方法详细资料

    • 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 clusterer analyzed.
        eg: weka.clusterers.SimpleKMeans
        (default weka.clusterers.SimpleKMeans)
       
       Options specific to clusterer weka.clusterers.SimpleKMeans:
       
       -N <num>
        number of clusters.
        (default 2).
       -V
        Display std. deviations for centroids.
       
       -M
        Replace missing values with mean/mode.
       
       -S <num>
        Random number seed.
        (default 10)
      指定者:
      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 CheckClusterer.
      指定者:
      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
    • setClusterer

      public void setClusterer(Clusterer newClusterer)
      Set the clusterer for testing.
      参数:
      newClusterer - the Clusterer to use.
    • getClusterer

      public Clusterer getClusterer()
      Get the clusterer used as the clusterer
      返回:
      the clusterer used as the clusterer
    • 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 options