All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home

Class weka.classifiers.trees.m5.RuleNode

java.lang.Object
    |
    +----weka.classifiers.Classifier
            |
            +----weka.classifiers.trees.m5.RuleNode

public class RuleNode
extends Classifier
Constructs a node for use in an m5 tree or rule

Version:
$Revision: 1.5 $
Author:
Mark Hall (mhall@cs.waikato.ac.nz)

Variable Index

 o m_numParameters
the number of paramters in the chosen model for this node---either the subtree model or the linear model.

Constructor Index

 o RuleNode(double, double, RuleNode)
Creates a new RuleNode instance.

Method Index

 o buildClassifier(Instances)
Build this node (find an attribute and split point)
 o classifyInstance(Instance)
Classify an instance using this node.
 o findBestLeaf(double[], RuleNode[])
Find the leaf with greatest coverage
 o getMinNumInstances()
Get the minimum number of instances to allow at a leaf node
 o getRegressionTree()
Get the value of regressionTree.
 o getSmoothing()
Method declaration
 o installLinearModels()
Traverses the tree and installs linear models at each node.
 o leftNode()
Get the left child of this node
 o nodeToString()
Returns a description of this node (debugging purposes)
 o numberOfLinearModels()
Get the number of linear models in the tree
 o numLeaves(int)
Sets the leaves' numbers
 o parentNode()
Get the parent of this node
 o printAllModels()
Print all the linear models at the learf (debugging purposes)
 o printLeafModels()
print all leaf models
 o printNodeLinearModel()
print the linear model at this node
 o prune()
Recursively prune the tree
 o returnLeaves(FastVector[])
Return a list containing all the leaves in the tree
 o rightNode()
Get the right child of this node
 o setMinNumInstances(double)
Set the minumum number of instances to allow at a leaf node
 o setRegressionTree(boolean)
Set the value of regressionTree.
 o setSmoothing(boolean)
Get if smoothing is being used
 o split()
Finds an attribute and split point for this node
 o splitAtt()
Get the index of the splitting attribute for this node
 o splitVal()
Get the split point for this node
 o toString()
print the linear model at this node
 o treeToString(int)
Recursively builds a textual description of the tree

Field Detail

 o 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

Constructor Detail

 o RuleNode
public RuleNode(double globalDev,
                double globalAbsDev,
                RuleNode parent)
          Creates a new RuleNode instance.
Parameters:
globalDev - the global standard deviation of the class
globalAbsDev - the global absolute deviation of the class
parent - the parent of this node

Method Detail

 o buildClassifier
public void buildClassifier(Instances data) throws java.lang.Exception
          Build this node (find an attribute and split point)
Parameters:
data - the instances on which to build this node
Throws:
java.lang.Exception - if an error occurs
Overrides:
buildClassifier in class Classifier
 o classifyInstance
public double classifyInstance(Instance inst) throws java.lang.Exception
          Classify an instance using this node. Recursively calls classifyInstance on child nodes.
Parameters:
inst - the instance to classify
Returns:
the prediction for this instance
Throws:
java.lang.Exception - if an error occurs
Overrides:
classifyInstance in class Classifier
 o split
public void split() throws java.lang.Exception
          Finds an attribute and split point for this node
Throws:
java.lang.Exception - if an error occurs
 o numLeaves
public int numLeaves(int leafCounter)
          Sets the leaves' numbers
Parameters:
leafCounter - the number of leaves counted
Returns:
the number of the total leaves under the node
 o toString
public java.lang.String toString()
          print the linear model at this node
Overrides:
toString in class java.lang.Object
 o printNodeLinearModel
public java.lang.String printNodeLinearModel()
          print the linear model at this node
 o printLeafModels
public java.lang.String printLeafModels()
          print all leaf models
 o nodeToString
public java.lang.String nodeToString()
          Returns a description of this node (debugging purposes)
Returns:
a string describing this node
 o treeToString
public java.lang.String treeToString(int level)
          Recursively builds a textual description of the tree
Parameters:
level - the level of this node
Returns:
string describing the tree
 o installLinearModels
public void installLinearModels() throws java.lang.Exception
          Traverses the tree and installs linear models at each node. This method must be called if pruning is not to be performed.
Throws:
java.lang.Exception - if an error occurs
 o prune
public void prune() throws java.lang.Exception
          Recursively prune the tree
Throws:
java.lang.Exception - if an error occurs
 o findBestLeaf
public void findBestLeaf(double maxCoverage[],
                         RuleNode bestLeaf[])
          Find the leaf with greatest coverage
Parameters:
maxCoverage - the greatest coverage found so far
bestLeaf - the leaf with the greatest coverage
 o returnLeaves
public void returnLeaves(FastVector v[])
          Return a list containing all the leaves in the tree
Parameters:
v - a single element array containing a vector of leaves
 o parentNode
public RuleNode parentNode()
          Get the parent of this node
Returns:
the parent of this node
 o leftNode
public RuleNode leftNode()
          Get the left child of this node
Returns:
the left child of this node
 o rightNode
public RuleNode rightNode()
          Get the right child of this node
Returns:
the right child of this node
 o splitAtt
public int splitAtt()
          Get the index of the splitting attribute for this node
Returns:
the index of the splitting attribute
 o splitVal
public double splitVal()
          Get the split point for this node
Returns:
the split point for this node
 o numberOfLinearModels
public int numberOfLinearModels()
          Get the number of linear models in the tree
Returns:
the number of linear models
 o setSmoothing
public void setSmoothing(boolean s)
          Get if smoothing is being used
Parameters:
s - true if smoothing is being used
 o getSmoothing
public boolean getSmoothing()
          Method declaration
Returns:
true if smoothing has been selected.
 o getRegressionTree
public boolean getRegressionTree()
          Get the value of regressionTree.
Returns:
Value of regressionTree.
 o setMinNumInstances
public void setMinNumInstances(double minNum)
          Set the minumum number of instances to allow at a leaf node
Parameters:
minNum - the minimum number of instances
 o getMinNumInstances
public double getMinNumInstances()
          Get the minimum number of instances to allow at a leaf node
Returns:
a double value
 o setRegressionTree
public void setRegressionTree(boolean newregressionTree)
          Set the value of regressionTree.
Parameters:
newregressionTree - Value to assign to regressionTree.
 o printAllModels
public void printAllModels()
          Print all the linear models at the learf (debugging purposes)

All Packages  Class Hierarchy  This Package  Previous  Next  Index  WEKA's home