简体   繁体   English

使用arulesSequences在R中进行cSPADE数据挖掘 - 转换为“事务”格式时出错

[英]cSPADE data mining in R using arulesSequences - Error while converting to “transactions” format

I'm having trouble converting my data into cSPADE compatible format. 我将数据转换为cSPADE兼容格式时遇到问题。

My data frame looks like- 我的数据框看起来像 -

  key type1 type2 type3 A-1 ABC B-2 PQ NA C-3 X NA NA 

When I use, dataset1<- as(dataset, "transactions") and run- 当我使用, dataset1<- as(dataset, "transactions")和运行 -

rules<- cspade(dataset1, parameter = list(support = 0.4), control = list(verbose = TRUE))

It throws an error - 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'的错误Error in cspade(dataset1, parameter = list(support = 0.4), control = list(verbose = TRUE)) : slot transactionInfo: missing 'sequenceID' or 'eventID'

Can anyone please help as to how can the above dataset be converted into the cSPADE compatible format? 任何人都可以请求如何将上述数据集转换为cSPADE兼容格式?

itry with this: itry:

source dataset in this format: 此格式的源数据集:

1 3 A B C
2 2 P Q    
3 1 X

the first column is for the id of sequence, the second columns is for the length of sequence and then the elements of sequences. 第一列用于序列的id,第二列用于序列的长度,然后是序列的元素。 Then: 然后:

data <- read_baskets(con = "./input_file.txt", info = c("sequenceID","eventID","SIZE"))
rules<- cspade(data, parameter = list(support = 0.4), control = list(verbose = TRUE))

let me know if this works. 让我知道这个是否奏效。

This is my output: 这是我的输出:

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.

相关问题 arulesSequences cspade函数:“ file(con,“ r”)中的错误:无法打开连接” - arulesSequences cspade function: “Error in file(con, ”r“) : cannot open the connection” arulesSequences 中的 cspade 函数抛出连接错误 - cspade function in arulesSequences throws connection error cSPADE中带有大数据的R(arulesSequences)的奇数结果。 我可以将numpart强制为1吗? 有风险吗? - Odd results from cSPADE in R (arulesSequences) w/ large data. Can I force numpart to 1? Are there risks? R中的CSPADE方法抛出错误:类“ transactions”的此对象的名称为“ transactionInfo”的插槽不存在 - CSPADE method in R throws ERROR: no slot of name “transactionInfo” for this object of class “transactions” 使用 arulesSequences 包:makebin(data, file) 中的错误:“sid”无效 - using arulesSequences package : Error in makebin(data, file) : 'sid' invalid 运行Cspade-R时系统调用错误 - System Invocation Error when Running Cspade - R 在R中转换为日期格式时出错 - Error while converting to Date format in R 使用R进行Google Analytics(分析)的数据挖掘 - Data Mining of Google Analytics using R 在大型数据集上训练cspade时R崩溃 - R crashes when cspade is trained on a large data set JSON到R进行数据挖掘 - JSON to R for Data Mining
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM