Class NBNode

All Implemented Interfaces:
Serializable, LearningNode
Direct Known Subclasses:
NBNodeAdaptive

public class NBNode extends ActiveHNode implements LearningNode, Serializable
Implements a LearningNode that uses a naive Bayes model
Version:
$Revision: 9705 $
Author:
Richard Kirkby (rkirkby@cs.waikato.ac.nz), Mark Hall (mhall{[at]}pentaho{[dot]}com)
See Also:
  • Constructor Details

    • NBNode

      public NBNode(Instances header, double nbWeightThreshold) throws Exception
      Construct a new NBNode
      Parameters:
      header - the instances structure of the data we're learning from
      nbWeightThreshold - the weight mass to see before allowing naive Bayes to predict
      Throws:
      Exception - if a problem occurs
  • Method Details

    • updateNode

      public void updateNode(Instance inst) throws Exception
      Description copied from class: HNode
      Update the node with the supplied instance
      Overrides:
      updateNode in class ActiveHNode
      Parameters:
      inst - the instance to update with
      Throws:
      Exception - if a problem occurs
    • getDistribution

      public double[] getDistribution(Instance inst, Attribute classAtt) throws Exception
      Description copied from class: HNode
      Return a class probability distribution computed from the frequency counts at this node
      Overrides:
      getDistribution in class HNode
      Parameters:
      inst - the instance to get a prediction for
      classAtt - the class attribute
      Returns:
      a class probability distribution
      Throws:
      Exception - if a problem occurs