需要进一步准备我的数据集才能应用apriori算法
只有两列:
第一列为the transaction_id
。
第二列is item_name
,格式为c("" "a" "b" "c"...)
我跑:
rules <- apriori(nz.mb, parameter = list(supp = 0.001, conf = 0.8))
我收到一个错误:
Error in asMethod(object) :
column(s) 2 not logical or a factor. Discretize the columns first.
所以我跑:
nz.mb$item_name <- discretize(nz.mb$item_name)
我收到另一个错误:
Error in min(x, na.rm = TRUE) : invalid 'type' (list) of argument
使用item_name的下一步是什么,以便为apriori正确格式化它?
大多数Apriori实现都支持这样的数据集:a b c d 1 1 1 0表示a,b,c表示1 0 0 1表示a,d是否存在
使用此表单或转到文档并说明支持的数据