Class “Patterns” —

Description

The Patterns class represents frequent itemsets found by a frequent pattern mining DSTs, such as DST_EstDec.

Slots

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.

data:

object of class ngCMatrix to store the binary incidence matrix (see itemMatrix class)

itemInfo:

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

Methods

as.itemsets

signature(patterns, ...); produces an itemsets object from the arules package.

as.vector

signature(patterns, ...); produces a vector of counts with itemsets as names.

getSets

signature(patterns); produces a list of the itemsets countained in the Patterns class, with each itemset represented by a vector of item.

summary

signature(patterns); shows a summary of the Patterns class.

topN

signature(patterns, n = 1); returns a vector of the top n most frequent itemsets.

print

signature(patterns); represents the itemsets in a printable form

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
#create datastream
dsd <- DSD_Transactions_Random(setSize=10, maxTransactionSize=4)
#create estDec
dst <- DST_EstDec(datatype = "integer")
#update estDec with new values from data stream
update(dst, dsd, 20)

#get most frequent itemsets from the DST
patterns <- get_patterns(dst)

#show a summary of the patterns
summary(patterns)

#coerce the patterns into a list of vectors
as.vector(patterns)

#coerce into arules itemsets
library(arules)
as.itemsets(patterns)

#get the top ten most frequent patterns
topN(patterns, n=10)