|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.classifiers.trees.m5.Rule
Generates a single m5 tree or rule
Field Summary | |
protected static int |
LEFT
|
private int |
m_classIndex
the class index |
private Instances |
m_covered
the instances covered by this rule |
private double |
m_globalAbsDev
the absolute deviation of the class for all the instances |
private double |
m_globalStdDev
the standard deviation of the class for all the instances |
private Instances |
m_instances
the instances covered by this rule |
private RuleNode[] |
m_internalNodes
the corresponding internal nodes. |
private double |
m_minNumInstances
The minimum number of instances to allow at a leaf node |
private Instances |
m_notCovered
the instances not covered by this rule |
private int |
m_numAttributes
the number of attributes |
private int |
m_numCovered
the number of instances covered by this rule |
private int |
m_numInstances
the number of instances in the dataset |
private boolean |
m_regressionTree
Make a regression tree instead of a model tree |
private int[] |
m_relOps
the corresponding relational operators (0 = "<=", 1 = ">") |
private RuleNode |
m_ruleModel
the leaf encapsulating the linear model for this rule |
private boolean |
m_saveInstances
Save instances at each node in an M5 tree for visualization purposes. |
private boolean |
m_smoothPredictions
use the original m5 smoothing procedure |
private int[] |
m_splitAtts
the indexes of the attributes used to split on for this rule |
private double[] |
m_splitVals
the corresponding values of the split points |
protected RuleNode |
m_topOfTree
the top of the m5 tree for this rule |
private boolean |
m_useTree
use a pruned m5 tree rather than make a rule |
private boolean |
m_useUnpruned
Build unpruned tree/rule |
protected static int |
RIGHT
|
Constructor Summary | |
Rule()
Constructor declaration |
Method Summary | |
protected static double |
absDev(int attr,
Instances inst)
Returns the absolute deviation value of the supplied attribute index. |
void |
buildClassifier(Instances data)
Generates a single rule or m5 model tree. |
double |
classifyInstance(Instance instance)
Calculates a prediction for an instance using this rule or M5 model tree |
RuleNode |
getM5RootNode()
|
double |
getMinNumInstances()
Get the minimum number of instances to allow at a leaf node |
boolean |
getRegressionTree()
Get the value of regressionTree. |
boolean |
getSmoothing()
Get whether or not smoothing has been turned on |
boolean |
getUnpruned()
Get whether unpruned tree/rules are being generated |
boolean |
getUseTree()
get whether an m5 tree is being used rather than rules |
private void |
makeRule()
Make the single best rule from a pruned m5 model tree |
Instances |
notCoveredInstances()
Get the instances not covered by this rule |
private java.lang.String |
ruleToString()
Return a description of the rule |
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)
Sets whether instances at each node in an M5 tree should be saved for visualization purposes. |
void |
setSmoothing(boolean s)
Smooth predictions |
void |
setUnpruned(boolean unpruned)
Use unpruned tree/rules |
void |
setUseTree(boolean u)
Use an m5 tree rather than generate rules |
protected static double |
stdDev(int attr,
Instances inst)
Returns the standard deviation value of the supplied attribute index. |
RuleNode |
topOfTree()
Returns the top of the tree. |
java.lang.String |
toString()
Return a description of the m5 tree or rule |
private java.lang.String |
treeToString()
Return a description of the m5 tree |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
protected static int LEFT
protected static int RIGHT
private Instances m_instances
private int m_classIndex
private int m_numAttributes
private int m_numInstances
private int[] m_splitAtts
private double[] m_splitVals
private RuleNode[] m_internalNodes
private int[] m_relOps
private RuleNode m_ruleModel
protected RuleNode m_topOfTree
private double m_globalStdDev
private double m_globalAbsDev
private Instances m_covered
private int m_numCovered
private Instances m_notCovered
private boolean m_useTree
private boolean m_smoothPredictions
private boolean m_saveInstances
private boolean m_regressionTree
private boolean m_useUnpruned
private double m_minNumInstances
Constructor Detail |
public Rule()
Method Detail |
public void buildClassifier(Instances data) throws java.lang.Exception
data
- set of instances serving as training data
java.lang.Exception
- if the rule has not been generated
successfullypublic double classifyInstance(Instance instance) throws java.lang.Exception
if
- a prediction can't be made.
java.lang.Exception
public RuleNode topOfTree()
private void makeRule() throws java.lang.Exception
if
- something goes wrong.
java.lang.Exception
public java.lang.String toString()
private java.lang.String treeToString()
private java.lang.String ruleToString()
public void setUnpruned(boolean unpruned)
unpruned
- true if unpruned tree/rules are to be generatedpublic boolean getUnpruned()
public void setUseTree(boolean u)
u
- true if m5 tree is to be usedpublic boolean getUseTree()
public void setSmoothing(boolean s)
s
- true if smoothing is to be usedpublic boolean getSmoothing()
public Instances notCoveredInstances()
protected static final double stdDev(int attr, Instances inst)
attr
- an attribute indexinst
- the instances
protected static final double absDev(int attr, Instances inst)
attr
- an attribute indexinst
- the instances
protected void setSaveInstances(boolean save)
save
- a boolean
valuepublic boolean getRegressionTree()
public void setRegressionTree(boolean newregressionTree)
newregressionTree
- Value to assign to regressionTree.public void setMinNumInstances(double minNum)
minNum
- the minimum number of instancespublic double getMinNumInstances()
double
valuepublic RuleNode getM5RootNode()
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |