全部版块 我的主页
论坛 数据科学与人工智能 数据分析与数据科学 R语言论坛
1934 1
2018-10-13
救救孩子吧
这是怎么肥事?怎么改才好?     Error in slot(x, s) : subscript out of bounds
R version 3.5.1 (2018-07-02) -- "Feather Spray"
Copyright (C) 2018 The R Foundation for Statistical Computing
Platform: x86_64-w64-mingw32/x64 (64-bit)

R is free software and comes with ABSOLUTELY NO WARRANTY.
You are welcome to redistribute it under certain conditions.
Type 'license()' or 'licence()' for distribution details.

R is a collaborative project with many contributors.
Type 'contributors()' for more information and
'citation()' on how to cite R or R packages in publications.

Type 'demo()' for some demos, 'help()' for on-line help, or
'help.start()' for an HTML browser interface to help.
Type 'q()' to quit R.

> 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
mba.txt
大小:(9.8 KB)

 马上下载



二维码

扫码加我 拉你入群

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

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

全部回复
2018-10-31 11:35:11
露朱重复发帖啦。。。。。
二维码

扫码加我 拉你入群

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

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

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

分享

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