public class RuleGeneration extends java.lang.Object implements java.io.Serializable, RevisionHandler
The implementation follows the paper expect for adding a rule to the output of the n best rules. A rule is added if: the expected predictive accuracy of this rule is among the n best and it is not subsumed by a rule with at least the same expected predictive accuracy (out of an unpublished manuscript from T. Scheffer).
Constructor and Description |
---|
RuleGeneration(ItemSet itemSet)
Constructor
|
Modifier and Type | Method and Description |
---|---|
static boolean |
aSubsumesB(RuleItem a,
RuleItem b)
Methods that decides whether or not rule a subsumes rule b.
|
static double |
binomialDistribution(double accuracy,
double ruleCount,
double premiseCount)
calculates the probability using a binomial distribution.
|
boolean |
change()
Gets if the list fo the best rules has been changed
|
int |
count()
Gets the actual maximum value of the generation time
|
static double |
expectation(double ruleCount,
int premiseCount,
double[] midPoints,
java.util.Hashtable priors)
calculates the expected predctive accuracy of a rule
|
java.util.TreeSet |
generateRules(int numRules,
double[] midPoints,
java.util.Hashtable priors,
double expectation,
Instances instances,
java.util.TreeSet best,
int genTime)
Generates all rules for an item set.
|
java.lang.String |
getRevision()
Returns the revision string.
|
boolean |
removeRedundant(RuleItem toInsert)
Method that removes redundant rules out of the list of the best rules.
|
static FastVector |
singleConsequence(Instances instances,
int attNum,
FastVector consequences)
generates a consequence of length 1 for an association rule.
|
public RuleGeneration(ItemSet itemSet)
itemSet
- item set for that rules should be generated.
The item set will form the premise of the rules.public static final double binomialDistribution(double accuracy, double ruleCount, double premiseCount)
accuracy
- the accuracy valueruleCount
- the support of the whole rulepremiseCount
- the support of the premisepublic static final double expectation(double ruleCount, int premiseCount, double[] midPoints, java.util.Hashtable priors)
ruleCount
- the support of the rulepremiseCount
- the premise support of the rulemidPoints
- array with all mid pointspriors
- hashtable containing the prior probabilitiespublic java.util.TreeSet generateRules(int numRules, double[] midPoints, java.util.Hashtable priors, double expectation, Instances instances, java.util.TreeSet best, int genTime)
numRules
- the number of association rules the use wants to mine.
This number equals the size n of the list of the
best rules.midPoints
- the mid points of the intervalspriors
- Hashtable that contains the prior probabilitiesexpectation
- the minimum value of the expected predictive accuracy
that is needed to get into the list of the best rulesinstances
- the instances for which association rules are generatedbest
- the list of the n best rules.
The list is implemented as a TreeSetgenTime
- the maximum time of generationpublic static boolean aSubsumesB(RuleItem a, RuleItem b)
a
- an association rule stored as a RuleItemb
- an association rule stored as a RuleItempublic static FastVector singleConsequence(Instances instances, int attNum, FastVector consequences)
instances
- the instances under considerationattNum
- an item that does not occur in the premiseconsequences
- FastVector that possibly already contains other consequences of length 1public boolean removeRedundant(RuleItem toInsert)
toInsert
- the rule that should be inserted into the listpublic int count()
public boolean change()
public java.lang.String getRevision()
getRevision
in interface RevisionHandler