我有一个包含20行和10列的数字矩阵,我想应用apriori,但是如何区分这些数据以及如何将其转换为事务?数据集包含行名和列名。 它是否正确?
library("arules")
write(mat, file = "deee.csv", sep = ",")
tr <- read.transactions("deee.csv")
apriori_rule <- apriori(tr, parameter = list(supp = 0.1, conf = 0.1))
我的数据矩阵:
A B C D
t1 6.960722 7.095137 7.165269 7.377422
t2 8.305320 8.215023 8.690460 8.346847
t3 …..
T1,T2,T3:是交易 A,B和C是属性, 数值是事务(行)中属性的值。
答案 0 :(得分:0)
将矩阵强制转换为as.data.frame
(使用discretize()
),然后在调用apriori之前使用Private WithEvents MyExplorers As Outlook.Explorers
' Assign each MyExplorers instance with an ID, say oEXP1, oEXP2, oEXP3, ...
Private WithEvents MyItem As Outlook.Items
Private Sub MyItem_ItemAdd(ByVal Item As Object)
' this event runs only when oExp1 exists (active or not active)
End Sub
Private Sub Macro1()
' this macro can run only when oEXP2 exists
End Sub
Private Sub Macro2()
' this macro can run only when oEXP3 exists
End Sub
。