Package weka.classifiers.rules
Class JRip.RipperRule
java.lang.Object
weka.classifiers.rules.Rule
weka.classifiers.rules.JRip.RipperRule
- All Implemented Interfaces:
Serializable
,Copyable
,RevisionHandler
,WeightedInstancesHandler
- Enclosing class:
- JRip
This class implements a single rule that predicts specified class.
A rule consists of antecedents "AND"ed together and the consequent (class
value) for the classification. In this class, the Information Gain
(p*[log(p/t) - log(P/T)]) is used to select an antecedent and Reduced Error
Prunning (REP) with the metric of accuracy rate p/(p+n) or (TP+TN)/(P+N) is
used to prune the rule.
- See Also:
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
Removes redundant tests in the rule.copy()
Get a shallow copy of this ruleboolean
Whether the instance covered by this rulegetAntds()
Return the antecedentsdouble
Gets the internal representation of the class label to be predictedReturns the revision string.void
Build one rule using the growing databoolean
hasAntds()
Whether this rule has antecedents, i.e.void
Prune all the possible final sequences of the rule using the pruning data.void
setConsequent
(double cl) Sets the internal representation of the class label to be predicteddouble
size()
the number of antecedents of the rulePrints this rule
-
Constructor Details
-
RipperRule
public RipperRule()Constructor
-
-
Method Details
-
cleanUp
Removes redundant tests in the rule.- Parameters:
data
- an instance object that contains the appropriate header information for the attributes.
-
setConsequent
public void setConsequent(double cl) Sets the internal representation of the class label to be predicted- Parameters:
cl
- the internal representation of the class label to be predicted
-
getConsequent
public double getConsequent()Gets the internal representation of the class label to be predicted- Specified by:
getConsequent
in classRule
- Returns:
- the internal representation of the class label to be predicted
-
copy
Get a shallow copy of this rule -
covers
Whether the instance covered by this rule -
hasAntds
public boolean hasAntds()Whether this rule has antecedents, i.e. whether it is a default rule -
getAntds
Return the antecedents- Returns:
- the vector of antecedents
-
size
public double size()the number of antecedents of the rule -
grow
Build one rule using the growing data -
prune
Prune all the possible final sequences of the rule using the pruning data. The measure used to prune the rule is based on flag given.- Parameters:
pruneData
- the pruning data used to prune the ruleuseWhole
- flag to indicate whether use the error rate of the whole pruning data instead of the data covered
-
toString
Prints this rule- Parameters:
classAttr
- the class attribute in the data- Returns:
- a textual description of this rule
-
getRevision
Returns the revision string.- Returns:
- the revision
-