R패키지 arules


개요

R패키지 arules
#install.packages("arules")
library(arules)
data("Adult")
Adult
#transactions in sparse format with
# 48842 transactions (rows) and
# 115 items (columns)

rules <- apriori(Adult, parameter = list(supp = 0.5, conf = 0.9, target = "rules"))
if(0)"
Apriori

Parameter specification:
confidence minval smax arem  aval originalSupport maxtime support
0.9    0.1    1 none FALSE            TRUE       5     0.5
minlen maxlen target   ext
1     10  rules FALSE

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

Absolute minimum support count: 24421 

set item appearances ...[0 item(s)] done [0.00s].
set transactions ...[115 item(s), 48842 transaction(s)] done [0.03s].
sorting and recoding items ... [9 item(s)] done [0.00s].
creating transaction tree ... done [0.02s].
checking subsets of size 1 2 3 4 done [0.00s].
writing ... [52 rule(s)] done [0.00s].
creating S4 object  ... done [0.00s].
"

summary(rules)
if(0)"
set of 52 rules

rule length distribution (lhs + rhs):sizes
1  2  3  4 
2 13 24 13 

Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
1.000   2.000   3.000   2.923   3.250   4.000 

summary of quality measures:
support         confidence          lift            count      
Min.   :0.5084   Min.   :0.9031   Min.   :0.9844   Min.   :24832  
1st Qu.:0.5415   1st Qu.:0.9155   1st Qu.:0.9937   1st Qu.:26447  
Median :0.5974   Median :0.9229   Median :0.9997   Median :29178  
Mean   :0.6436   Mean   :0.9308   Mean   :1.0036   Mean   :31433  
3rd Qu.:0.7426   3rd Qu.:0.9494   3rd Qu.:1.0057   3rd Qu.:36269  
Max.   :0.9533   Max.   :0.9583   Max.   :1.0586   Max.   :46560  

mining info:
data ntransactions support confidence
Adult         48842     0.5        0.9
"

inspect(head(rules, by = "lift"))
if(0)"
    lhs                               rhs                              support confidence     lift count
[1] {sex=Male,                                                                                          
     native-country=United-States} => {race=White}                   0.5415421  0.9051090 1.058554 26450
[2] {sex=Male,                                                                                          
     capital-loss=None,                                                                                 
     native-country=United-States} => {race=White}                   0.5113632  0.9032585 1.056390 24976
[3] {race=White}                   => {native-country=United-States} 0.7881127  0.9217231 1.027076 38493
[4] {race=White,                                                                                        
     capital-loss=None}            => {native-country=United-States} 0.7490480  0.9205626 1.025783 36585
[5] {race=White,                                                                                        
     sex=Male}                     => {native-country=United-States} 0.5415421  0.9204803 1.025691 26450
[6] {race=White,                                                                                        
     capital-gain=None}            => {native-country=United-States} 0.7194628  0.9202807 1.025469 35140
"

같이 보기

참고