|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectweka.classifiers.AbstractClassifier
weka.classifiers.trees.m5.RuleNode2
public class RuleNode2
Constructs a node for use in an m5 tree or rule
| Field Summary | |
|---|---|
protected RuleNode2 |
m_left
left child node |
protected int |
m_numInstances
the number of instances reaching this node |
int |
m_numParameters
the number of paramters in the chosen model for this node---either the subtree model or the linear model. |
protected RuleNode2 |
m_right
right child node |
| Fields inherited from class weka.classifiers.AbstractClassifier |
|---|
m_Debug |
| Constructor Summary | |
|---|---|
RuleNode2(double globalDev,
double globalAbsDev,
RuleNode2 parent)
Creates a new RuleNode instance. |
|
| Method Summary | |
|---|---|
protected int |
assignIDs(int lastID)
Assigns a unique identifier to each node in the tree |
void |
buildClassifier(weka.core.Instances data)
Build this node (find an attribute and split point) |
double |
classifyInstance(weka.core.Instance inst)
Classify an instance using this node. |
void |
findBestLeaf(double[] maxCoverage,
RuleNode2[] bestLeaf)
Find the leaf with greatest coverage |
double |
getMinNumInstances()
Get the minimum number of instances to allow at a leaf node |
weka.classifiers.trees.m5.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. |
String |
getRevision()
Returns the revision string. |
void |
graph(StringBuffer text)
Assign a unique identifier to each node in the tree and then calls graphTree |
protected void |
graphTree(StringBuffer text)
Return a dotty style string describing the tree |
void |
installLinearModels()
Traverses the tree and installs linear models at each node. |
void |
installSmoothedModels()
|
boolean |
isLeaf()
Return true if this node is a leaf |
RuleNode2 |
leftNode()
Get the left child of this node |
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 |
RuleNode2 |
parentNode()
Get the parent of this node |
void |
printAllModels()
Print all the linear models at the learf (debugging purposes) |
String |
printLeafModels()
print all leaf models |
String |
printNodeLinearModel()
print the linear model at this node |
void |
prune()
Recursively prune the tree |
void |
returnLeaves(weka.core.FastVector[] v)
Return a list containing all the leaves in the tree |
RuleNode2 |
rightNode()
Get the right child of this node |
protected double |
rootMeanSquaredError()
Get the root mean squared error at 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. |
protected void |
setSaveInstances(boolean save)
Set whether to save instances for visualization purposes. |
protected static double |
smoothingOriginal(double n,
double pred,
double supportPred)
Applies the m5 smoothing procedure to a prediction |
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 |
String |
toString()
print the linear model at this node |
String |
treeToString(int level)
Recursively builds a textual description of the tree |
| Methods inherited from class weka.classifiers.AbstractClassifier |
|---|
debugTipText, distributionForInstance, forName, getCapabilities, getDebug, getOptions, listOptions, makeCopies, makeCopy, runClassifier, setDebug, setOptions |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
|---|
protected int m_numInstances
public int m_numParameters
protected RuleNode2 m_left
protected RuleNode2 m_right
| Constructor Detail |
|---|
public RuleNode2(double globalDev,
double globalAbsDev,
RuleNode2 parent)
RuleNode instance.
globalDev - the global standard deviation of the classglobalAbsDev - the global absolute deviation of the classparent - the parent of this node| Method Detail |
|---|
public void buildClassifier(weka.core.Instances data)
throws Exception
data - the instances on which to build this node
Exception - if an error occurs
public double classifyInstance(weka.core.Instance inst)
throws Exception
classifyInstance in interface weka.classifiers.ClassifierclassifyInstance in class weka.classifiers.AbstractClassifierinst - the instance to classify
Exception - if an error occurs
protected static double smoothingOriginal(double n,
double pred,
double supportPred)
throws Exception
n - number of instances in selected child of this nodepred - the prediction so farsupportPred - the prediction of the linear model at this node
Exception - if an error occurs
public void split()
throws Exception
Exception - if an error occurspublic int numLeaves(int leafCounter)
leafCounter - the number of leaves counted
public String toString()
toString in class Objectpublic String printNodeLinearModel()
public String printLeafModels()
public String nodeToString()
public String treeToString(int level)
level - the level of this node
public void installLinearModels()
throws Exception
Exception - if an error occurs
public void installSmoothedModels()
throws Exception
Exception
public void prune()
throws Exception
Exception - if an error occurs
public void findBestLeaf(double[] maxCoverage,
RuleNode2[] bestLeaf)
maxCoverage - the greatest coverage found so farbestLeaf - the leaf with the greatest coveragepublic void returnLeaves(weka.core.FastVector[] v)
v - a single element array containing a vector of leavespublic RuleNode2 parentNode()
public RuleNode2 leftNode()
public RuleNode2 rightNode()
public int splitAtt()
public double splitVal()
public int numberOfLinearModels()
public boolean isLeaf()
protected double rootMeanSquaredError()
public weka.classifiers.trees.m5.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()
protected int assignIDs(int lastID)
lastID - last id number used
public void graph(StringBuffer text)
text - a StringBuffer valueprotected void graphTree(StringBuffer text)
text - a StringBuffer valueprotected void setSaveInstances(boolean save)
save - a boolean valuepublic String getRevision()
getRevision in interface weka.core.RevisionHandlergetRevision in class weka.classifiers.AbstractClassifier
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||