0
$\begingroup$

Suppose that I am performing Sequential Pattern Mining (maxgap = 1, i.e. rules for consecutive windows) and I ran the following code from arulesSequences in R Studio to determine significant rules from my dataset:

trans_matrix <- read_baskets("Data.txt", sep = ";", info = c("sequenceID","eventID", "size"))
s1 <- cspade(trans_matrix, parameter = list(support = 0.05, maxgap = 1, maxlen = 5), control = list(verbose = TRUE))
r1 <- as(ruleInduction(s1, confidence = 0.5, control = list(verbose = TRUE)), "data.frame")

I now have a set of rules with their corresponding support, confidence and lift. Are there any codes that allow me to apply these rules on the dataset and allow the algorithm to predict the next "step"?

For example:

User   Period1 Period2 Period3 Period4 Period5 ... Period10 Period11
John   A       B       B       C       A           D        ?
Mary   A       D       D       C       A           C        ?
Jacob  D       D       ?
Jenny  A       C       B       B       ?

I want to write a code that allows me to use r1 above to predict Period11 for John and Mary, Period 3 for Jacob, Period 5 for Jenny etc (i.e. something similar to the predict function for regression). Are there any functions in arulesSequence for this purpose?

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.