Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## weka.classifiers.trees
Class NBTree

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

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable, AdditionalMeasureProducer, Drawable, OptionHandler, Summarizable, WeightedInstancesHandler

    public class NBTree

extends Classifier
implements WeightedInstancesHandler, Drawable, Summarizable, AdditionalMeasureProducer

Class for generating a Naive Bayes tree (decision tree with Naive Bayes classifiers at the leaves).

For more information, see

Ron Kohavi (1996). Scaling up the accuracy of naive-Bayes classifiers: a decision tree hybrid. Proceedings of the Second International Conference on Knowledge Discovery and Data Mining.

Version:
  $Revision: 1.3.2.1 $
See Also:
  Serialized Form

Field Summary

Fields inherited from interface weka.core.Drawable
`BayesNet, NOT_DRAWABLE, TREE`

Constructor Summary
`NBTree()`

Method Summary
`void` | `buildClassifier(Instances instances)` Generates the classifier.
`double` | `classifyInstance(Instance instance)` Classifies an instance.
`double[]` | `distributionForInstance(Instance instance)` Returns class probabilities for an instance.
`java.util.Enumeration` | `enumerateMeasures()` Returns an enumeration of the additional measure names
`double` | `getMeasure(java.lang.String additionalMeasureName)` Returns the value of the named measure
`java.lang.String` | `globalInfo()` Returns a string describing classifier
`java.lang.String` | `graph()` Returns graph describing the tree.
`int` | `graphType()` Returns the type of graph this classifier represents.
`static void` | `main(java.lang.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
`java.lang.String` | `toString()` Returns a description of the classifier.
`java.lang.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 Detail

### NBTree

    public NBTree()

Method Detail

### globalInfo

    public java.lang.String globalInfo()

  Returns a string describing classifier

  Returns:
    a description suitable for displaying in the explorer/experimenter gui

### buildClassifier

    public void buildClassifier(Instances instances)
                         throws java.lang.Exception

  Generates the classifier.

  Specified by:
    `buildClassifier` in class `Classifier`
  Parameters:
    `instances` - set of instances serving as training data
  Throws:
    `java.lang.Exception` - if classifier can't be built successfully

### classifyInstance

    public double classifyInstance(Instance instance)
                            throws java.lang.Exception

  Classifies an instance.

  Overrides:
    `classifyInstance` in class `Classifier`
  Parameters:
    `instance` - the instance to be classified
  Returns:
    the predicted most likely class for the instance or Instance.missingValue() if no prediction is made
  Throws:
    `java.lang.Exception` - if instance can't be classified successfully

### distributionForInstance

    public final double[] distributionForInstance(Instance instance)
                                           throws java.lang.Exception

  Returns class probabilities for an instance.

  Overrides:
    `distributionForInstance` in class `Classifier`
  Parameters:
    `instance` - the instance to be classified
  Returns:
    an array containing the estimated membership probabilities of the test instance in each class or the numeric prediction
  Throws:
    `java.lang.Exception` - if distribution can't be computed successfully

### toString

    public java.lang.String toString()

  Returns a description of the classifier.

  Overrides:
    `toString` in class `java.lang.Object`

### graphType

    public int graphType()

  Returns the type of graph this classifier represents.

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

### graph

    public java.lang.String graph()
                           throws java.lang.Exception

  Returns graph describing the tree.

  Specified by:
    `graph` in interface `Drawable`
  Returns:
    the graph described by a string
  Throws:
    `java.lang.Exception` - if graph can't be computed

### toSummaryString

    public java.lang.String toSummaryString()

  Returns a superconcise version of the model

  Specified by:
    `toSummaryString` in interface `Summarizable`
  Returns:
    the object summarized as a string

### 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(java.lang.String additionalMeasureName)

  Returns the value of the named measure

  Specified by:
    `getMeasure` in interface `AdditionalMeasureProducer`
  Parameters:
    `measureName` - the name of the measure to query for its value
  Returns:
    the value of the named measure
  Throws:
    `java.lang.IllegalArgumentException` - if the named measure is not supported

### enumerateMeasures

    public java.util.Enumeration enumerateMeasures()

  Returns an enumeration of the additional measure names

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

### main

    public static void main(java.lang.String[] argv)

  Main method for testing this class

  Parameters:
    `String` - options

Overview | Package | Class | Tree | Deprecated | Index | Help | Weka's home
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD