All Packages Class Hierarchy This Package Previous Next Index WEKA's home
Class weka.associations.ItemSet
java.lang.Object
|
+----weka.associations.ItemSet
- public class ItemSet
- extends Object
- implements Serializable
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.
- Version:
- $Revision: 1.3 $
- Author:
- Eibe Frank (eibe@cs.waikato.ac.nz)
-
ItemSet()
-
-
confidenceForRule(ItemSet, ItemSet)
- Outputs the confidence for a rule.
-
containedBy(Instance)
- Checks if an instance contains an item set.
-
deleteItemSets(FastVector, int)
- Deletes all item sets that don't have minimum support.
-
equals(Object)
- Tests if two item sets are equal.
-
generateRules(double, FastVector, int)
- Generates all rules for an item set.
-
generateRulesBruteForce(double, FastVector, int, int, double)
- Generates all significant rules for an item set.
-
getHashtable(FastVector, int)
- Return a hashtable filled with the given item sets.
-
hashCode()
- Produces a hash code for a item set.
-
mergeAllItemSets(FastVector, int)
- Merges all item sets in the set of (k-1)-item sets
to create the (k)-item sets and updates the counters.
-
pruneItemSets(FastVector, Hashtable)
- Prunes a set of (k)-item sets using the given (k-1)-item sets.
-
pruneRules(FastVector[], double)
- Prunes a set of rules.
-
singletons(Instances)
- Converts the header info of the given set of instances into a set
of item sets (singletons).
-
subtract(ItemSet)
- Subtracts an item set from another one.
-
support()
- Outputs the support for an item set.
-
toString(Instances)
- Returns the contents of an item set as a string.
-
upDateCounter(Instance)
- Updates counter of item set with respect to given transaction.
-
upDateCounters(FastVector, Instances)
- Updates counters for a set of item sets and a set of instances.
ItemSet
public ItemSet()
confidenceForRule
public static double confidenceForRule(ItemSet premise,
ItemSet consequence)
- Outputs the confidence for a rule.
- Parameters:
- premise - the premise of the rule
- consequence - the consequence of the rule
- Returns:
- the confidence on the training data
containedBy
public final boolean containedBy(Instance instance)
- Checks if an instance contains an item set.
- Parameters:
- instance - the instance to be tested
- Returns:
- true if the given instance contains this item set
deleteItemSets
public static FastVector deleteItemSets(FastVector itemSets,
int minSupport)
- Deletes all item sets that don't have minimum support.
- Parameters:
- itemSets - the set of item sets to be pruned
- minSupport - the minimum number of transactions to be covered
- Returns:
- the reduced set of item sets
equals
public final boolean equals(Object itemSet)
- Tests if two item sets are equal.
- Parameters:
- itemSet - another item set
- Returns:
- true if this item set contains the same items as the given one
- Overrides:
- equals in class Object
generateRules
public final FastVector[] generateRules(double minConfidence,
FastVector hashtables,
int numItemsInSet)
- Generates all rules for an item set.
- Parameters:
- minConfidence - the minimum confidence the rules have to have
- hashtables - containing all(!) previously generated
item sets
- numItemsInSet - the size of the item set for which the rules
are to be generated
- Returns:
- all the rules with minimum confidence for the given item set
generateRulesBruteForce
public final FastVector[] generateRulesBruteForce(double minConfidence,
FastVector hashtables,
int numItemsInSet,
int numTransactions,
double significanceLevel)
- Generates all significant rules for an item set.
- Parameters:
- minConfidence - the minimum confidence the rules have to have
- hashtables - containing all(!) previously generated
item sets
- numItemsInSet - the size of the item set for which the rules
are to be generated
- the - significance level for testing the rules
- Returns:
- all the rules with minimum confidence for the given item set
getHashtable
public static Hashtable getHashtable(FastVector itemSets,
int initialSize)
- Return a hashtable filled with the given item sets.
- Parameters:
- itemSets - the set of item sets to be used for filling the hash table
- initialSize - the initial size of the hashtable
- Returns:
- the generated hashtable
hashCode
public final int hashCode()
- Produces a hash code for a item set.
- Returns:
- a hash code for a set of items
- Overrides:
- hashCode in class Object
mergeAllItemSets
public static FastVector mergeAllItemSets(FastVector itemSets,
int size)
- Merges all item sets in the set of (k-1)-item sets
to create the (k)-item sets and updates the counters.
- Parameters:
- itemSets - the set of (k-1)-item sets
- size - the value of (k-1)
- Returns:
- the generated (k)-item sets
pruneItemSets
public static FastVector pruneItemSets(FastVector toPrune,
Hashtable kMinusOne)
- Prunes a set of (k)-item sets using the given (k-1)-item sets.
- Parameters:
- toPrune - the set of (k)-item sets to be pruned
- kMinusOne - the (k-1)-item sets to be used for pruning
- Returns:
- the pruned set of item sets
pruneRules
public static void pruneRules(FastVector rules[],
double minConfidence)
- Prunes a set of rules.
- Parameters:
- rules - a two-dimensional array of lists of item sets. The first list
of item sets contains the premises, the second one the consequences.
- minConfidence - the minimum confidence the rules have to have
singletons
public static FastVector singletons(Instances instances) throws Exception
- Converts the header info of the given set of instances into a set
of item sets (singletons). The ordering of values in the header file
determines the lexicographic order.
- Parameters:
- instances - the set of instances whose header info is to be used
- Returns:
- a set of item sets, each containing a single item
- Throws: Exception
- if singletons can't be generated successfully
subtract
public final ItemSet subtract(ItemSet toSubtract)
- Subtracts an item set from another one.
- Parameters:
- toSubtract - the item set to be subtracted from this one.
- Returns:
- an item set that only contains items form this item sets that
are not contained by toSubtract
support
public final int support()
- Outputs the support for an item set.
- Returns:
- the support
toString
public final String toString(Instances instances)
- Returns the contents of an item set as a string.
- Parameters:
- instances - contains the relevant header information
- Returns:
- string describing the item set
upDateCounter
public final void upDateCounter(Instance instance)
- Updates counter of item set with respect to given transaction.
- Parameters:
- instance - the instance to be used for ubdating the counter
upDateCounters
public static void upDateCounters(FastVector itemSets,
Instances instances)
- Updates counters for a set of item sets and a set of instances.
- Parameters:
- itemSets - the set of item sets which are to be updated
- instances - the instances to be used for updating the counters
All Packages Class Hierarchy This Package Previous Next Index WEKA's home