tidLists-class: Class tidLists - Transaction ID Lists for Items/Itemsets

Description Objects from the Class Slots Methods Author(s) See Also Examples

Description

Transaction ID lists contains a set of lists. Each list is associated with an item/itemset and stores the IDs of the transactions which support the item/itemset. tidLists uses the class ngCMatrix to efficiently store the transaction ID lists as a sparse matrix. Each column in the matrix represents one transaction ID list.

tidLists can be used for different purposes. For some operations (e.g., support counting) it is efficient to coerce a transactions database into tidLists where each list contains the transaction IDs for an item (and the support is given by the length of the list).

The implementation of the Eclat mining algorithm (which uses transaction ID list intersection) can also produce transaction ID lists for the found itemsets as part of the returned itemsets object. These lists can then be used for further computation.

Objects from the Class

Objects are created by Eclat if the eclat function is called with tidLists = TRUE in the ECparameter object, and returned as part of the mined itemsets. Objects can also be created by coercion from an object of class transactions or by calls of the form new("tidLists", ...).

Slots

data:

object of class ngCMatrix.

itemInfo:

a data.frame to store item/itemset labels (see itemMatrix class).

transactionInfo:

a data.frame with vectors of the same length as the number of transactions. Each vector can hold additional information e.g., store transaction IDs or user IDs for each transaction.

Methods

coerce

signature(from = "tidLists", to = "ngCMatrix"); access the sparse matrix representation. In the ngCMatrix each column represents the transaction IDs for one item/itemset.

coerce

signature(from = "tidLists", to = "list")

coerce

signature(from = "list", to = "tidLists")

coerce

signature(from = "tidLists", to = "matrix")

coerce

signature(from = "tidLists", to = "itemMatrix")

coerce

signature(from = "tidLists", to = "transactions")

coerce

signature(from = "itemMatrix", to = "tidLists"); this also coerces from transactions.

coerce

signature(from = "transactions", to = "tidLists")

c

signature(x = "tidLists"); combine.

dim

signature(x = "tidLists"); returns the dimensions of the sparse Matrix representing the tidLists.

dimnames, rownames, colnames

signature(x = "transactions"); returns row (items/itemsets) and column (transactionIDs if available) names.

labels

signature(x = "transactions"); returns the labels for the itemsets in each transaction (see itemMatrix).

inspect

inspect the transaction ID lists.

itemInfo

returns the slot itemInfo.

itemLabels

signature(object = "tidLists"); returns the item labels as a character vector.

labels

signature(x = "transactions"); returns the labels (transaction IDs).

show

signature(object = "tidLists")

summary

signature(object = "tidLists")

transactionInfo

signature(x = "transactions"): returns the slot transactionInfo.

Author(s)

Michael Hahsler

See Also

[-methods, LIST, eclat, image, length, size, ngCMatrix(in Matrix), itemMatrix-class, itemsets-class, transactions-class

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
## Create transaction data set.
data <- list(
  c("a","b","c"),
  c("a","b"),
  c("a","b","d"),
  c("b","e"),
  c("b","c","e"),
  c("a","d","e"),
  c("a","c"),
  c("a","b","d"),
  c("c","e"),
  c("a","b","d","e")
  )
data <- as(data, "transactions")
data

## convert transactions to transaction ID lists
tl <- as(data, "tidLists")
tl 

inspect(tl)
dim(tl)
dimnames(tl)

## inspect visually
image(tl)

## mine itemsets with transaction ID lists
f <- eclat(data, parameter = list(support = 0, tidLists = TRUE))
tl2 <- tidLists(f)
inspect(tl2)

Example output

Loading required package: Matrix

Attaching package: 'arules'

The following objects are masked from 'package:base':

    abbreviate, write

transactions in sparse format with
 10 transactions (rows) and
 5 items (columns)
tidLists in sparse format with
 5 items/itemsets (rows) and
 10 transactions (columns)
  items transationIDs   
1 a     {1,2,3,6,7,8,10}
2 b     {1,2,3,4,5,8,10}
3 c     {1,5,7,9}       
4 d     {3,6,8,10}      
5 e     {4,5,6,9,10}    
[1]  5 10
[[1]]
[1] "a" "b" "c" "d" "e"

[[2]]
NULL

Eclat

parameter specification:
 tidLists support minlen maxlen            target   ext
     TRUE       0      1     10 frequent itemsets FALSE

algorithmic control:
 sparse sort verbose
      7   -2    TRUE

Absolute minimum support count: 0 

Warning in eclat(data, parameter = list(support = 0, tidLists = TRUE)) :
  You chose a very low absolute support count of 0. You might run out of memory! Increase minimum support.

create itemset ... 
set transactions ...[5 item(s), 10 transaction(s)] done [0.00s].
sorting and recoding items ... [5 item(s)] done [0.00s].
creating bit matrix ... [5 row(s), 10 column(s)] done [0.00s].
writing  ... [21 set(s)] done [0.00s].
Creating S4 object  ... done [0.00s].
   items     transationIDs   
1  {b,c,e}   {5}             
2  {a,b,c}   {1}             
3  {a,c}     {1,7}           
4  {b,c}     {1,5}           
5  {c,e}     {5,9}           
6  {a,b,d,e} {10}            
7  {a,d,e}   {6,10}          
8  {b,d,e}   {10}            
9  {a,b,d}   {3,8,10}        
10 {a,d}     {3,6,8,10}      
11 {b,d}     {3,8,10}        
12 {d,e}     {6,10}          
13 {a,b,e}   {10}            
14 {a,e}     {6,10}          
15 {b,e}     {4,5,10}        
16 {a,b}     {1,2,3,8,10}    
17 {a}       {1,2,3,6,7,8,10}
18 {b}       {1,2,3,4,5,8,10}
19 {e}       {4,5,6,9,10}    
20 {d}       {3,6,8,10}      
21 {c}       {1,5,7,9}       

arules documentation built on Nov. 17, 2017, 6:02 a.m.