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.j48
Class NBTreeNoSplit

    java.lang.Object
      weka.classifiers.trees.j48.ClassifierSplitModel
          weka.classifiers.trees.j48.NBTreeNoSplit

All Implemented Interfaces:
  java.io.Serializable, java.lang.Cloneable

    public final class NBTreeNoSplit

extends ClassifierSplitModel

Class implementing a "no-split"-split (leaf node) for naive bayes trees.

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

Constructor Summary
`NBTreeNoSplit()`

Method Summary
`void` | `buildClassifier(Instances instances)` Build the no-split node
`double` | `classProb(int classIndex, Instance instance, int theSubset)` Return the probability for a class value
`static double` | `crossValidate(NaiveBayesUpdateable fullModel, Instances trainingSet, java.util.Random r)` Utility method for fast 5-fold cross validation of a naive bayes model
`Discretize` | `getDiscretizer()` Return the discretizer used at this node
`double` | `getErrors()` Return the errors made by the naive bayes model at this node
`NaiveBayesUpdateable` | `getNaiveBayesModel()` Get the naive bayes model at this node
`java.lang.String` | `leftSide(Instances instances)` Does nothing because no condition has to be satisfied.
`java.lang.String` | `rightSide(int index, Instances instances)` Does nothing because no condition has to be satisfied.
`java.lang.String` | `sourceExpression(int index, Instances data)` Returns a string containing java source code equivalent to the test made at this node.
`java.lang.String` | `toString()` Return a textual description of the node
`double[]` | `weights(Instance instance)` Always returns null because there is only one subset.
`int` | `whichSubset(Instance instance)` Always returns 0 because only there is only one subset.

Methods inherited from class weka.classifiers.trees.j48.ClassifierSplitModel
`checkModel, classifyInstance, classProbLaplace, clone, codingCost, distribution, dumpLabel, dumpModel, numSubsets, resetDistribution, sourceClass, split`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### NBTreeNoSplit

    public NBTreeNoSplit()

Method Detail

### buildClassifier

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

  Build the no-split node

  Specified by:
    `buildClassifier` in class `ClassifierSplitModel`
  Parameters:
    `instances` - an `Instances` value
  Throws:
    `java.lang.Exception` - if an error occurs

### getErrors

    public double getErrors()

  Return the errors made by the naive bayes model at this node

  Returns:
    the number of errors made

### getDiscretizer

    public Discretize getDiscretizer()

  Return the discretizer used at this node

  Returns:
    a `Discretize` value

### getNaiveBayesModel

    public NaiveBayesUpdateable getNaiveBayesModel()

  Get the naive bayes model at this node

  Returns:
    a `NaiveBayesUpdateable` value

### whichSubset

    public final int whichSubset(Instance instance)

  Always returns 0 because only there is only one subset.

  Specified by:
    `whichSubset` in class `ClassifierSplitModel`

### weights

    public final double[] weights(Instance instance)

  Always returns null because there is only one subset.

  Specified by:
    `weights` in class `ClassifierSplitModel`

### leftSide

    public final java.lang.String leftSide(Instances instances)

  Does nothing because no condition has to be satisfied.

  Specified by:
    `leftSide` in class `ClassifierSplitModel`
  Parameters:
    `instances` - the data.

### rightSide

    public final java.lang.String rightSide(int index,
                                            Instances instances)

  Does nothing because no condition has to be satisfied.

  Specified by:
    `rightSide` in class `ClassifierSplitModel`

### sourceExpression

    public final java.lang.String sourceExpression(int index,
                                                   Instances data)

  Returns a string containing java source code equivalent to the test made at this node. The instance being tested is called "i".

  Specified by:
    `sourceExpression` in class `ClassifierSplitModel`
  Parameters:
    `index` - index of the nominal value tested
    `data` - the data containing instance structure info
  Returns:
    a value of type 'String'

### classProb

    public double classProb(int classIndex,
                            Instance instance,
                            int theSubset)
                     throws java.lang.Exception

  Return the probability for a class value

  Overrides:
    `classProb` in class `ClassifierSplitModel`
  Parameters:
    `classIndex` - the index of the class value
    `instance` - the instance to generate a probability for
    `theSubset` - the subset to consider
  Returns:
    a probability
  Throws:
    `java.lang.Exception` - if an error occurs

### toString

    public java.lang.String toString()

  Return a textual description of the node

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    a `String` value

### crossValidate

    public static double crossValidate(NaiveBayesUpdateable fullModel,
                                       Instances trainingSet,
                                       java.util.Random r)
                                throws java.lang.Exception

  Utility method for fast 5-fold cross validation of a naive bayes model

  Parameters:
    `fullModel` - a `NaiveBayesUpdateable` value
    `trainingSet` - an `Instances` value
    `r` - a `Random` value
  Returns:
    a `double` value
  Throws:
    `java.lang.Exception` - if an error occurs

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