类 RuleNode

java.lang.Object
weka.classifiers.Classifier
weka.classifiers.trees.m5.RuleNode
所有已实现的接口:
Serializable, Cloneable, CapabilitiesHandler, OptionHandler, RevisionHandler

public class RuleNode extends Classifier
Constructs a node for use in an m5 tree or rule
版本:
$Revision: 1.13 $
作者:
Mark Hall (mhall@cs.waikato.ac.nz)
另请参阅:
  • 字段详细资料

    • m_numParameters

      public int m_numParameters
      the number of paramters in the chosen model for this node---either the subtree model or the linear model. The constant term is counted as a paramter---this is for pruning purposes
  • 构造器详细资料

    • RuleNode

      public RuleNode(double globalDev, double globalAbsDev, RuleNode parent)
      Creates a new RuleNode instance.
      参数:
      globalDev - the global standard deviation of the class
      globalAbsDev - the global absolute deviation of the class
      parent - the parent of this node
  • 方法详细资料

    • buildClassifier

      public void buildClassifier(Instances data) throws Exception
      Build this node (find an attribute and split point)
      指定者:
      buildClassifier 在类中 Classifier
      参数:
      data - the instances on which to build this node
      抛出:
      Exception - if an error occurs
    • classifyInstance

      public double classifyInstance(Instance inst) throws Exception
      Classify an instance using this node. Recursively calls classifyInstance on child nodes.
      覆盖:
      classifyInstance 在类中 Classifier
      参数:
      inst - the instance to classify
      返回:
      the prediction for this instance
      抛出:
      Exception - if an error occurs
    • split

      public void split() throws Exception
      Finds an attribute and split point for this node
      抛出:
      Exception - if an error occurs
    • numLeaves

      public int numLeaves(int leafCounter)
      Sets the leaves' numbers
      参数:
      leafCounter - the number of leaves counted
      返回:
      the number of the total leaves under the node
    • toString

      public String toString()
      print the linear model at this node
      覆盖:
      toString 在类中 Object
      返回:
      the linear model
    • printNodeLinearModel

      public String printNodeLinearModel()
      print the linear model at this node
      返回:
      the linear model at this node
    • printLeafModels

      public String printLeafModels()
      print all leaf models
      返回:
      the leaf models
    • nodeToString

      public String nodeToString()
      Returns a description of this node (debugging purposes)
      返回:
      a string describing this node
    • treeToString

      public String treeToString(int level)
      Recursively builds a textual description of the tree
      参数:
      level - the level of this node
      返回:
      string describing the tree
    • installLinearModels

      public void installLinearModels() throws Exception
      Traverses the tree and installs linear models at each node. This method must be called if pruning is not to be performed.
      抛出:
      Exception - if an error occurs
    • installSmoothedModels

      public void installSmoothedModels() throws Exception
      抛出:
      Exception
    • prune

      public void prune() throws Exception
      Recursively prune the tree
      抛出:
      Exception - if an error occurs
    • findBestLeaf

      public void findBestLeaf(double[] maxCoverage, RuleNode[] bestLeaf)
      Find the leaf with greatest coverage
      参数:
      maxCoverage - the greatest coverage found so far
      bestLeaf - the leaf with the greatest coverage
    • returnLeaves

      public void returnLeaves(FastVector[] v)
      Return a list containing all the leaves in the tree
      参数:
      v - a single element array containing a vector of leaves
    • parentNode

      public RuleNode parentNode()
      Get the parent of this node
      返回:
      the parent of this node
    • leftNode

      public RuleNode leftNode()
      Get the left child of this node
      返回:
      the left child of this node
    • rightNode

      public RuleNode rightNode()
      Get the right child of this node
      返回:
      the right child of this node
    • splitAtt

      public int splitAtt()
      Get the index of the splitting attribute for this node
      返回:
      the index of the splitting attribute
    • splitVal

      public double splitVal()
      Get the split point for this node
      返回:
      the split point for this node
    • numberOfLinearModels

      public int numberOfLinearModels()
      Get the number of linear models in the tree
      返回:
      the number of linear models
    • isLeaf

      public boolean isLeaf()
      Return true if this node is a leaf
      返回:
      true if this node is a leaf
    • getModel

      public PreConstructedLinearModel getModel()
      Get the linear model at this node
      返回:
      the linear model at this node
    • getNumInstances

      public int getNumInstances()
      Return the number of instances that reach this node.
      返回:
      the number of instances at this node.
    • getRegressionTree

      public boolean getRegressionTree()
      Get the value of regressionTree.
      返回:
      Value of regressionTree.
    • setMinNumInstances

      public void setMinNumInstances(double minNum)
      Set the minumum number of instances to allow at a leaf node
      参数:
      minNum - the minimum number of instances
    • getMinNumInstances

      public double getMinNumInstances()
      Get the minimum number of instances to allow at a leaf node
      返回:
      a double value
    • setRegressionTree

      public void setRegressionTree(boolean newregressionTree)
      Set the value of regressionTree.
      参数:
      newregressionTree - Value to assign to regressionTree.
    • printAllModels

      public void printAllModels()
      Print all the linear models at the learf (debugging purposes)
    • graph

      public void graph(StringBuffer text)
      Assign a unique identifier to each node in the tree and then calls graphTree
      参数:
      text - a StringBuffer value
    • getRevision

      public String getRevision()
      Returns the revision string.
      指定者:
      getRevision 在接口中 RevisionHandler
      覆盖:
      getRevision 在类中 Classifier
      返回:
      the revision