Reading the data file

mydata<-read.csv("file:///C:/Users/badal/Desktop/datset_/Cosmetics.csv", colClasses = "factor", header = T)
head(mydata)
##   Trans. Bag Blush Nail.Polish Brushes Concealer Eyebrow.Pencils Bronzer
## 1      1   0     1           1       1         1               0       1
## 2      2   0     0           1       0         1               0       1
## 3      3   0     1           0       0         1               1       1
## 4      4   0     0           1       1         1               0       1
## 5      5   0     1           0       0         1               0       1
## 6      6   0     0           0       0         1               0       0
##   Lip.liner Mascara Eye.shadow Foundation Lip.Gloss Lipstick Eyeliner
## 1         1       1          0          0         0        0        1
## 2         1       0          0          1         1        0        0
## 3         1       1          1          1         1        1        0
## 4         0       0          0          1         0        0        1
## 5         1       1          1          0         1        1        0
## 6         0       0          0          0         0        0        1
#install.packages("arules")
library(arules)
## Warning: package 'arules' was built under R version 3.6.2
## Loading required package: Matrix
## 
## Attaching package: 'arules'
## The following objects are masked from 'package:base':
## 
##     abbreviate, write

Finding association rules

rules <- apriori(mydata)
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##         0.8    0.1    1 none FALSE            TRUE       5     0.1      1
##  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: 100 
## 
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[1028 item(s), 1000 transaction(s)] done [0.00s].
## sorting and recoding items ... [26 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 5 6 7 8 9 10
## Warning in apriori(mydata): Mining stopped (maxlen reached). Only patterns
## up to a length of 10 returned!
##  done [0.02s].
## writing ... [68880 rule(s)] done [0.04s].
## creating S4 object  ... done [0.03s].
summary(rules)
## set of 68880 rules
## 
## rule length distribution (lhs + rhs):sizes
##     1     2     3     4     5     6     7     8     9    10 
##     3    85   942  4350 10739 17062 18066 11996  4665   972 
## 
##    Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
##   1.000   6.000   7.000   6.542   8.000  10.000 
## 
## summary of quality measures:
##     support         confidence          lift            count      
##  Min.   :0.1000   Min.   :0.8000   Min.   :0.8781   Min.   :100.0  
##  1st Qu.:0.1150   1st Qu.:0.8667   1st Qu.:1.0389   1st Qu.:115.0  
##  Median :0.1370   Median :0.9453   Median :1.1565   Median :137.0  
##  Mean   :0.1583   Mean   :0.9259   Mean   :1.2019   Mean   :158.3  
##  3rd Qu.:0.1770   3rd Qu.:0.9821   3rd Qu.:1.2438   3rd Qu.:177.0  
##  Max.   :0.9580   Max.   :1.0000   Max.   :3.5714   Max.   :958.0  
## 
## mining info:
##    data ntransactions support confidence
##  mydata          1000     0.1        0.8

Rules with specified parameter valus

rules <- apriori(mydata,parameter = list(minlen=2, maxlen=10,supp=.7, conf=.8))
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##         0.8    0.1    1 none FALSE            TRUE       5     0.7      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: 700 
## 
## set item appearances ...[0 item(s)] done [0.00s].
## set transactions ...[1028 item(s), 1000 transaction(s)] done [0.00s].
## sorting and recoding items ... [6 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 done [0.00s].
## writing ... [15 rule(s)] done [0.00s].
## creating S4 object  ... done [0.00s].
inspect(rules)
##      lhs                                rhs                 support
## [1]  {Nail.Polish=0}                 => {Brushes=0}         0.720  
## [2]  {Brushes=0}                     => {Nail.Polish=0}     0.720  
## [3]  {Lip.liner=0}                   => {Bag=0}             0.732  
## [4]  {Lip.liner=0}                   => {Eyebrow.Pencils=0} 0.734  
## [5]  {Brushes=0}                     => {Bag=0}             0.817  
## [6]  {Bag=0}                         => {Brushes=0}         0.817  
## [7]  {Brushes=0}                     => {Eyebrow.Pencils=0} 0.820  
## [8]  {Eyebrow.Pencils=0}             => {Brushes=0}         0.820  
## [9]  {Bag=0}                         => {Eyebrow.Pencils=0} 0.909  
## [10] {Eyebrow.Pencils=0}             => {Bag=0}             0.909  
## [11] {Bag=0,Lip.liner=0}             => {Eyebrow.Pencils=0} 0.703  
## [12] {Eyebrow.Pencils=0,Lip.liner=0} => {Bag=0}             0.703  
## [13] {Bag=0,Brushes=0}               => {Eyebrow.Pencils=0} 0.789  
## [14] {Brushes=0,Eyebrow.Pencils=0}   => {Bag=0}             0.789  
## [15] {Bag=0,Eyebrow.Pencils=0}       => {Brushes=0}         0.789  
##      confidence lift     count
## [1]  1.0000000  1.175088 720  
## [2]  0.8460635  1.175088 720  
## [3]  0.9556136  1.010162 732  
## [4]  0.9582245  1.000234 734  
## [5]  0.9600470  1.014849 817  
## [6]  0.8636364  1.014849 817  
## [7]  0.9635723  1.005817 820  
## [8]  0.8559499  1.005817 820  
## [9]  0.9608879  1.003015 909  
## [10] 0.9488518  1.003015 909  
## [11] 0.9603825  1.002487 703  
## [12] 0.9577657  1.012437 703  
## [13] 0.9657283  1.008067 789  
## [14] 0.9621951  1.017120 789  
## [15] 0.8679868  1.019961 789

Finding interesting rules-1

rules <- apriori(mydata, parameter = list(minlen =2, maxlen =3, conf = 0.7),
                 appearance = list(rhs=c("Foundation=1"), default= "lhs"))
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##         0.7    0.1    1 none FALSE            TRUE       5     0.1      2
##  maxlen target   ext
##       3  rules FALSE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## Absolute minimum support count: 100 
## 
## set item appearances ...[1 item(s)] done [0.00s].
## set transactions ...[1028 item(s), 1000 transaction(s)] done [0.00s].
## sorting and recoding items ... [26 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3
## Warning in apriori(mydata, parameter = list(minlen = 2, maxlen = 3, conf =
## 0.7), : Mining stopped (maxlen reached). Only patterns up to a length of 3
## returned!
##  done [0.00s].
## writing ... [16 rule(s)] done [0.00s].
## creating S4 object  ... done [0.00s].
inspect(rules)                 
##      lhs                                rhs            support confidence
## [1]  {Lip.Gloss=1}                   => {Foundation=1} 0.356   0.7265306 
## [2]  {Lip.Gloss=1,Lipstick=1}        => {Foundation=1} 0.116   0.7341772 
## [3]  {Mascara=1,Lip.Gloss=1}         => {Foundation=1} 0.130   0.7182320 
## [4]  {Eye.shadow=1,Lip.Gloss=1}      => {Foundation=1} 0.146   0.7263682 
## [5]  {Lip.Gloss=1,Eyeliner=0}        => {Foundation=1} 0.200   0.7604563 
## [6]  {Concealer=0,Lip.Gloss=1}       => {Foundation=1} 0.215   0.7904412 
## [7]  {Eye.shadow=0,Lip.Gloss=1}      => {Foundation=1} 0.210   0.7266436 
## [8]  {Blush=0,Lip.Gloss=1}           => {Foundation=1} 0.237   0.7596154 
## [9]  {Mascara=0,Lip.Gloss=1}         => {Foundation=1} 0.226   0.7313916 
## [10] {Lip.Gloss=1,Lipstick=0}        => {Foundation=1} 0.240   0.7228916 
## [11] {Nail.Polish=0,Lip.Gloss=1}     => {Foundation=1} 0.267   0.7500000 
## [12] {Bronzer=0,Lip.Gloss=1}         => {Foundation=1} 0.295   0.8452722 
## [13] {Lip.liner=0,Lip.Gloss=1}       => {Foundation=1} 0.310   0.8288770 
## [14] {Brushes=0,Lip.Gloss=1}         => {Foundation=1} 0.313   0.7417062 
## [15] {Bag=0,Lip.Gloss=1}             => {Foundation=1} 0.335   0.7282609 
## [16] {Eyebrow.Pencils=0,Lip.Gloss=1} => {Foundation=1} 0.345   0.7278481 
##      lift     count
## [1]  1.355468 356  
## [2]  1.369734 116  
## [3]  1.339985 130  
## [4]  1.355164 146  
## [5]  1.418762 200  
## [6]  1.474704 215  
## [7]  1.355678 210  
## [8]  1.417193 237  
## [9]  1.364537 226  
## [10] 1.348678 240  
## [11] 1.399254 267  
## [12] 1.577000 295  
## [13] 1.546412 310  
## [14] 1.383780 313  
## [15] 1.358696 335  
## [16] 1.357926 345
#install.packages("arulesViz")
library(arulesViz)
## Warning: package 'arulesViz' was built under R version 3.6.2
## Loading required package: grid
## Registered S3 method overwritten by 'seriation':
##   method         from 
##   reorder.hclust gclus
plot(rules)

plot(rules, method = "grouped")

plot(rules, method = "graph", control = list(type= "items"))
## Warning: Unknown control parameters: type
## Available control parameters (with default values):
## main  =  Graph for 16 rules
## nodeColors    =  c("#66CC6680", "#9999CC80")
## nodeCol   =  c("#EE0000FF", "#EE0303FF", "#EE0606FF", "#EE0909FF", "#EE0C0CFF", "#EE0F0FFF", "#EE1212FF", "#EE1515FF", "#EE1818FF", "#EE1B1BFF", "#EE1E1EFF", "#EE2222FF", "#EE2525FF", "#EE2828FF", "#EE2B2BFF", "#EE2E2EFF", "#EE3131FF", "#EE3434FF", "#EE3737FF", "#EE3A3AFF", "#EE3D3DFF", "#EE4040FF", "#EE4444FF", "#EE4747FF", "#EE4A4AFF", "#EE4D4DFF", "#EE5050FF", "#EE5353FF", "#EE5656FF", "#EE5959FF", "#EE5C5CFF", "#EE5F5FFF", "#EE6262FF", "#EE6666FF", "#EE6969FF", "#EE6C6CFF", "#EE6F6FFF", "#EE7272FF", "#EE7575FF",  "#EE7878FF", "#EE7B7BFF", "#EE7E7EFF", "#EE8181FF", "#EE8484FF", "#EE8888FF", "#EE8B8BFF", "#EE8E8EFF", "#EE9191FF", "#EE9494FF", "#EE9797FF", "#EE9999FF", "#EE9B9BFF", "#EE9D9DFF", "#EE9F9FFF", "#EEA0A0FF", "#EEA2A2FF", "#EEA4A4FF", "#EEA5A5FF", "#EEA7A7FF", "#EEA9A9FF", "#EEABABFF", "#EEACACFF", "#EEAEAEFF", "#EEB0B0FF", "#EEB1B1FF", "#EEB3B3FF", "#EEB5B5FF", "#EEB7B7FF", "#EEB8B8FF", "#EEBABAFF", "#EEBCBCFF", "#EEBDBDFF", "#EEBFBFFF", "#EEC1C1FF", "#EEC3C3FF", "#EEC4C4FF", "#EEC6C6FF", "#EEC8C8FF",  "#EEC9C9FF", "#EECBCBFF", "#EECDCDFF", "#EECFCFFF", "#EED0D0FF", "#EED2D2FF", "#EED4D4FF", "#EED5D5FF", "#EED7D7FF", "#EED9D9FF", "#EEDBDBFF", "#EEDCDCFF", "#EEDEDEFF", "#EEE0E0FF", "#EEE1E1FF", "#EEE3E3FF", "#EEE5E5FF", "#EEE7E7FF", "#EEE8E8FF", "#EEEAEAFF", "#EEECECFF", "#EEEEEEFF")
## edgeCol   =  c("#474747FF", "#494949FF", "#4B4B4BFF", "#4D4D4DFF", "#4F4F4FFF", "#515151FF", "#535353FF", "#555555FF", "#575757FF", "#595959FF", "#5B5B5BFF", "#5E5E5EFF", "#606060FF", "#626262FF", "#646464FF", "#666666FF", "#686868FF", "#6A6A6AFF", "#6C6C6CFF", "#6E6E6EFF", "#707070FF", "#727272FF", "#747474FF", "#767676FF", "#787878FF", "#7A7A7AFF", "#7C7C7CFF", "#7E7E7EFF", "#808080FF", "#828282FF", "#848484FF", "#868686FF", "#888888FF", "#8A8A8AFF", "#8C8C8CFF", "#8D8D8DFF", "#8F8F8FFF", "#919191FF", "#939393FF",  "#959595FF", "#979797FF", "#999999FF", "#9A9A9AFF", "#9C9C9CFF", "#9E9E9EFF", "#A0A0A0FF", "#A2A2A2FF", "#A3A3A3FF", "#A5A5A5FF", "#A7A7A7FF", "#A9A9A9FF", "#AAAAAAFF", "#ACACACFF", "#AEAEAEFF", "#AFAFAFFF", "#B1B1B1FF", "#B3B3B3FF", "#B4B4B4FF", "#B6B6B6FF", "#B7B7B7FF", "#B9B9B9FF", "#BBBBBBFF", "#BCBCBCFF", "#BEBEBEFF", "#BFBFBFFF", "#C1C1C1FF", "#C2C2C2FF", "#C3C3C4FF", "#C5C5C5FF", "#C6C6C6FF", "#C8C8C8FF", "#C9C9C9FF", "#CACACAFF", "#CCCCCCFF", "#CDCDCDFF", "#CECECEFF", "#CFCFCFFF", "#D1D1D1FF",  "#D2D2D2FF", "#D3D3D3FF", "#D4D4D4FF", "#D5D5D5FF", "#D6D6D6FF", "#D7D7D7FF", "#D8D8D8FF", "#D9D9D9FF", "#DADADAFF", "#DBDBDBFF", "#DCDCDCFF", "#DDDDDDFF", "#DEDEDEFF", "#DEDEDEFF", "#DFDFDFFF", "#E0E0E0FF", "#E0E0E0FF", "#E1E1E1FF", "#E1E1E1FF", "#E2E2E2FF", "#E2E2E2FF", "#E2E2E2FF")
## alpha     =  0.5
## cex   =  1
## itemLabels    =  TRUE
## labelCol  =  #000000B3
## measureLabels     =  FALSE
## precision     =  3
## layout    =  NULL
## layoutParams  =  list()
## arrowSize     =  0.5
## engine    =  igraph
## plot  =  TRUE
## plot_options  =  list()
## max   =  100
## verbose   =  FALSE

rules <- apriori(mydata,parameter = list(minlen=2, maxlen=3,supp=.01, conf=.7),appearance=list(rhs=c("Foundation=1"),lhs=c("Bag=1", "Blush=1"),default="lhs"))
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##         0.7    0.1    1 none FALSE            TRUE       5    0.01      2
##  maxlen target   ext
##       3  rules FALSE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## Absolute minimum support count: 10 
## 
## set item appearances ...[3 item(s)] done [0.00s].
## set transactions ...[1028 item(s), 1000 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 3
## Warning in apriori(mydata, parameter = list(minlen = 2, maxlen = 3, supp =
## 0.01, : Mining stopped (maxlen reached). Only patterns up to a length of 3
## returned!
##  done [0.00s].
## writing ... [19 rule(s)] done [0.00s].
## creating S4 object  ... done [0.00s].
inspect(rules)
##      lhs                                rhs            support confidence
## [1]  {Lip.Gloss=1}                   => {Foundation=1} 0.356   0.7265306 
## [2]  {Bag=1,Lip.Gloss=1}             => {Foundation=1} 0.021   0.7000000 
## [3]  {Lip.Gloss=1,Lipstick=1}        => {Foundation=1} 0.116   0.7341772 
## [4]  {Mascara=1,Lip.Gloss=1}         => {Foundation=1} 0.130   0.7182320 
## [5]  {Mascara=1,Eye.shadow=0}        => {Foundation=1} 0.026   0.7222222 
## [6]  {Eye.shadow=1,Lip.Gloss=1}      => {Foundation=1} 0.146   0.7263682 
## [7]  {Mascara=0,Eye.shadow=1}        => {Foundation=1} 0.045   0.7500000 
## [8]  {Lip.Gloss=1,Eyeliner=0}        => {Foundation=1} 0.200   0.7604563 
## [9]  {Concealer=0,Lip.Gloss=1}       => {Foundation=1} 0.215   0.7904412 
## [10] {Eye.shadow=0,Lip.Gloss=1}      => {Foundation=1} 0.210   0.7266436 
## [11] {Blush=0,Lip.Gloss=1}           => {Foundation=1} 0.237   0.7596154 
## [12] {Mascara=0,Lip.Gloss=1}         => {Foundation=1} 0.226   0.7313916 
## [13] {Lip.Gloss=1,Lipstick=0}        => {Foundation=1} 0.240   0.7228916 
## [14] {Nail.Polish=0,Lip.Gloss=1}     => {Foundation=1} 0.267   0.7500000 
## [15] {Bronzer=0,Lip.Gloss=1}         => {Foundation=1} 0.295   0.8452722 
## [16] {Lip.liner=0,Lip.Gloss=1}       => {Foundation=1} 0.310   0.8288770 
## [17] {Brushes=0,Lip.Gloss=1}         => {Foundation=1} 0.313   0.7417062 
## [18] {Bag=0,Lip.Gloss=1}             => {Foundation=1} 0.335   0.7282609 
## [19] {Eyebrow.Pencils=0,Lip.Gloss=1} => {Foundation=1} 0.345   0.7278481 
##      lift     count
## [1]  1.355468 356  
## [2]  1.305970  21  
## [3]  1.369734 116  
## [4]  1.339985 130  
## [5]  1.347430  26  
## [6]  1.355164 146  
## [7]  1.399254  45  
## [8]  1.418762 200  
## [9]  1.474704 215  
## [10] 1.355678 210  
## [11] 1.417193 237  
## [12] 1.364537 226  
## [13] 1.348678 240  
## [14] 1.399254 267  
## [15] 1.577000 295  
## [16] 1.546412 310  
## [17] 1.383780 313  
## [18] 1.358696 335  
## [19] 1.357926 345
plot(rules, method = "graph", control = list(type= "items"))
## Warning: Unknown control parameters: type
## Available control parameters (with default values):
## main  =  Graph for 19 rules
## nodeColors    =  c("#66CC6680", "#9999CC80")
## nodeCol   =  c("#EE0000FF", "#EE0303FF", "#EE0606FF", "#EE0909FF", "#EE0C0CFF", "#EE0F0FFF", "#EE1212FF", "#EE1515FF", "#EE1818FF", "#EE1B1BFF", "#EE1E1EFF", "#EE2222FF", "#EE2525FF", "#EE2828FF", "#EE2B2BFF", "#EE2E2EFF", "#EE3131FF", "#EE3434FF", "#EE3737FF", "#EE3A3AFF", "#EE3D3DFF", "#EE4040FF", "#EE4444FF", "#EE4747FF", "#EE4A4AFF", "#EE4D4DFF", "#EE5050FF", "#EE5353FF", "#EE5656FF", "#EE5959FF", "#EE5C5CFF", "#EE5F5FFF", "#EE6262FF", "#EE6666FF", "#EE6969FF", "#EE6C6CFF", "#EE6F6FFF", "#EE7272FF", "#EE7575FF",  "#EE7878FF", "#EE7B7BFF", "#EE7E7EFF", "#EE8181FF", "#EE8484FF", "#EE8888FF", "#EE8B8BFF", "#EE8E8EFF", "#EE9191FF", "#EE9494FF", "#EE9797FF", "#EE9999FF", "#EE9B9BFF", "#EE9D9DFF", "#EE9F9FFF", "#EEA0A0FF", "#EEA2A2FF", "#EEA4A4FF", "#EEA5A5FF", "#EEA7A7FF", "#EEA9A9FF", "#EEABABFF", "#EEACACFF", "#EEAEAEFF", "#EEB0B0FF", "#EEB1B1FF", "#EEB3B3FF", "#EEB5B5FF", "#EEB7B7FF", "#EEB8B8FF", "#EEBABAFF", "#EEBCBCFF", "#EEBDBDFF", "#EEBFBFFF", "#EEC1C1FF", "#EEC3C3FF", "#EEC4C4FF", "#EEC6C6FF", "#EEC8C8FF",  "#EEC9C9FF", "#EECBCBFF", "#EECDCDFF", "#EECFCFFF", "#EED0D0FF", "#EED2D2FF", "#EED4D4FF", "#EED5D5FF", "#EED7D7FF", "#EED9D9FF", "#EEDBDBFF", "#EEDCDCFF", "#EEDEDEFF", "#EEE0E0FF", "#EEE1E1FF", "#EEE3E3FF", "#EEE5E5FF", "#EEE7E7FF", "#EEE8E8FF", "#EEEAEAFF", "#EEECECFF", "#EEEEEEFF")
## edgeCol   =  c("#474747FF", "#494949FF", "#4B4B4BFF", "#4D4D4DFF", "#4F4F4FFF", "#515151FF", "#535353FF", "#555555FF", "#575757FF", "#595959FF", "#5B5B5BFF", "#5E5E5EFF", "#606060FF", "#626262FF", "#646464FF", "#666666FF", "#686868FF", "#6A6A6AFF", "#6C6C6CFF", "#6E6E6EFF", "#707070FF", "#727272FF", "#747474FF", "#767676FF", "#787878FF", "#7A7A7AFF", "#7C7C7CFF", "#7E7E7EFF", "#808080FF", "#828282FF", "#848484FF", "#868686FF", "#888888FF", "#8A8A8AFF", "#8C8C8CFF", "#8D8D8DFF", "#8F8F8FFF", "#919191FF", "#939393FF",  "#959595FF", "#979797FF", "#999999FF", "#9A9A9AFF", "#9C9C9CFF", "#9E9E9EFF", "#A0A0A0FF", "#A2A2A2FF", "#A3A3A3FF", "#A5A5A5FF", "#A7A7A7FF", "#A9A9A9FF", "#AAAAAAFF", "#ACACACFF", "#AEAEAEFF", "#AFAFAFFF", "#B1B1B1FF", "#B3B3B3FF", "#B4B4B4FF", "#B6B6B6FF", "#B7B7B7FF", "#B9B9B9FF", "#BBBBBBFF", "#BCBCBCFF", "#BEBEBEFF", "#BFBFBFFF", "#C1C1C1FF", "#C2C2C2FF", "#C3C3C4FF", "#C5C5C5FF", "#C6C6C6FF", "#C8C8C8FF", "#C9C9C9FF", "#CACACAFF", "#CCCCCCFF", "#CDCDCDFF", "#CECECEFF", "#CFCFCFFF", "#D1D1D1FF",  "#D2D2D2FF", "#D3D3D3FF", "#D4D4D4FF", "#D5D5D5FF", "#D6D6D6FF", "#D7D7D7FF", "#D8D8D8FF", "#D9D9D9FF", "#DADADAFF", "#DBDBDBFF", "#DCDCDCFF", "#DDDDDDFF", "#DEDEDEFF", "#DEDEDEFF", "#DFDFDFFF", "#E0E0E0FF", "#E0E0E0FF", "#E1E1E1FF", "#E1E1E1FF", "#E2E2E2FF", "#E2E2E2FF", "#E2E2E2FF")
## alpha     =  0.5
## cex   =  1
## itemLabels    =  TRUE
## labelCol  =  #000000B3
## measureLabels     =  FALSE
## precision     =  3
## layout    =  NULL
## layoutParams  =  list()
## arrowSize     =  0.5
## engine    =  igraph
## plot  =  TRUE
## plot_options  =  list()
## max   =  100
## verbose   =  FALSE

# Finding interesting rules-2

rules <- apriori(mydata,parameter = list(minlen=2, maxlen=5,supp=.1, conf=.5),appearance=list(rhs=c("Foundation=1"),lhs=c("Bag=1", "Blush=1", "Nail.Polish=1", "Brushes=1", "Concealer=1", "Eyebrow.Pencils=1", "Bronzer=1", "Lip.liner=1", "Mascara=1", "Eye.shadow=1","Lip.Gloss=1", "Lipstick=1", "Eyeliner=1"),default="none"))
## Apriori
## 
## Parameter specification:
##  confidence minval smax arem  aval originalSupport maxtime support minlen
##         0.5    0.1    1 none FALSE            TRUE       5     0.1      2
##  maxlen target   ext
##       5  rules FALSE
## 
## Algorithmic control:
##  filter tree heap memopt load sort verbose
##     0.1 TRUE TRUE  FALSE TRUE    2    TRUE
## 
## Absolute minimum support count: 100 
## 
## set item appearances ...[14 item(s)] done [0.00s].
## set transactions ...[14 item(s), 1000 transaction(s)] done [0.00s].
## sorting and recoding items ... [12 item(s)] done [0.00s].
## creating transaction tree ... done [0.00s].
## checking subsets of size 1 2 3 4 done [0.00s].
## writing ... [22 rule(s)] done [0.00s].
## creating S4 object  ... done [0.00s].
quality(rules)<-round(quality(rules),digits=3)

rules.sorted <- sort(rules, by="lift")
inspect(rules)
##      lhs                rhs            support confidence  lift count
## [1]  {Lipstick=1}    => {Foundation=1}   0.167      0.519 0.968   167
## [2]  {Nail.Polish=1} => {Foundation=1}   0.143      0.511 0.953   143
## [3]  {Blush=1}       => {Foundation=1}   0.192      0.529 0.987   192
## [4]  {Mascara=1}     => {Foundation=1}   0.192      0.538 1.003   192
## [5]  {Eye.shadow=1}  => {Foundation=1}   0.211      0.554 1.033   211
## [6]  {Eyeliner=1}    => {Foundation=1}   0.238      0.521 0.972   238
## [7]  {Lip.Gloss=1}   => {Foundation=1}   0.356      0.727 1.355   356
## [8]  {Concealer=1}   => {Foundation=1}   0.231      0.523 0.975   231
## [9]  {Lip.Gloss=1,                                                   
##       Lipstick=1}    => {Foundation=1}   0.116      0.734 1.370   116
## [10] {Blush=1,                                                       
##       Mascara=1}     => {Foundation=1}   0.101      0.549 1.024   101
## [11] {Blush=1,                                                       
##       Eye.shadow=1}  => {Foundation=1}   0.100      0.549 1.025   100
## [12] {Blush=1,                                                       
##       Lip.Gloss=1}   => {Foundation=1}   0.119      0.669 1.247   119
## [13] {Blush=1,                                                       
##       Concealer=1}   => {Foundation=1}   0.115      0.523 0.975   115
## [14] {Mascara=1,                                                     
##       Eye.shadow=1}  => {Foundation=1}   0.166      0.517 0.965   166
## [15] {Mascara=1,                                                     
##       Lip.Gloss=1}   => {Foundation=1}   0.130      0.718 1.340   130
## [16] {Concealer=1,                                                   
##       Mascara=1}     => {Foundation=1}   0.107      0.525 0.979   107
## [17] {Eye.shadow=1,                                                  
##       Lip.Gloss=1}   => {Foundation=1}   0.146      0.726 1.355   146
## [18] {Concealer=1,                                                   
##       Eye.shadow=1}  => {Foundation=1}   0.104      0.517 0.965   104
## [19] {Lip.Gloss=1,                                                   
##       Eyeliner=1}    => {Foundation=1}   0.156      0.687 1.282   156
## [20] {Concealer=1,                                                   
##       Eyeliner=1}    => {Foundation=1}   0.152      0.512 0.955   152
## [21] {Concealer=1,                                                   
##       Lip.Gloss=1}   => {Foundation=1}   0.141      0.647 1.207   141
## [22] {Mascara=1,                                                     
##       Eye.shadow=1,                                                  
##       Lip.Gloss=1}   => {Foundation=1}   0.111      0.703 1.311   111
plot(rules,method="graph",control=list(type="items"))
## Warning: Unknown control parameters: type
## Available control parameters (with default values):
## main  =  Graph for 22 rules
## nodeColors    =  c("#66CC6680", "#9999CC80")
## nodeCol   =  c("#EE0000FF", "#EE0303FF", "#EE0606FF", "#EE0909FF", "#EE0C0CFF", "#EE0F0FFF", "#EE1212FF", "#EE1515FF", "#EE1818FF", "#EE1B1BFF", "#EE1E1EFF", "#EE2222FF", "#EE2525FF", "#EE2828FF", "#EE2B2BFF", "#EE2E2EFF", "#EE3131FF", "#EE3434FF", "#EE3737FF", "#EE3A3AFF", "#EE3D3DFF", "#EE4040FF", "#EE4444FF", "#EE4747FF", "#EE4A4AFF", "#EE4D4DFF", "#EE5050FF", "#EE5353FF", "#EE5656FF", "#EE5959FF", "#EE5C5CFF", "#EE5F5FFF", "#EE6262FF", "#EE6666FF", "#EE6969FF", "#EE6C6CFF", "#EE6F6FFF", "#EE7272FF", "#EE7575FF",  "#EE7878FF", "#EE7B7BFF", "#EE7E7EFF", "#EE8181FF", "#EE8484FF", "#EE8888FF", "#EE8B8BFF", "#EE8E8EFF", "#EE9191FF", "#EE9494FF", "#EE9797FF", "#EE9999FF", "#EE9B9BFF", "#EE9D9DFF", "#EE9F9FFF", "#EEA0A0FF", "#EEA2A2FF", "#EEA4A4FF", "#EEA5A5FF", "#EEA7A7FF", "#EEA9A9FF", "#EEABABFF", "#EEACACFF", "#EEAEAEFF", "#EEB0B0FF", "#EEB1B1FF", "#EEB3B3FF", "#EEB5B5FF", "#EEB7B7FF", "#EEB8B8FF", "#EEBABAFF", "#EEBCBCFF", "#EEBDBDFF", "#EEBFBFFF", "#EEC1C1FF", "#EEC3C3FF", "#EEC4C4FF", "#EEC6C6FF", "#EEC8C8FF",  "#EEC9C9FF", "#EECBCBFF", "#EECDCDFF", "#EECFCFFF", "#EED0D0FF", "#EED2D2FF", "#EED4D4FF", "#EED5D5FF", "#EED7D7FF", "#EED9D9FF", "#EEDBDBFF", "#EEDCDCFF", "#EEDEDEFF", "#EEE0E0FF", "#EEE1E1FF", "#EEE3E3FF", "#EEE5E5FF", "#EEE7E7FF", "#EEE8E8FF", "#EEEAEAFF", "#EEECECFF", "#EEEEEEFF")
## edgeCol   =  c("#474747FF", "#494949FF", "#4B4B4BFF", "#4D4D4DFF", "#4F4F4FFF", "#515151FF", "#535353FF", "#555555FF", "#575757FF", "#595959FF", "#5B5B5BFF", "#5E5E5EFF", "#606060FF", "#626262FF", "#646464FF", "#666666FF", "#686868FF", "#6A6A6AFF", "#6C6C6CFF", "#6E6E6EFF", "#707070FF", "#727272FF", "#747474FF", "#767676FF", "#787878FF", "#7A7A7AFF", "#7C7C7CFF", "#7E7E7EFF", "#808080FF", "#828282FF", "#848484FF", "#868686FF", "#888888FF", "#8A8A8AFF", "#8C8C8CFF", "#8D8D8DFF", "#8F8F8FFF", "#919191FF", "#939393FF",  "#959595FF", "#979797FF", "#999999FF", "#9A9A9AFF", "#9C9C9CFF", "#9E9E9EFF", "#A0A0A0FF", "#A2A2A2FF", "#A3A3A3FF", "#A5A5A5FF", "#A7A7A7FF", "#A9A9A9FF", "#AAAAAAFF", "#ACACACFF", "#AEAEAEFF", "#AFAFAFFF", "#B1B1B1FF", "#B3B3B3FF", "#B4B4B4FF", "#B6B6B6FF", "#B7B7B7FF", "#B9B9B9FF", "#BBBBBBFF", "#BCBCBCFF", "#BEBEBEFF", "#BFBFBFFF", "#C1C1C1FF", "#C2C2C2FF", "#C3C3C4FF", "#C5C5C5FF", "#C6C6C6FF", "#C8C8C8FF", "#C9C9C9FF", "#CACACAFF", "#CCCCCCFF", "#CDCDCDFF", "#CECECEFF", "#CFCFCFFF", "#D1D1D1FF",  "#D2D2D2FF", "#D3D3D3FF", "#D4D4D4FF", "#D5D5D5FF", "#D6D6D6FF", "#D7D7D7FF", "#D8D8D8FF", "#D9D9D9FF", "#DADADAFF", "#DBDBDBFF", "#DCDCDCFF", "#DDDDDDFF", "#DEDEDEFF", "#DEDEDEFF", "#DFDFDFFF", "#E0E0E0FF", "#E0E0E0FF", "#E1E1E1FF", "#E1E1E1FF", "#E2E2E2FF", "#E2E2E2FF", "#E2E2E2FF")
## alpha     =  0.5
## cex   =  1
## itemLabels    =  TRUE
## labelCol  =  #000000B3
## measureLabels     =  FALSE
## precision     =  3
## layout    =  NULL
## layoutParams  =  list()
## arrowSize     =  0.5
## engine    =  igraph
## plot  =  TRUE
## plot_options  =  list()
## max   =  100
## verbose   =  FALSE

Finding redundancy

redundant <- is.redundant(rules, measure="confidence")

which(redundant)
##  [1] 11 12 13 14 15 16 17 18 19 20 21 22
rules.pruned <- rules[!redundant]

rules.pruned <- sort(rules.pruned, by="lift")

inspect(rules.pruned)
##      lhs                         rhs            support confidence lift 
## [1]  {Lip.Gloss=1,Lipstick=1} => {Foundation=1} 0.116   0.734      1.370
## [2]  {Lip.Gloss=1}            => {Foundation=1} 0.356   0.727      1.355
## [3]  {Eye.shadow=1}           => {Foundation=1} 0.211   0.554      1.033
## [4]  {Blush=1,Mascara=1}      => {Foundation=1} 0.101   0.549      1.024
## [5]  {Mascara=1}              => {Foundation=1} 0.192   0.538      1.003
## [6]  {Blush=1}                => {Foundation=1} 0.192   0.529      0.987
## [7]  {Concealer=1}            => {Foundation=1} 0.231   0.523      0.975
## [8]  {Eyeliner=1}             => {Foundation=1} 0.238   0.521      0.972
## [9]  {Lipstick=1}             => {Foundation=1} 0.167   0.519      0.968
## [10] {Nail.Polish=1}          => {Foundation=1} 0.143   0.511      0.953
##      count
## [1]  116  
## [2]  356  
## [3]  211  
## [4]  101  
## [5]  192  
## [6]  192  
## [7]  231  
## [8]  238  
## [9]  167  
## [10] 143

Graphs and Charts

plot(rules.pruned,method="graph",control=list(type="items"))
## Warning: Unknown control parameters: type
## Available control parameters (with default values):
## main  =  Graph for 10 rules
## nodeColors    =  c("#66CC6680", "#9999CC80")
## nodeCol   =  c("#EE0000FF", "#EE0303FF", "#EE0606FF", "#EE0909FF", "#EE0C0CFF", "#EE0F0FFF", "#EE1212FF", "#EE1515FF", "#EE1818FF", "#EE1B1BFF", "#EE1E1EFF", "#EE2222FF", "#EE2525FF", "#EE2828FF", "#EE2B2BFF", "#EE2E2EFF", "#EE3131FF", "#EE3434FF", "#EE3737FF", "#EE3A3AFF", "#EE3D3DFF", "#EE4040FF", "#EE4444FF", "#EE4747FF", "#EE4A4AFF", "#EE4D4DFF", "#EE5050FF", "#EE5353FF", "#EE5656FF", "#EE5959FF", "#EE5C5CFF", "#EE5F5FFF", "#EE6262FF", "#EE6666FF", "#EE6969FF", "#EE6C6CFF", "#EE6F6FFF", "#EE7272FF", "#EE7575FF",  "#EE7878FF", "#EE7B7BFF", "#EE7E7EFF", "#EE8181FF", "#EE8484FF", "#EE8888FF", "#EE8B8BFF", "#EE8E8EFF", "#EE9191FF", "#EE9494FF", "#EE9797FF", "#EE9999FF", "#EE9B9BFF", "#EE9D9DFF", "#EE9F9FFF", "#EEA0A0FF", "#EEA2A2FF", "#EEA4A4FF", "#EEA5A5FF", "#EEA7A7FF", "#EEA9A9FF", "#EEABABFF", "#EEACACFF", "#EEAEAEFF", "#EEB0B0FF", "#EEB1B1FF", "#EEB3B3FF", "#EEB5B5FF", "#EEB7B7FF", "#EEB8B8FF", "#EEBABAFF", "#EEBCBCFF", "#EEBDBDFF", "#EEBFBFFF", "#EEC1C1FF", "#EEC3C3FF", "#EEC4C4FF", "#EEC6C6FF", "#EEC8C8FF",  "#EEC9C9FF", "#EECBCBFF", "#EECDCDFF", "#EECFCFFF", "#EED0D0FF", "#EED2D2FF", "#EED4D4FF", "#EED5D5FF", "#EED7D7FF", "#EED9D9FF", "#EEDBDBFF", "#EEDCDCFF", "#EEDEDEFF", "#EEE0E0FF", "#EEE1E1FF", "#EEE3E3FF", "#EEE5E5FF", "#EEE7E7FF", "#EEE8E8FF", "#EEEAEAFF", "#EEECECFF", "#EEEEEEFF")
## edgeCol   =  c("#474747FF", "#494949FF", "#4B4B4BFF", "#4D4D4DFF", "#4F4F4FFF", "#515151FF", "#535353FF", "#555555FF", "#575757FF", "#595959FF", "#5B5B5BFF", "#5E5E5EFF", "#606060FF", "#626262FF", "#646464FF", "#666666FF", "#686868FF", "#6A6A6AFF", "#6C6C6CFF", "#6E6E6EFF", "#707070FF", "#727272FF", "#747474FF", "#767676FF", "#787878FF", "#7A7A7AFF", "#7C7C7CFF", "#7E7E7EFF", "#808080FF", "#828282FF", "#848484FF", "#868686FF", "#888888FF", "#8A8A8AFF", "#8C8C8CFF", "#8D8D8DFF", "#8F8F8FFF", "#919191FF", "#939393FF",  "#959595FF", "#979797FF", "#999999FF", "#9A9A9AFF", "#9C9C9CFF", "#9E9E9EFF", "#A0A0A0FF", "#A2A2A2FF", "#A3A3A3FF", "#A5A5A5FF", "#A7A7A7FF", "#A9A9A9FF", "#AAAAAAFF", "#ACACACFF", "#AEAEAEFF", "#AFAFAFFF", "#B1B1B1FF", "#B3B3B3FF", "#B4B4B4FF", "#B6B6B6FF", "#B7B7B7FF", "#B9B9B9FF", "#BBBBBBFF", "#BCBCBCFF", "#BEBEBEFF", "#BFBFBFFF", "#C1C1C1FF", "#C2C2C2FF", "#C3C3C4FF", "#C5C5C5FF", "#C6C6C6FF", "#C8C8C8FF", "#C9C9C9FF", "#CACACAFF", "#CCCCCCFF", "#CDCDCDFF", "#CECECEFF", "#CFCFCFFF", "#D1D1D1FF",  "#D2D2D2FF", "#D3D3D3FF", "#D4D4D4FF", "#D5D5D5FF", "#D6D6D6FF", "#D7D7D7FF", "#D8D8D8FF", "#D9D9D9FF", "#DADADAFF", "#DBDBDBFF", "#DCDCDCFF", "#DDDDDDFF", "#DEDEDEFF", "#DEDEDEFF", "#DFDFDFFF", "#E0E0E0FF", "#E0E0E0FF", "#E1E1E1FF", "#E1E1E1FF", "#E2E2E2FF", "#E2E2E2FF", "#E2E2E2FF")
## alpha     =  0.5
## cex   =  1
## itemLabels    =  TRUE
## labelCol  =  #000000B3
## measureLabels     =  FALSE
## precision     =  3
## layout    =  NULL
## layoutParams  =  list()
## arrowSize     =  0.5
## engine    =  igraph
## plot  =  TRUE
## plot_options  =  list()
## max   =  100
## verbose   =  FALSE