![](/img/trans.png)
[英]arulesSequences cspade function: “Error in file(con, ”r“) : cannot open the connection”
[英]cSPADE data mining in R using arulesSequences - Error while converting to “transactions” format
我將數據轉換為cSPADE兼容格式時遇到問題。
我的數據框看起來像 -
key type1 type2 type3 A-1 ABC B-2 PQ NA C-3 X NA NA
當我使用, dataset1<- as(dataset, "transactions")
和運行 -
rules<- cspade(dataset1, parameter = list(support = 0.4), control = list(verbose = TRUE))
它拋出一個錯誤 - Error in cspade(dataset1, parameter = list(support = 0.4), control = list(verbose = TRUE)) : slot transactionInfo: missing 'sequenceID' or 'eventID'
的錯誤Error in cspade(dataset1, parameter = list(support = 0.4), control = list(verbose = TRUE)) : slot transactionInfo: missing 'sequenceID' or 'eventID'
任何人都可以請求如何將上述數據集轉換為cSPADE兼容格式?
itry:
此格式的源數據集:
1 3 A B C
2 2 P Q
3 1 X
第一列用於序列的id,第二列用於序列的長度,然后是序列的元素。 然后:
data <- read_baskets(con = "./input_file.txt", info = c("sequenceID","eventID","SIZE"))
rules<- cspade(data, parameter = list(support = 0.4), control = list(verbose = TRUE))
讓我知道這個是否奏效。
這是我的輸出:
parameter specification:
support : 0.4
maxsize : 10
maxlen : 10
algorithmic control:
bfstype : FALSE
verbose : TRUE
summary : FALSE
tidLists : FALSE
preprocessing ... 1 partition(s), 0 MB [0.1s]
mining transactions ... 0 MB [0.06s]
reading sequences ... [0s]
total elapsed time: 0.16s
> inspect(rules)
items support
1 <{B}> 0.3333333
2 <{C}> 0.3333333
3 <{Q}> 0.3333333
4 <{B,
C}> 0.3333333
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.