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.
|
int |
counter()
Gets the counter
|
static FastVector |
deleteItemSets(FastVector 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 |
getHashtable(FastVector 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 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 |
pruneItemSets(FastVector toPrune,
java.util.Hashtable kMinusOne)
Prunes a set of (k)-item sets using the given (k-1)-item sets.
|
static void |
pruneRules(FastVector[] 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 FastVector |
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.
|
void |
upDateCounter(Instance instance)
Updates counter of item set with respect to given transaction.
|
static void |
upDateCounters(FastVector itemSets,
Instances instances)
Updates counters for a set of item sets and a set of instances.
|
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 containedBy(Instance instance)
instance
- the instance to be testedpublic static FastVector deleteItemSets(FastVector 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.Object
itemSet
- another item setpublic static java.util.Hashtable getHashtable(FastVector 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.Object
public static FastVector mergeAllItemSets(FastVector itemSets, int size, int totalTrans)
totalTrans
- thetotal number of transactionsitemSets
- the set of (k-1)-item setssize
- the value of (k-1)public static FastVector pruneItemSets(FastVector toPrune, java.util.Hashtable kMinusOne)
toPrune
- the set of (k)-item sets to be prunedkMinusOne
- the (k-1)-item sets to be used for pruningpublic static void pruneRules(FastVector[] 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 FastVector 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 void upDateCounter(Instance instance)
instance
- the instance to be used for ubdating the counterpublic static void upDateCounters(FastVector 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