Package weka.classifiers.rules

# Class DTNB

java.lang.Object
weka.classifiers.Classifier
weka.classifiers.rules.DecisionTable
weka.classifiers.rules.DTNB

All Implemented Interfaces:
  `Serializable`, `Cloneable`, `AdditionalMeasureProducer`, `CapabilitiesHandler`, `OptionHandler`, `RevisionHandler`, `TechnicalInformationHandler`, `WeightedInstancesHandler`

public class DTNB extends DecisionTable
Class for building and using a decision table/naive bayes hybrid classifier. At each point in the search, the algorithm evaluates the merit of dividing the attributes into two disjoint subsets: one for the decision table, the other for naive Bayes. A forward selection search is used, where at each step, selected attributes are modeled by naive Bayes and the remainder by the decision table, and all attributes are modelled by the decision table initially. At each step, the algorithm also considers dropping an attribute entirely from the model.
For more information, see:
Mark Hall, Eibe Frank: Combining Naive Bayes and Decision Tables. In: Proceedings of the 21st Florida Artificial Intelligence Society Conference (FLAIRS), ???-???, 2008.

BibTeX:

     @inproceedings{Hall2008,
        author = {Mark Hall and Eibe Frank},
        booktitle = {Proceedings of the 21st Florida Artificial Intelligence Society Conference (FLAIRS)},
        pages = {318-319},
        publisher = {AAAI press},
        title = {Combining Naive Bayes and Decision Tables},
        year = {2008}
     }

Valid options are:

     -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.

Version:
  $Revision: 6269 $
Author:
  Mark Hall (mhall{[at]}pentaho{[dot]}org), Eibe Frank (eibe{[at]}cs{[dot]}waikato{[dot]}ac{[dot]}nz)
See Also:
  - Serialized Form

## Field Summary

### Fields inherited from class weka.classifiers.rules.DecisionTable

`EVAL_ACCURACY, EVAL_AUC, EVAL_DEFAULT, EVAL_MAE, EVAL_RMSE, TAGS_EVALUATION`

## Constructor Summary

Constructors
Constructor
Description
`DTNB()`

## Method Summary

Modifier and Type
Method
Description
`void`
`buildClassifier(Instances data)`
Generates the classifier.
`double[]`
`distributionForInstance(Instance instance)`
Calculates the class membership probabilities for the given test instance.
`Enumeration`
`enumerateMeasures()`
Returns an enumeration of the additional measure names
`Capabilities`
`getCapabilities()`
Returns default capabilities of the classifier.
`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.
`String`
`globalInfo()`
Returns a string describing classifier
`Enumeration`
`listOptions()`
Returns an enumeration describing the available options.
`static void`
`main(String[] argv)`
Main method for testing this class.
`double`
`measurePercentAttsUsedByDT()`
Returns the number of rules
`void`
`setOptions(String[] options)`
Parses the options for this object.
`void`
`setSearch(ASSearch search)`
Sets the search method to use
`String`
`toString()`
Returns a description of the classifier.

### Methods inherited from class weka.classifiers.rules.DecisionTable

`crossValTipText, displayRulesTipText, evaluationMeasureTipText, getCrossVal, getDisplayRules, getEvaluationMeasure, getUseIBk, measureNumRules, printFeatures, searchTipText, setCrossVal, setDisplayRules, setEvaluationMeasure, setUseIBk, useIBkTipText`

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

`classifyInstance, debugTipText, forName, getDebug, makeCopies, makeCopy, setDebug`

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

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

## Constructor Details

### DTNB

public DTNB()

## Method Details

### globalInfo

public String globalInfo()
Returns a string describing classifier

Overrides:
  `globalInfo` in class `DecisionTable`
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`
Overrides:
  `getTechnicalInformation` in class `DecisionTable`
Returns:
  the technical information about this class

### buildClassifier

public void buildClassifier(Instances data) throws Exception
Generates the classifier.

Overrides:
  `buildClassifier` in class `DecisionTable`
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.

Overrides:
  `distributionForInstance` in class `DecisionTable`
Parameters:
  `instance` - the instance to be classified
Returns:
  predicted class probability distribution
Throws:
  `Exception` - if distribution can't be computed

### toString

public String toString()
Description copied from class: `DecisionTable`
Returns a description of the classifier.

Overrides:
  `toString` in class `DecisionTable`
Returns:
  a description of the classifier as a string.

### measurePercentAttsUsedByDT

public double measurePercentAttsUsedByDT()
Returns the number of rules

Returns:
  the number of rules

### enumerateMeasures

public Enumeration enumerateMeasures()
Returns an enumeration of the additional measure names

Specified by:
  `enumerateMeasures` in interface `AdditionalMeasureProducer`
Overrides:
  `enumerateMeasures` in class `DecisionTable`
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`
Overrides:
  `getMeasure` in class `DecisionTable`
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

### getCapabilities

public Capabilities getCapabilities()
Returns default capabilities of the classifier.

Specified by:
  `getCapabilities` in interface `CapabilitiesHandler`
Overrides:
  `getCapabilities` in class `DecisionTable`
Returns:
  the capabilities of this classifier
See Also:
  - `Capabilities`

### setSearch

public void setSearch(ASSearch search)
Sets the search method to use

Overrides:
  `setSearch` in class `DecisionTable`
Parameters:
  `search` -

### getSearch

public ASSearch getSearch()
Gets the current search method

Overrides:
  `getSearch` in class `DecisionTable`
Returns:
  the search method used

### listOptions

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

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

### setOptions

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

Valid options are:

     -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.

Specified by:
  `setOptions` in interface `OptionHandler`
Overrides:
  `setOptions` in class `DecisionTable`
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 `DecisionTable`
Returns:
  an array of strings suitable for passing to setOptions

### getRevision

public String getRevision()
Returns the revision string.

Specified by:
  `getRevision` in interface `RevisionHandler`
Overrides:
  `getRevision` in class `DecisionTable`
Returns:
  the revision

### main

public static void main(String[] argv)
Main method for testing this class.

Parameters:
  `argv` - the command-line options