
cspade(data, parameter = NULL, control = NULL, tmpdir = tempdir())
transactions
with
temporal information.SPparameter
or a named list with corresponding components.SPcontrol
or a named list with corresponding components.sequences
. The temporal information is taken from components sequenceID
(sequence or customer identifier) and eventID
(event identifier)
of slot transactionInfo
. Both identifiers must be in (blockwise)
ascending order.
Class information (on sequences or customers) is taken from component
classID
, if available.
The amount of disk space used by temporary files is reported in
verbose mode (see class
).
The utility function read_baskets
provides for reading
of text files with temporal transaction data.
transactions
,
sequences
,
SPparameter
,
SPcontrol
,
method
ruleInduction
,
function
read_baskets
.## use example data from paper
data(zaki)
## mine frequent sequences
s1 <- cspade(zaki, parameter = list(support = 0.4),
control = list(verbose = TRUE, tidLists = TRUE))
summary(s1)
as(s1, "data.frame")
##
summary(tidLists(s1))
transactionInfo(tidLists(s1))
## use timing constraint
s2 <- cspade(zaki, parameter = list(support = 0.4, maxwin = 5))
as(s2, "data.frame")
## use classification
t <- zaki
transactionInfo(t)$classID <-
transactionInfo(t)$sequenceID %% 2 + 1L
s3 <- cspade(t, parameter = list(support = 0.4, maxwin = 5))
as(s3, "data.frame")
## replace timestamps
t <- zaki
transactionInfo(t)$eventID <-
unlist(tapply(seq(t), transactionInfo(t)$sequenceID,
function(x) x - min(x) + 1), use.names = FALSE)
as(t, "data.frame")
s0 <- cspade(t, parameter = list(support = 0.4))
s0
identical(as(s1, "data.frame"), as(s0, "data.frame"))
## use generated data
t <- read_baskets(con = system.file("misc", "test.txt", package =
"arulesSequences"),
info = c("sequenceID","eventID","SIZE"))
summary(t)
## use low support
s3 <- cspade(t, parameter = list(support=0.03),
control = list(verbose=TRUE))
summary(s3)
Run the code above in your browser using DataLab