|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--weka.classifiers.Classifier | +--weka.classifiers.trees.m5.RuleNode
Constructs a node for use in an m5 tree or rule
Field Summary | |
int |
m_numParameters
the number of paramters in the chosen model for this node---either the subtree model or the linear model. |
Constructor Summary | |
RuleNode(double globalDev,
double globalAbsDev,
RuleNode parent)
Creates a new RuleNode instance. |
Method Summary | |
void |
buildClassifier(Instances data)
Build this node (find an attribute and split point) |
double |
classifyInstance(Instance inst)
Classify an instance using this node. |
void |
findBestLeaf(double[] maxCoverage,
RuleNode[] bestLeaf)
Find the leaf with greatest coverage |
double |
getMinNumInstances()
Get the minimum number of instances to allow at a leaf node |
PreConstructedLinearModel |
getModel()
Get the linear model at this node |
int |
getNumInstances()
Return the number of instances that reach this node. |
boolean |
getRegressionTree()
Get the value of regressionTree. |
void |
graph(java.lang.StringBuffer text)
Assign a unique identifier to each node in the tree and then calls graphTree |
void |
installLinearModels()
Traverses the tree and installs linear models at each node. |
void |
installSmoothedModels()
|
boolean |
isLeaf()
Return true if this node is a leaf |
RuleNode |
leftNode()
Get the left child of this node |
java.lang.String |
nodeToString()
Returns a description of this node (debugging purposes) |
int |
numberOfLinearModels()
Get the number of linear models in the tree |
int |
numLeaves(int leafCounter)
Sets the leaves' numbers |
RuleNode |
parentNode()
Get the parent of this node |
void |
printAllModels()
Print all the linear models at the learf (debugging purposes) |
java.lang.String |
printLeafModels()
print all leaf models |
java.lang.String |
printNodeLinearModel()
print the linear model at this node |
void |
prune()
Recursively prune the tree |
void |
returnLeaves(FastVector[] v)
Return a list containing all the leaves in the tree |
RuleNode |
rightNode()
Get the right child of this node |
void |
setMinNumInstances(double minNum)
Set the minumum number of instances to allow at a leaf node |
void |
setRegressionTree(boolean newregressionTree)
Set the value of regressionTree. |
void |
split()
Finds an attribute and split point for this node |
int |
splitAtt()
Get the index of the splitting attribute for this node |
double |
splitVal()
Get the split point for this node |
java.lang.String |
toString()
print the linear model at this node |
java.lang.String |
treeToString(int level)
Recursively builds a textual description of the tree |
Methods inherited from class weka.classifiers.Classifier |
debugTipText, distributionForInstance, forName, getDebug, getOptions, listOptions, makeCopies, setDebug, setOptions |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
public int m_numParameters
Constructor Detail |
public RuleNode(double globalDev, double globalAbsDev, RuleNode parent)
RuleNode
instance.
globalDev
- the global standard deviation of the classglobalAbsDev
- the global absolute deviation of the classparent
- the parent of this nodeMethod Detail |
public void buildClassifier(Instances data) throws java.lang.Exception
buildClassifier
in class Classifier
data
- the instances on which to build this node
java.lang.Exception
- if an error occurspublic double classifyInstance(Instance inst) throws java.lang.Exception
classifyInstance
in class Classifier
inst
- the instance to classify
java.lang.Exception
- if an error occurspublic void split() throws java.lang.Exception
java.lang.Exception
- if an error occurspublic int numLeaves(int leafCounter)
leafCounter
- the number of leaves counted
public java.lang.String toString()
toString
in class java.lang.Object
public java.lang.String printNodeLinearModel()
public java.lang.String printLeafModels()
public java.lang.String nodeToString()
public java.lang.String treeToString(int level)
level
- the level of this node
public void installLinearModels() throws java.lang.Exception
java.lang.Exception
- if an error occurspublic void installSmoothedModels() throws java.lang.Exception
java.lang.Exception
public void prune() throws java.lang.Exception
java.lang.Exception
- if an error occurspublic void findBestLeaf(double[] maxCoverage, RuleNode[] bestLeaf)
maxCoverage
- the greatest coverage found so farbestLeaf
- the leaf with the greatest coveragepublic void returnLeaves(FastVector[] v)
v
- a single element array containing a vector of leavespublic RuleNode parentNode()
public RuleNode leftNode()
public RuleNode rightNode()
public int splitAtt()
public double splitVal()
public int numberOfLinearModels()
public boolean isLeaf()
public PreConstructedLinearModel getModel()
public int getNumInstances()
public boolean getRegressionTree()
public void setMinNumInstances(double minNum)
minNum
- the minimum number of instancespublic double getMinNumInstances()
double
valuepublic void setRegressionTree(boolean newregressionTree)
newregressionTree
- Value to assign to regressionTree.public void printAllModels()
public void graph(java.lang.StringBuffer text)
text
- a StringBuffer
value
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Copyright (c) 2003 David Lindsay, Computer Learning Research Centre, Dept. Computer Science, Royal Holloway, University of London