review

Association Rule

Use grocery dataset and find frequently sell item along with another item.

#data(package="arules")
loadData<-read.transactions(file="/home/sushil/Desktop/grocery.csv",sep=',');
#converTransactions<-as(loadData,"transactions")
summary(loadData)
## transactions as itemMatrix in sparse format with
##  9836 rows (elements/itemsets/transactions) and
##  169 columns (items) and a density of 0.0260888 
## 
## most frequent items:
##       whole milk other vegetables       rolls/buns             soda 
##             2513             1903             1809             1715 
##           yogurt          (Other) 
##             1372            34055 
## 
## element (itemset/transaction) length distribution:
## sizes
##    0    1    2    3    4    5    6    7    8    9   10   11   12   13   14 
##    1 2159 1643 1299 1005  855  645  545  438  350  246  182  117   78   77 
##   15   16   17   18   19   20   21   22   23   24   26   27   28   29   32 
##   55   46   29   14   14    9   11    4    6    1    1    1    1    3    1 
## 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   0.000   2.000   3.000   4.409   6.000  32.000 
## 
## includes extended item information - examples:
##             labels
## 1 abrasive cleaner
## 2 artif. sweetener
## 3   baby cosmetics

insepect is used for view all transaction in data.We can view any particular rows using inspect itemFrequecny is a support by using this we can see items occuring frequency item has high suppport show that items transaction is maximum

##      items                     
## [1]  {citrus fruit,            
##       margarine,               
##       ready soups,             
##       semi-finished bread}     
## [2]  {coffee,                  
##       tropical fruit,          
##       yogurt}                  
## [3]  {whole milk}              
## [4]  {cream cheese,            
##       meat spreads,            
##       pip fruit,               
##       yogurt}                  
## [5]  {condensed milk,          
##       long life bakery product,
##       other vegetables,        
##       whole milk}              
## [6]  {abrasive cleaner,        
##       butter,                  
##       rice,                    
##       whole milk,              
##       yogurt}                  
## [7]  {rolls/buns}              
## [8]  {bottled beer,            
##       liquor (appetizer),      
##       other vegetables,        
##       rolls/buns,              
##       UHT-milk}                
## [9]  {pot plants}              
## [10] {cereals,                 
##       whole milk}

## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##       0.055    0.1    1 none FALSE            TRUE       5    0.05      2
##  maxlen target   ext
##      10  rules FALSE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## Absolute minimum support count: 491 
## 
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[169 item(s), 9836 transaction(s)] done [0.00s].
## sorting and recoding items ... [28 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 done [0.00s].
## writing ... [6 rule(s)] done [0.00s].
## creating S4 object  ... done [0.00s].

##     lhs                   rhs                support    confidence
## [1] {yogurt}           => {whole milk}       0.05601871 0.4016035 
## [2] {whole milk}       => {yogurt}           0.05601871 0.2192598 
## [3] {other vegetables} => {whole milk}       0.07482717 0.3867578 
## [4] {whole milk}       => {other vegetables} 0.07482717 0.2928770 
## [5] {whole milk}       => {rolls/buns}       0.05662871 0.2216474 
##     lift     count
## [1] 1.571895 551  
## [2] 1.571895 551  
## [3] 1.513788 736  
## [4] 1.513788 736  
## [5] 1.205154 557

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.