public class ItemSet extends java.lang.Object implements java.io.Serializable, RevisionHandler
| Constructor and Description |
|---|
ItemSet(int totalTrans)
Constructor
|
ItemSet(int[] array)
Contsructor
|
ItemSet(int totalTrans,
int[] array)
Constructor
|
| Modifier and Type | Method and Description |
|---|---|
boolean |
containedBy(Instance instance)
Checks if an instance contains an item set.
|
boolean |
containedByTreatZeroAsMissing(Instance instance)
Checks if an instance contains an item set.
|
int |
counter()
Gets the counter
|
static java.util.ArrayList<java.lang.Object> |
deleteItemSets(java.util.ArrayList<java.lang.Object> itemSets,
int minSupport,
int maxSupport)
Deletes all item sets that don't have minimum support.
|
boolean |
equals(java.lang.Object itemSet)
Tests if two item sets are equal.
|
static java.util.Hashtable<ItemSet,java.lang.Integer> |
getHashtable(java.util.ArrayList<java.lang.Object> itemSets,
int initialSize)
Return a hashtable filled with the given item sets.
|
java.lang.String |
getRevision()
Returns the revision string.
|
int |
hashCode()
Produces a hash code for a item set.
|
int |
itemAt(int k)
Gest the index of the value of the specified attribute
|
int[] |
items()
Gest the item set as an int array
|
static java.util.ArrayList<java.lang.Object> |
mergeAllItemSets(java.util.ArrayList<java.lang.Object> 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 java.util.ArrayList<java.lang.Object> |
pruneItemSets(java.util.ArrayList<java.lang.Object> toPrune,
java.util.Hashtable<ItemSet,java.lang.Integer> kMinusOne)
Prunes a set of (k)-item sets using the given (k-1)-item sets.
|
static void |
pruneRules(java.util.ArrayList<java.lang.Object>[] rules,
double minConfidence)
Prunes a set of rules.
|
void |
setCounter(int count)
Sets the counter
|
void |
setItem(int[] items)
Sets an item sets
|
void |
setItemAt(int value,
int k)
Sets the index of an attribute value
|
static java.util.ArrayList<java.lang.Object> |
singletons(Instances instances)
Converts the header info of the given set of instances into a set of item
sets (singletons).
|
int |
support()
Outputs the support for an item set.
|
java.lang.String |
toString(Instances instances)
Returns the contents of an item set as a string.
|
java.lang.String |
toString(Instances instances,
char outerDelim,
char innerDelim)
Returns the contents of an item set as a delimited string.
|
void |
upDateCounter(Instance instance)
Updates counter of item set with respect to given transaction.
|
static void |
upDateCounters(java.util.ArrayList<java.lang.Object> itemSets,
Instances instances)
Updates counters for a set of item sets and a set of instances.
|
static void |
upDateCountersTreatZeroAsMissing(java.util.ArrayList<java.lang.Object> itemSets,
Instances instances)
Updates counters for a set of item sets and a set of instances.
|
void |
updateCounterTreatZeroAsMissing(Instance instance)
Updates counter of item set with respect to given transaction.
|
public ItemSet(int totalTrans)
totalTrans - the total number of transactions in the datapublic ItemSet(int totalTrans,
int[] array)
totalTrans - the total number of transactions in the dataarray - the attribute values encoded in an int arraypublic ItemSet(int[] array)
array - the item set represented as an int arraypublic boolean containedByTreatZeroAsMissing(Instance instance)
instance - the instance to be testedpublic boolean containedBy(Instance instance)
instance - the instance to be testedpublic static java.util.ArrayList<java.lang.Object> deleteItemSets(java.util.ArrayList<java.lang.Object> itemSets,
int minSupport,
int maxSupport)
maxSupport - the maximum supportitemSets - the set of item sets to be prunedminSupport - the minimum number of transactions to be coveredpublic boolean equals(java.lang.Object itemSet)
equals in class java.lang.ObjectitemSet - another item setpublic static java.util.Hashtable<ItemSet,java.lang.Integer> getHashtable(java.util.ArrayList<java.lang.Object> itemSets, int initialSize)
itemSets - the set of item sets to be used for filling the hash tableinitialSize - the initial size of the hashtablepublic int hashCode()
hashCode in class java.lang.Objectpublic static java.util.ArrayList<java.lang.Object> mergeAllItemSets(java.util.ArrayList<java.lang.Object> itemSets,
int size,
int totalTrans)
totalTrans - thetotal number of transactionsitemSets - the set of (k-1)-item setssize - the value of (k-1)public static java.util.ArrayList<java.lang.Object> pruneItemSets(java.util.ArrayList<java.lang.Object> toPrune,
java.util.Hashtable<ItemSet,java.lang.Integer> kMinusOne)
toPrune - the set of (k)-item sets to be prunedkMinusOne - the (k-1)-item sets to be used for pruningpublic static void pruneRules(java.util.ArrayList<java.lang.Object>[] rules,
double minConfidence)
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 havepublic static java.util.ArrayList<java.lang.Object> singletons(Instances instances) throws java.lang.Exception
instances - the set of instances whose header info is to be usedjava.lang.Exception - if singletons can't be generated successfullypublic int support()
public java.lang.String toString(Instances instances)
instances - contains the relevant header informationpublic java.lang.String toString(Instances instances, char outerDelim, char innerDelim)
instances - contains the relevant header informationouterDelim - the outer delimiterinnerDelim - the inner delimiterpublic void upDateCounter(Instance instance)
instance - the instance to be used for ubdating the counterpublic void updateCounterTreatZeroAsMissing(Instance instance)
instance - the instance to be used for ubdating the counterpublic static void upDateCounters(java.util.ArrayList<java.lang.Object> itemSets,
Instances instances)
itemSets - the set of item sets which are to be updatedinstances - the instances to be used for updating the counterspublic static void upDateCountersTreatZeroAsMissing(java.util.ArrayList<java.lang.Object> itemSets,
Instances instances)
itemSets - the set of item sets which are to be updatedinstances - the instances to be used for updating the counterspublic int counter()
public int[] items()
public int itemAt(int k)
k - the attribute indexpublic void setCounter(int count)
count - the counterpublic void setItem(int[] items)
items - an int array representing an item setpublic void setItemAt(int value,
int k)
value - the inex of the attribute valuek - the index of the attributepublic java.lang.String getRevision()
getRevision in interface RevisionHandler