Package weka.classifiers.trees

# Class NBTree

java.lang.Object
weka.classifiers.Classifier
weka.classifiers.trees.NBTree

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

public class NBTree extends Classifier implements WeightedInstancesHandler, Drawable, Summarizable, AdditionalMeasureProducer, TechnicalInformationHandler
Class for generating a decision tree with naive Bayes classifiers at the leaves.
For more information, see
Ron Kohavi: Scaling Up the Accuracy of Naive-Bayes Classifiers: A Decision-Tree Hybrid. In: Second International Conference on Knoledge Discovery and Data Mining, 202-207, 1996.

BibTeX:

     @inproceedings{Kohavi1996,
        author = {Ron Kohavi},
        booktitle = {Second International Conference on Knoledge Discovery and Data Mining},
        pages = {202-207},
        title = {Scaling Up the Accuracy of Naive-Bayes Classifiers: A Decision-Tree Hybrid},
        year = {1996}
     }

Valid options are:

     -D
      If set, classifier is run in debug mode and
      may output additional info to the console

Version:
  $Revision: 1.10 $
Author:
  Mark Hall
See Also:
  - Serialized Form

## Field Summary

### Fields inherited from interface weka.core.Drawable

`BayesNet, Newick, NOT_DRAWABLE, TREE`

## Constructor Summary

Constructors
Constructor
Description
`NBTree()`

## Method Summary

Modifier and Type
Method
Description
`void`
`buildClassifier(Instances instances)`
Generates the classifier.
`double`
`classifyInstance(Instance instance)`
Classifies an instance.
`final double[]`
`distributionForInstance(Instance instance)`
Returns class probabilities for an 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`
`getRevision()`
Returns the revision string.
`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
`String`
`graph()`
Returns graph describing the tree.
`int`
`graphType()`
Returns the type of graph this classifier represents.
`static void`
`main(String[] argv)`
Main method for testing this class
`double`
`measureNumLeaves()`
Returns the number of leaves
`double`
`measureNumRules()`
Returns the number of rules (same as number of leaves)
`double`
`measureTreeSize()`
Returns the size of the tree
`String`
`toString()`
Returns a description of the classifier.
`String`
`toSummaryString()`
Returns a superconcise version of the model

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

`debugTipText, forName, getDebug, getOptions, listOptions, makeCopies, makeCopy, setDebug, setOptions`

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

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

## Constructor Details

### NBTree

public NBTree()

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

### getCapabilities

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

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

### buildClassifier

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

Specified by:
  `buildClassifier` in class `Classifier`
Parameters:
  `instances` - the data to train with
Throws:
  `Exception` - if classifier can't be built successfully

### classifyInstance

public double classifyInstance(Instance instance) throws Exception
Classifies an instance.

Overrides:
  `classifyInstance` in class `Classifier`
Parameters:
  `instance` - the instance to classify
Returns:
  the classification
Throws:
  `Exception` - if instance can't be classified successfully

### distributionForInstance

public final double[] distributionForInstance(Instance instance) throws Exception
Returns class probabilities for an instance.

Overrides:
  `distributionForInstance` in class `Classifier`
Parameters:
  `instance` - the instance to get the distribution for
Returns:
  the class probabilities
Throws:
  `Exception` - if distribution can't be computed successfully

### toString

public String toString()
Returns a description of the classifier.

Overrides:
  `toString` in class `Object`
Returns:
  a string representation of the classifier

### graphType

public int graphType()
Returns the type of graph this classifier represents.

Specified by:
  `graphType` in interface `Drawable`
Returns:
  Drawable.TREE

### graph

public String graph() throws Exception
Returns graph describing the tree.

Specified by:
  `graph` in interface `Drawable`
Returns:
  the graph describing the tree
Throws:
  `Exception` - if graph can't be computed

### toSummaryString

public String toSummaryString()
Returns a superconcise version of the model

Specified by:
  `toSummaryString` in interface `Summarizable`
Returns:
  a description of the model

### measureTreeSize

public double measureTreeSize()
Returns the size of the tree

Returns:
  the size of the tree

### measureNumLeaves

public double measureNumLeaves()
Returns the number of leaves

Returns:
  the number of leaves

### measureNumRules

public double measureNumRules()
Returns the number of rules (same as number of leaves)

Returns:
  the number of rules

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

### enumerateMeasures

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

Specified by:
  `enumerateMeasures` in interface `AdditionalMeasureProducer`
Returns:
  an enumeration of the measure names

### getRevision

public String getRevision()
Returns the revision string.

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

### main

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

Parameters:
  `argv` - the commandline options