public class LabeledItemSet extends ItemSet implements java.io.Serializable, RevisionHandler
Constructor and Description |
---|
LabeledItemSet(int totalTrans,
int classLabel)
Constructor
|
Modifier and Type | Method and Description |
---|---|
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 and have more than
maximum support
|
static Instances |
divide(Instances instances,
boolean invert)
Splits the class attribute away.
|
boolean |
equalCondset(java.lang.Object itemSet)
Compares two item sets
|
boolean |
equals(java.lang.Object itemSet)
Tests if two item sets are equal.
|
java.util.ArrayList<java.lang.Object>[] |
generateRules(double minConfidence,
boolean noPrune)
Generates rules out of item sets
|
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.
|
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 java.util.ArrayList<java.lang.Object> |
singletons(Instances instancesNoClass,
Instances classes)
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.
|
void |
upDateCounter(Instance instanceNoClass,
Instance instanceClass)
Updates counter of item set with respect to given transaction.
|
static void |
upDateCounters(java.util.ArrayList<java.lang.Object> itemSets,
Instances instancesNoClass,
Instances instancesClass)
Updates counter of a specific item set
|
static void |
upDateCountersTreatZeroAsMissing(java.util.ArrayList<LabeledItemSet> itemSets,
Instances instancesNoClass,
Instances instancesClass)
Updates counter of a specific item set
|
void |
upDateCounterTreatZeroAsMissing(Instance instanceNoClass,
Instance instanceClass)
Updates counter of item set with respect to given transaction.
|
containedBy, containedByTreatZeroAsMissing, counter, getItems, getTotalTransactions, hashCode, itemAt, items, pruneRules, setCounter, setItem, setItemAt, singletons, toString, toString, upDateCounter, upDateCounters, upDateCountersTreatZeroAsMissing, updateCounterTreatZeroAsMissing
public LabeledItemSet(int totalTrans, int classLabel)
totalTrans
- the total number of transactionsclassLabel
- the class lebelpublic 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 final boolean equals(java.lang.Object itemSet)
public final boolean equalCondset(java.lang.Object itemSet)
itemSet
- an 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 static java.util.ArrayList<java.lang.Object> mergeAllItemSets(java.util.ArrayList<java.lang.Object> itemSets, int size, int totalTrans)
totalTrans
- the total number of transactionsitemSets
- the set of (k-1)-item setssize
- the value of (k-1)public static Instances divide(Instances instances, boolean invert) throws java.lang.Exception
instances
- the instancesinvert
- flag; if true only the class attribute remains, otherweise
the class attribute is the only attribute that is deleted.java.lang.Exception
- exception if instances cannot be splittedpublic static java.util.ArrayList<java.lang.Object> singletons(Instances instancesNoClass, Instances classes) throws java.lang.Exception
instancesNoClass
- instances without the class attributeclasses
- the values of the class attribute sorted according to
instancesjava.lang.Exception
- if singletons can't be generated successfullypublic 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 final int support()
public final void upDateCounter(Instance instanceNoClass, Instance instanceClass)
instanceNoClass
- instances without the class attributeinstanceClass
- the values of the class attribute sorted according to
instancespublic final void upDateCounterTreatZeroAsMissing(Instance instanceNoClass, Instance instanceClass)
instanceNoClass
- instances without the class attributeinstanceClass
- the values of the class attribute sorted according to
instancespublic static void upDateCounters(java.util.ArrayList<java.lang.Object> itemSets, Instances instancesNoClass, Instances instancesClass)
itemSets
- an item setsinstancesNoClass
- instances without the class attributeinstancesClass
- the values of the class attribute sorted according to
instancespublic static void upDateCountersTreatZeroAsMissing(java.util.ArrayList<LabeledItemSet> itemSets, Instances instancesNoClass, Instances instancesClass)
itemSets
- an item setsinstancesNoClass
- instances without the class attributeinstancesClass
- the values of the class attribute sorted according to
instancespublic final java.util.ArrayList<java.lang.Object>[] generateRules(double minConfidence, boolean noPrune)
minConfidence
- the minimum confidencenoPrune
- flag indicating whether the rules are pruned accoridng to
the minimum confidence valuepublic java.lang.String getRevision()
getRevision
in interface RevisionHandler
getRevision
in class ItemSet