|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectweka.associations.ItemSet
weka.associations.AprioriItemSet
Class for storing a set of items. Item sets are stored in a lexicographic order, which is determined by the header information of the set of instances used for generating the set of items. All methods in this class assume that item sets are stored in lexicographic order. The class provides methods that are used in the Apriori algorithm to construct association rules.
Constructor Summary | |
AprioriItemSet(int totalTrans)
Constructor |
Method Summary | |
static double |
confidenceForRule(AprioriItemSet premise,
AprioriItemSet consequence)
Outputs the confidence for a rule. |
double |
convictionForRule(AprioriItemSet premise,
AprioriItemSet consequence,
int premiseCount,
int consequenceCount)
Outputs the conviction for a rule. |
FastVector[] |
generateRules(double minConfidence,
FastVector hashtables,
int numItemsInSet)
Generates all rules for an item set. |
FastVector[] |
generateRulesBruteForce(double minMetric,
int metricType,
FastVector hashtables,
int numItemsInSet,
int numTransactions,
double significanceLevel)
Generates all significant rules for an item set. |
double |
leverageForRule(AprioriItemSet premise,
AprioriItemSet consequence,
int premiseCount,
int consequenceCount)
Outputs the leverage for a rule. |
double |
liftForRule(AprioriItemSet premise,
AprioriItemSet consequence,
int consequenceCount)
Outputs the lift for a rule. |
static FastVector |
mergeAllItemSets(FastVector itemSets,
int size,
int totalTrans)
Merges all item sets in the set of (k-1)-item sets to create the (k)-item sets and updates the counters. |
static FastVector |
singletons(Instances instances)
Converts the header info of the given set of instances into a set of item sets (singletons). |
AprioriItemSet |
subtract(AprioriItemSet toSubtract)
Subtracts an item set from another one. |
java.lang.String |
toString(Instances instances)
Returns the contents of an item set as a string. |
Methods inherited from class weka.associations.ItemSet |
containedBy, counter, deleteItemSets, equals, getHashtable, hashCode, itemAt, items, pruneItemSets, pruneRules, setCounter, setItem, setItemAt, support, upDateCounter, upDateCounters |
Methods inherited from class java.lang.Object |
getClass, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public AprioriItemSet(int totalTrans)
totalTrans
- the total number of transactions in the dataMethod Detail |
public static double confidenceForRule(AprioriItemSet premise, AprioriItemSet consequence)
premise
- the premise of the ruleconsequence
- the consequence of the rule
public double liftForRule(AprioriItemSet premise, AprioriItemSet consequence, int consequenceCount)
premise
- the premise of the ruleconsequence
- the consequence of the ruleconsequenceCount
- how many times the consequence occurs independent
of the premise
public double leverageForRule(AprioriItemSet premise, AprioriItemSet consequence, int premiseCount, int consequenceCount)
premise
- the premise of the ruleconsequence
- the consequence of the rulepremiseCount
- how many times the premise occurs independent
of the consequentconsequenceCount
- how many times the consequence occurs independent
of the premise
public double convictionForRule(AprioriItemSet premise, AprioriItemSet consequence, int premiseCount, int consequenceCount)
premise
- the premise of the ruleconsequence
- the consequence of the rulepremiseCount
- how many times the premise occurs independent
of the consequentconsequenceCount
- how many times the consequence occurs independent
of the premise
public FastVector[] generateRules(double minConfidence, FastVector hashtables, int numItemsInSet)
minConfidence
- the minimum confidence the rules have to havehashtables
- containing all(!) previously generated
item setsnumItemsInSet
- the size of the item set for which the rules
are to be generated
public final FastVector[] generateRulesBruteForce(double minMetric, int metricType, FastVector hashtables, int numItemsInSet, int numTransactions, double significanceLevel) throws java.lang.Exception
minMetric
- the minimum metric (confidence, lift, leverage,
improvement) the rules have to havemetricType
- (confidence=0, lift, leverage, improvement)hashtables
- containing all(!) previously generated
item setsnumItemsInSet
- the size of the item set for which the rules
are to be generated
java.lang.Exception
- if something goes wrongpublic final AprioriItemSet subtract(AprioriItemSet toSubtract)
toSubtract
- the item set to be subtracted from this one.
public final java.lang.String toString(Instances instances)
toString
in class ItemSet
instances
- contains the relevant header information
public static FastVector singletons(Instances instances) throws java.lang.Exception
instances
- the set of instances whose header info is to be used
java.lang.Exception
- if singletons can't be generated successfullypublic static FastVector mergeAllItemSets(FastVector itemSets, int size, int totalTrans)
itemSets
- the set of (k-1)-item setssize
- the value of (k-1)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |