public class Rule extends java.lang.Object implements java.io.Serializable, RevisionHandler
Constructor and Description |
---|
Rule()
Constructor declaration
|
Modifier and Type | Method and Description |
---|---|
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
|
void |
freeNotCoveredInstances()
Free up memory consumed by the set of instances not covered by this rule.
|
RuleNode |
getM5RootNode() |
double |
getMinNumInstances()
Get the minimum number of instances to allow at a leaf node
|
int |
getNumDecimalPlaces()
Get the number of decimal places.
|
boolean |
getRegressionTree()
Get the value of regressionTree.
|
java.lang.String |
getRevision()
Returns the revision string.
|
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
|
Instances |
notCoveredInstances()
Get the instances not covered by this rule
|
void |
setMinNumInstances(double minNum)
Set the minumum number of instances to allow at a leaf node
|
void |
setNumDecimalPlaces(int num)
Set the number of decimal places.
|
void |
setRegressionTree(boolean newregressionTree)
Set the value of regressionTree.
|
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
|
RuleNode |
topOfTree()
Returns the top of the tree.
|
java.lang.String |
toString()
Return a description of the m5 tree or rule
|
public void buildClassifier(Instances data) throws java.lang.Exception
data
- set of instances serving as training datajava.lang.Exception
- if the rule has not been generated successfullypublic double classifyInstance(Instance instance) throws java.lang.Exception
instance
- the instance whos class value is to be predictedjava.lang.Exception
- if a prediction can't be made.public RuleNode topOfTree()
public java.lang.String toString()
toString
in class java.lang.Object
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()
public void freeNotCoveredInstances()
public 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 int getNumDecimalPlaces()
public void setNumDecimalPlaces(int num)
public RuleNode getM5RootNode()
public java.lang.String getRevision()
getRevision
in interface RevisionHandler