类 ItemSet
java.lang.Object
weka.associations.ItemSet
- 所有已实现的接口:
Serializable
,RevisionHandler
- 直接已知子类:
AprioriItemSet
,LabeledItemSet
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 the general methods used for item sets in class - and
standard association rule mining.
- 版本:
- $Revision: 1.13 $
- 作者:
- Eibe Frank (eibe@cs.waikato.ac.nz)
- 另请参阅:
-
构造器概要
构造器 -
方法概要
修饰符和类型方法说明boolean
containedBy
(Instance instance) Checks if an instance contains an item set.int
counter()
Gets the counterstatic FastVector
deleteItemSets
(FastVector itemSets, int minSupport, int maxSupport) Deletes all item sets that don't have minimum support.boolean
Tests if two item sets are equal.static Hashtable
getHashtable
(FastVector itemSets, int initialSize) Return a hashtable filled with the given item sets.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 attributeint[]
items()
Gest the item set as an int arraystatic 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, 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 countervoid
setItem
(int[] items) Sets an item setsvoid
setItemAt
(int value, int k) Sets the index of an attribute valuestatic 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.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.
-
构造器详细资料
-
ItemSet
public ItemSet(int totalTrans) Constructor- 参数:
totalTrans
- the total number of transactions in the data
-
ItemSet
public ItemSet(int totalTrans, int[] array) Constructor- 参数:
totalTrans
- the total number of transactions in the dataarray
- the attribute values encoded in an int array
-
ItemSet
public ItemSet(int[] array) Contsructor- 参数:
array
- the item set represented as an int array
-
-
方法详细资料
-
containedBy
Checks if an instance contains an item set.- 参数:
instance
- the instance to be tested- 返回:
- true if the given instance contains this item set
-
deleteItemSets
Deletes all item sets that don't have minimum support.- 参数:
maxSupport
- the maximum supportitemSets
- the set of item sets to be prunedminSupport
- the minimum number of transactions to be covered- 返回:
- the reduced set of item sets
-
equals
Tests if two item sets are equal. -
getHashtable
Return a hashtable filled with the given item sets.- 参数:
itemSets
- the set of item sets to be used for filling the hash tableinitialSize
- the initial size of the hashtable- 返回:
- the generated hashtable
-
hashCode
public int hashCode()Produces a hash code for a item set. -
mergeAllItemSets
Merges all item sets in the set of (k-1)-item sets to create the (k)-item sets and updates the counters.- 参数:
totalTrans
- thetotal number of transactionsitemSets
- the set of (k-1)-item setssize
- the value of (k-1)- 返回:
- the generated (k)-item sets
-
pruneItemSets
Prunes a set of (k)-item sets using the given (k-1)-item sets.- 参数:
toPrune
- the set of (k)-item sets to be prunedkMinusOne
- the (k-1)-item sets to be used for pruning- 返回:
- the pruned set of item sets
-
pruneRules
Prunes a set of rules.- 参数:
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
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.- 参数:
instances
- the set of instances whose header info is to be used- 返回:
- a set of item sets, each containing a single item
- 抛出:
Exception
- if singletons can't be generated successfully
-
support
public int support()Outputs the support for an item set.- 返回:
- the support
-
toString
Returns the contents of an item set as a string.- 参数:
instances
- contains the relevant header information- 返回:
- string describing the item set
-
upDateCounter
Updates counter of item set with respect to given transaction.- 参数:
instance
- the instance to be used for ubdating the counter
-
upDateCounters
Updates counters for a set of item sets and a set of instances.- 参数:
itemSets
- the set of item sets which are to be updatedinstances
- the instances to be used for updating the counters
-
counter
public int counter()Gets the counter- 返回:
- the counter
-
items
public int[] items()Gest the item set as an int array- 返回:
- int array represneting an item set
-
itemAt
public int itemAt(int k) Gest the index of the value of the specified attribute- 参数:
k
- the attribute index- 返回:
- the index of the attribute value
-
setCounter
public void setCounter(int count) Sets the counter- 参数:
count
- the counter
-
setItem
public void setItem(int[] items) Sets an item sets- 参数:
items
- an int array representing an item set
-
setItemAt
public void setItemAt(int value, int k) Sets the index of an attribute value- 参数:
value
- the inex of the attribute valuek
- the index of the attribute
-
getRevision
Returns the revision string.- 指定者:
getRevision
在接口中RevisionHandler
- 返回:
- the revision
-