Package weka.classifiers.rules

# Class DecisionTable

java.lang.Object
weka.classifiers.AbstractClassifier
weka.classifiers.rules.DecisionTable

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `Classifier`, `AdditionalMeasureProducer`, `BatchPredictor`, `CapabilitiesHandler`, `CapabilitiesIgnorer`, `CommandlineRunnable`, `OptionHandler`, `RevisionHandler`, `TechnicalInformationHandler`, `WeightedInstancesHandler`

public class DecisionTable extends AbstractClassifier implements OptionHandler, WeightedInstancesHandler, AdditionalMeasureProducer, TechnicalInformationHandler
Class for building and using a simple decision table majority classifier.
For more information see:
Ron Kohavi: The Power of Decision Tables. In: 8th European Conference on Machine Learning, 174-189, 1995.

BibTeX:

     @inproceedings{Kohavi1995,
        author = {Ron Kohavi},
        booktitle = {8th European Conference on Machine Learning},
        pages = {174-189},
        publisher = {Springer},
        title = {The Power of Decision Tables},
        year = {1995}
     }

Valid options are:

     -S <search method specification>
      Full class name of search method, followed
      by its options.
      eg: "weka.attributeSelection.BestFirst -D 1"
      (default weka.attributeSelection.BestFirst)

     -X <number of folds>
      Use cross validation to evaluate features.
      Use number of folds = 1 for leave one out CV.
      (Default = leave one out CV)

     -E <acc | rmse | mae | auc>
      Performance evaluation measure to use for selecting attributes.
      (Default = accuracy for discrete class and rmse for numeric class)

     -I
      Use nearest neighbour instead of global table majority.

     -R
      Display decision table rules.

     Options specific to search method weka.attributeSelection.BestFirst:

     -P <start set>
      Specify a starting set of attributes.
      Eg. 1,3,5-7.

     -D <0 = backward | 1 = forward | 2 = bi-directional>
      Direction of search. (default = 1).

     -N <num>
      Number of non-improving nodes to
      consider before terminating search.

     -S <num>
      Size of lookup cache for evaluated subsets.
      Expressed as a multiple of the number of
      attributes in the data set. (default = 1)

Version:
  $Revision: 15520 $
Author:
  Mark Hall (mhall@cs.waikato.ac.nz)
See Also:
  - Serialized Form

- ## Field Summary

  Fields
  Modifier and Type
  Field
  Description
  `static final int`
  `EVAL_ACCURACY`
  `static final int`
  `EVAL_AUC`
  `static final int`
  `EVAL_DEFAULT`
  default is accuracy for discrete class and RMSE for numeric class
  `static final int`
  `EVAL_MAE`
  `static final int`
  `EVAL_RMSE`
  `static final Tag[]`
  `TAGS_EVALUATION`

  ### Fields inherited from class weka.classifiers.AbstractClassifier

  `BATCH_SIZE_DEFAULT, NUM_DECIMAL_PLACES_DEFAULT`

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `DecisionTable()`
  Constructor for a DecisionTable

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `buildClassifier(Instances data)`
  Generates the classifier.
  `String`
  `crossValTipText()`
  Returns the tip text for this property
  `String`
  `displayRulesTipText()`
  Returns the tip text for this property
  `double[]`
  `distributionForInstance(Instance instance)`
  Calculates the class membership probabilities for the given test instance.
  `Enumeration<String>`
  `enumerateMeasures()`
  Returns an enumeration of the additional measure names
  `String`
  `evaluationMeasureTipText()`
  Returns the tip text for this property
  `Capabilities`
  `getCapabilities()`
  Returns default capabilities of the classifier.
  `int`
  `getCrossVal()`
  Gets the number of folds for cross validation
  `boolean`
  `getDisplayRules()`
  Gets whether rules are being printed
  `SelectedTag`
  `getEvaluationMeasure()`
  Gets the currently set performance evaluation measure used for selecting attributes for the decision table
  `double`
  `getMeasure(String additionalMeasureName)`
  Returns the value of the named measure
  `String[]`
  `getOptions()`
  Gets the current settings of the classifier.
  `String`
  `getRevision()`
  Returns the revision string.
  `ASSearch`
  `getSearch()`
  Gets the current search method
  `TechnicalInformation`
  `getTechnicalInformation()`
  Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.
  `boolean`
  `getUseIBk()`
  Gets whether IBk is being used instead of the majority class
  `String`
  `globalInfo()`
  Returns a string describing classifier
  `Enumeration<Option>`
  `listOptions()`
  Returns an enumeration describing the available options.
  `static void`
  `main(String[] argv)`
  Main method for testing this class.
  `double`
  `measureNumRules()`
  Returns the number of rules
  `String`
  `printFeatures()`
  Returns a string description of the features selected
  `String`
  `searchTipText()`
  Returns the tip text for this property
  `void`
  `setCrossVal(int folds)`
  Sets the number of folds for cross validation (1 = leave one out)
  `void`
  `setDisplayRules(boolean rules)`
  Sets whether rules are to be printed
  `void`
  `setEvaluationMeasure(SelectedTag newMethod)`
  Sets the performance evaluation measure to use for selecting attributes for the decision table
  `void`
  `setOptions(String[] options)`
  Parses the options for this object.
  `void`
  `setSearch(ASSearch search)`
  Sets the search method to use
  `void`
  `setUseIBk(boolean ibk)`
  Sets whether IBk should be used instead of the majority class
  `String`
  `toString()`
  Returns a description of the classifier.
  `String`
  `useIBkTipText()`
  Returns the tip text for this property

  ### Methods inherited from class weka.classifiers.AbstractClassifier

  `batchSizeTipText, classifyInstance, debugTipText, distributionsForInstances, doNotCheckCapabilitiesTipText, forName, getBatchSize, getDebug, getDoNotCheckCapabilities, getNumDecimalPlaces, implementsMoreEfficientBatchPrediction, makeCopies, makeCopy, numDecimalPlacesTipText, postExecution, preExecution, run, runClassifier, setBatchSize, setDebug, setDoNotCheckCapabilities, setNumDecimalPlaces`

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- ## Field Details

  - ### EVAL_DEFAULT

    public static final int EVAL_DEFAULT
    default is accuracy for discrete class and RMSE for numeric class
    See Also:
      - Constant Field Values

  - ### EVAL_ACCURACY

    public static final int EVAL_ACCURACY
    See Also:
      - Constant Field Values

  - ### EVAL_RMSE

    public static final int EVAL_RMSE
    See Also:
      - Constant Field Values

  - ### EVAL_MAE

    public static final int EVAL_MAE
    See Also:
      - Constant Field Values

  - ### EVAL_AUC

    public static final int EVAL_AUC
    See Also:
      - Constant Field Values

  - ### TAGS_EVALUATION

    public static final Tag[] TAGS_EVALUATION

- ## Constructor Details

  - ### DecisionTable

    public DecisionTable()
    Constructor for a DecisionTable

- ## Method Details

  - ### globalInfo

    public String globalInfo()
    Returns a string describing classifier
    Returns:
      a description suitable for displaying in the explorer/experimenter gui

  - ### getTechnicalInformation

    public TechnicalInformation getTechnicalInformation()
    Returns an instance of a TechnicalInformation object, containing detailed information about the technical background of this class, e.g., paper reference or book this class is based on.
    Specified by:
      `getTechnicalInformation` in interface `TechnicalInformationHandler`
    Returns:
      the technical information about this class

  - ### listOptions

    public Enumeration<Option> listOptions()
    Returns an enumeration describing the available options.
    Specified by:
      `listOptions` in interface `OptionHandler`
    Overrides:
      `listOptions` in class `AbstractClassifier`
    Returns:
      an enumeration of all the available options.

  - ### crossValTipText

    public String crossValTipText()
    Returns the tip text for this property
    Returns:
      tip text for this property suitable for displaying in the explorer/experimenter gui

  - ### setCrossVal

    public void setCrossVal(int folds)
    Sets the number of folds for cross validation (1 = leave one out)
    Parameters:
      `folds` - the number of folds

  - ### getCrossVal

    public int getCrossVal()
    Gets the number of folds for cross validation
    Returns:
      the number of cross validation folds

  - ### useIBkTipText

    public String useIBkTipText()
    Returns the tip text for this property
    Returns:
      tip text for this property suitable for displaying in the explorer/experimenter gui

  - ### setUseIBk

    public void setUseIBk(boolean ibk)
    Sets whether IBk should be used instead of the majority class
    Parameters:
      `ibk` - true if IBk is to be used

  - ### getUseIBk

    public boolean getUseIBk()
    Gets whether IBk is being used instead of the majority class
    Returns:
      true if IBk is being used

  - ### displayRulesTipText

    public String displayRulesTipText()
    Returns the tip text for this property
    Returns:
      tip text for this property suitable for displaying in the explorer/experimenter gui

  - ### setDisplayRules

    public void setDisplayRules(boolean rules)
    Sets whether rules are to be printed
    Parameters:
      `rules` - true if rules are to be printed

  - ### getDisplayRules

    public boolean getDisplayRules()
    Gets whether rules are being printed
    Returns:
      true if rules are being printed

  - ### searchTipText

    public String searchTipText()
    Returns the tip text for this property
    Returns:
      tip text for this property suitable for displaying in the explorer/experimenter gui

  - ### setSearch

    public void setSearch(ASSearch search)
    Sets the search method to use
    Parameters:
      `search` -

  - ### getSearch

    public ASSearch getSearch()
    Gets the current search method
    Returns:
      the search method used

  - ### evaluationMeasureTipText

    public String evaluationMeasureTipText()
    Returns the tip text for this property
    Returns:
      tip text for this property suitable for displaying in the explorer/experimenter gui

  - ### getEvaluationMeasure

    public SelectedTag getEvaluationMeasure()
    Gets the currently set performance evaluation measure used for selecting attributes for the decision table
    Returns:
      the performance evaluation measure

  - ### setEvaluationMeasure

    public void setEvaluationMeasure(SelectedTag newMethod)
    Sets the performance evaluation measure to use for selecting attributes for the decision table
    Parameters:
      `newMethod` - the new performance evaluation metric to use

  - ### setOptions

    public void setOptions(String[] options) throws Exception
    Parses the options for this object.

    Valid options are:

         -S <search method specification>
          Full class name of search method, followed
          by its options.
          eg: "weka.attributeSelection.BestFirst -D 1"
          (default weka.attributeSelection.BestFirst)

         -X <number of folds>
          Use cross validation to evaluate features.
          Use number of folds = 1 for leave one out CV.
          (Default = leave one out CV)

         -E <acc | rmse | mae | auc>
          Performance evaluation measure to use for selecting attributes.
          (Default = accuracy for discrete class and rmse for numeric class)

         -I
          Use nearest neighbour instead of global table majority.

         -R
          Display decision table rules.

         Options specific to search method weka.attributeSelection.BestFirst:

         -P <start set>
          Specify a starting set of attributes.
          Eg. 1,3,5-7.

         -D <0 = backward | 1 = forward | 2 = bi-directional>
          Direction of search. (default = 1).

         -N <num>
          Number of non-improving nodes to
          consider before terminating search.

         -S <num>
          Size of lookup cache for evaluated subsets.
          Expressed as a multiple of the number of
          attributes in the data set. (default = 1)

    Specified by:
      `setOptions` in interface `OptionHandler`
    Overrides:
      `setOptions` in class `AbstractClassifier`
    Parameters:
      `options` - the list of options as an array of strings
    Throws:
      `Exception` - if an option is not supported

  - ### getOptions

    public String[] getOptions()
    Gets the current settings of the classifier.
    Specified by:
      `getOptions` in interface `OptionHandler`
    Overrides:
      `getOptions` in class `AbstractClassifier`
    Returns:
      an array of strings suitable for passing to setOptions

  - ### getCapabilities

    public Capabilities getCapabilities()
    Returns default capabilities of the classifier.
    Specified by:
      `getCapabilities` in interface `CapabilitiesHandler`
    Specified by:
      `getCapabilities` in interface `Classifier`
    Overrides:
      `getCapabilities` in class `AbstractClassifier`
    Returns:
      the capabilities of this classifier
    See Also:
      - `Capabilities`

  - ### buildClassifier

    public void buildClassifier(Instances data) throws Exception
    Generates the classifier.
    Specified by:
      `buildClassifier` in interface `Classifier`
    Parameters:
      `data` - set of instances serving as training data
    Throws:
      `Exception` - if the classifier has not been generated successfully

  - ### distributionForInstance

    public double[] distributionForInstance(Instance instance) throws Exception
    Calculates the class membership probabilities for the given test instance.
    Specified by:
      `distributionForInstance` in interface `Classifier`
    Overrides:
      `distributionForInstance` in class `AbstractClassifier`
    Parameters:
      `instance` - the instance to be classified
    Returns:
      predicted class probability distribution
    Throws:
      `Exception` - if distribution can't be computed

  - ### printFeatures

    public String printFeatures()
    Returns a string description of the features selected
    Returns:
      a string of features

  - ### measureNumRules

    public double measureNumRules()
    Returns the number of rules
    Returns:
      the number of rules

  - ### enumerateMeasures

    public Enumeration<String> enumerateMeasures()
    Returns an enumeration of the additional measure names
    Specified by:
      `enumerateMeasures` in interface `AdditionalMeasureProducer`
    Returns:
      an enumeration of the measure names

  - ### getMeasure

    public double getMeasure(String additionalMeasureName)
    Returns the value of the named measure
    Specified by:
      `getMeasure` in interface `AdditionalMeasureProducer`
    Parameters:
      `additionalMeasureName` - the name of the measure to query for its value
    Returns:
      the value of the named measure
    Throws:
      `IllegalArgumentException` - if the named measure is not supported

  - ### toString

    public String toString()
    Returns a description of the classifier.
    Overrides:
      `toString` in class `Object`
    Returns:
      a description of the classifier as a string.

  - ### getRevision

    public String getRevision()
    Returns the revision string.
    Specified by:
      `getRevision` in interface `RevisionHandler`
    Overrides:
      `getRevision` in class `AbstractClassifier`
    Returns:
      the revision

  - ### main

    public static void main(String[] argv)
    Main method for testing this class.
    Parameters:
      `argv` - the command-line options