全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
3587 4
2018-10-13
救救孩子吧
> library(arules)
载入需要的程辑包:Matrix

载入程辑包:‘arules’

The following objects are masked from ‘package:base’:

    abbreviate, write

> library(arulesViz)
载入需要的程辑包:grid
> dt<-read.table("mba.txt",header=T)
> mba<-as(dt,"transactions")
> rules=apriori(mba,parameter=list(support=0.03,confidence=0.4,minlen=2,maxlen=2))
Apriori

Parameter specification:
confidence minval smax arem  aval originalSupport
        0.4    0.1    1 none FALSE            TRUE
maxtime support minlen maxlen target   ext
       5    0.03      2      2  rules FALSE

Algorithmic control:
filter tree heap memopt load sort verbose
    0.1 TRUE TRUE  FALSE TRUE    2    TRUE

Absolute minimum support count: 5

set item appearances ...[0 item(s)] done [0.00s].
set transactions ...[27 item(s), 179 transaction(s)] done [0.00s].
sorting and recoding items ... [22 item(s)] done [0.00s].
creating transaction tree ... done [0.00s].
checking subsets of size 1 2 done [0.00s].
writing ... [19 rule(s)] done [0.00s].
creating S4 object  ... done [0.00s].
Warning message:
In apriori(mba, parameter = list(support = 0.03, confidence = 0.4,  :
  Mining stopped (maxlen reached). Only patterns up to a length of 2 returned!
> summary(rules)
set of 19 rules

rule length distribution (lhs + rhs):sizes
2
19

   Min. 1st Qu.  Median    Mean 3rd Qu.    Max.
      2       2       2       2       2       2

summary of quality measures:
    support          confidence          lift      
Min.   :0.03352   Min.   :0.4048   Min.   :1.362  
1st Qu.:0.10056   1st Qu.:0.4988   1st Qu.:1.637  
Median :0.16760   Median :0.6122   Median :2.275  
Mean   :0.14760   Mean   :0.6505   Mean   :2.216  
3rd Qu.:0.17318   3rd Qu.:0.7941   3rd Qu.:2.578  
Max.   :0.31844   Max.   :0.9661   Max.   :3.236  
     count      
Min.   : 6.00  
1st Qu.:18.00  
Median :30.00  
Mean   :26.42  
3rd Qu.:31.00  
Max.   :57.00  

mining info:
data ntransactions support confidence
  mba           179    0.03        0.4
> x=sort(subset(rules,subset=lhs%pin%"=TRUE"&rhs%pin%"=TRUE"&lift>=1),by="support")
> inspect(x[1:10])
Error in slot(x, s) : subscript out of bounds

二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

全部回复
2018-10-13 14:02:04
mba.txt (9.8 KB)
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2020-4-15 10:30:35
请问问题解决了吗,我也出现了相同的问题
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2020-4-15 10:30:40
请问问题解决了吗,我也出现了相同的问题
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

2020-4-15 10:30:42
请问问题解决了吗,我也出现了相同的问题
二维码

扫码加我 拉你入群

请注明:姓名-公司-职位

以便审核进群资格,未注明则拒绝

相关推荐
栏目导航
热门文章
推荐文章

分享

扫码加好友,拉您进群
各岗位、行业、专业交流群