You are on page 1of 10

Assignment-1 Group 13 Page | 1

Assignment 1

Q1 An analyst at a subscription-based satellite radio company has been given a sample of


data from their customer database, with the goal of finding groups of customers that are
associated with one another. The data consist of company data, together with purchased
demographic data that are mapped to the company data – see figure 11.5 (CH10-Assoc-Exer-
Cust.eps). The analyst decides to apply Association Rules to learn
more about the associations between customers.

Ans- One of the major disadvantages of association rules is that they do not take sequential
information into account that is available in the data. Association rule helps to analyze the
degree of associations among the purchased demographic data or company data of a customer
i.e., items which are listed in the columns of the above data sample and does not associate
items between rows i.e., between the customers. Therefore, due to this demerit Association
rules is not the appropriate model for identifying relations between potential customers. Infact,
to address this shortcoming associated with association rule, we use cluster analysis which
aims at sorting different objects into groups and maximizing the degree of association between
two objects belonging to the same group, otherwise it aims at minimizing the association.
Hence, after considering all factors we believe, Cluster analysis would be preferable method
to determine the degree of associations among customers.

Q.2 Consider the data in the file coursetopics.xls. These data are for purchases of online
statistics courses at statistics.com. Each row represents the courses attended by a single
Assignment-1 Group 13 Page | 2

customer. The firm wishes to assess alternative sequencings and combinations of courses.
Use Association Rules to analyse these data, and interpret several of the resulting rules

Ans-
Here is the R code for the above given data set coursetopics.xls

Fig - The output for the above R program is given


From the above output the rules are
Rule 1
Assignment-1 Group 13 Page | 3

If the course Intro, regression and forecast are taken then the student also takes Datamining as
subject.

Confidence is 71 percent and lift is 4, as lift is greater than 1 so we can say that this courses
are taken together quite often.

Rule 2
If intro, survey and DOE are taken then a student is likely to take Cat.Data

Confidence is 80 percent and lift is 3, as lift is greater than 1 so we can say that this courses
are taken together quite often.

Rules 3
If Intro, Datamining and Cat. ata are taken by a student then student also takes the course of
Regression

Confidence is 75 percent and lift is 3, as lift is greater than 1 so we can say that this courses
are taken together quite often.

Q3. The data shown in Figure 11.7 are a subset of a dataset on cosmetic purchases given
in binary matrix form. The complete dataset (in the file Cosmetics.xls) contains data on
the purchases of different cosmetic items at a large chain drugstore. The store wants to
analyze associations among purchases of these items for purposes of point-of-sale
display, guidance to sales personnel in promoting cross sales, and guidance for piloting
an eventual time-of purchase electronic recommender system to boost cross sales.
Consider first only the subset shown in Figure 11.7 (CH10-Assoc-Exer_Cosmetics-
small.eps)

a. Select several values in the matrix and explain their meaning.


Assignment-1 Group 13 Page | 4

Ans. In the 1st Transaction, blush, nail polish, brushes, concealer and bronzer have been
purchased together from the drugstore whereas bag and eyebrow pencils have not been
purchased.

In the 5th transaction, only blush, concealer and bronzer have been purchased at a time.

In the 9th transaction, only concealer is present in the market basket.

Q3 b.

i) For the first row, explain the “Conf. %” output and how it is calculated.

Ans. Confidence (a=>c) = N(XY) / N(X) = {N(XY)/N} / {N(X)/N} =Support(XY) /


Support(X) = 62/103 =60.19

It means that for each time that bronzer and nail polish are present together in a market basket,
there is a chance of 60.19 % that brushes and concealer are also present in that transaction.

ii) For the first row, explain the “Support(a), Support(c) and Support(a U c) output and
how it is calculated.

Ans. Support (a) = N(a)


In the 1st row, support(a) = 103 suggests that there are 103 transactions where bronzer and nail
polish have been purchased together.

Support (c) = N (c)


In the 1st row, support(c) =77 suggests that there are 77 transactions where brushes and
concealer have been purchased together.

Support (a U c) = N(a U c)
In the 1st row, support (a U c) = 62 suggests that there are 62 such transactions where if brushes
and concealer have been purchased, bronzer and nail polish have also been purchased in the
same transaction.
Assignment-1 Group 13 Page | 5

iii) For the first row, explain the “Lift Ratio” and how it is calculated.

Ans. Lift Ratio = Conf(a => c) / Support (c)

It shows that if bronzer and nailpolish are purchased together in the same transaction then the
likelihood of brushes and concealer being purchased in that transaction increases 3.909 times

iv) For the first row, explain the rule that is represented there in words.

Ans: Bronzer, Nail Polish => Brushes, Concealer

Here the rule is that if bronzer and nail polish are present in a market basket, then brushes and
concealer will also be purchased in the same transaction.

v. Find all the Association Rules from the data.


Ans:

lhs rhs support confidence


coverage lift count
[1] {Brushes} => {Nail.Polish} 0.149 1.000
0.149 3.571 149
[2] {Blush, Concealer, Eye.shadow} => {Mascara} 0.119 0.960
0.124 2.688 119
[3] {Blush, Eye.shadow} => {Mascara} 0.169 0.929
0.182 2.601 169
[4] {Nail.Polish, Eye.shadow} => {Mascara} 0.119 0.908
0.131 2.545 119
[5] {Concealer, Eye.shadow} => {Mascara} 0.179 0.891
0.201 2.495 179
[6] {Bronzer, Eye.shadow} => {Mascara} 0.124 0.879
0.141 2.463 124
[7] {Concealer, Eye.shadow, Eyeliner} => {Mascara} 0.114 0.877
0.130 2.456 114
[8] {Blush, Mascara} => {Eye.shadow} 0.169 0.918
0.184 2.411 169
[9] {Eye.shadow, Lipstick} => {Mascara} 0.110 0.853
0.129 2.389 110
[10] {Mascara, Lipstick} => {Eye.shadow} 0.110 0.909
0.121 2.386 110
[11] {Blush, Concealer, Mascara} => {Eye.shadow} 0.119 0.908
0.131 2.384 119
[12] {Bronzer, Mascara} => {Eye.shadow} 0.124 0.905
0.137 2.376 124
[13] {Mascara} => {Eye.shadow} 0.321 0.899
0.357 2.360 321
[14] {Eye.shadow} => {Mascara} 0.321 0.843
0.381 2.360 321
[15] {Nail.Polish, Mascara} => {Eye.shadow} 0.119 0.888
0.134 2.331 119
Assignment-1 Group 13 Page | 6

[16] {Eye.shadow, Eyeliner} => {Mascara} 0.151 0.830


0.182 2.324 151
[17] {Concealer, Mascara} => {Eye.shadow} 0.179 0.877
0.204 2.303 179
[18] {Mascara, Lip.Gloss} => {Eye.shadow} 0.158 0.873
0.181 2.291 158
[19] {Mascara, Foundation} => {Eye.shadow} 0.166 0.865
0.192 2.269 166
[20] {Mascara, Eyeliner} => {Eye.shadow} 0.151 0.863
0.175 2.265 151
[21] {Mascara, Foundation, Lip.Gloss} => {Eye.shadow} 0.111 0.854
0.130 2.241 111
[22] {Concealer, Mascara, Eyeliner} => {Eye.shadow} 0.114 0.851
0.134 2.233 114
[23] {Eye.shadow, Foundation} => {Mascara} 0.166 0.787
0.211 2.204 166
[24] {Eye.shadow, Lip.Gloss} => {Mascara} 0.158 0.786
0.201 2.202 158
[25] {Eye.shadow,Foundation, Lip.Gloss} => {Mascara} 0.111 0.760
0.146 2.130 111
[26] {Lip.liner, Eyeliner} => {Concealer} 0.120 0.923
0.130 2.088 120
[27] {Blush, Lip.liner} => {Concealer} 0.108 0.871
0.124 1.971 108
[28] {Bronzer, Eyeliner} => {Concealer} 0.119 0.815
0.146 1.844 119
[29] {Concealer, Mascara, Eye.shadow} => {Blush} 0.119 0.665
0.179 1.831 119
[30] {Bronzer, Lip.liner} => {Concealer} 0.103 0.805
0.128 1.821 103
[31] {Blush, Bronzer} => {Concealer} 0.107 0.799
0.134 1.807 107
[32] {Blush, Eyeliner} => {Concealer} 0.143 0.794
0.180 1.797 143
[33] {Concealer, Mascara} => {Blush} 0.131 0.642
0.204 1.769 131
[34] {Mascara, Eyeliner} => {Concealer} 0.134 0.766
0.175 1.732 134
[35] {Lip.liner} => {Concealer} 0.179 0.765
0.234 1.731 179
[36] {Mascara, Eye.shadow, Eyeliner} => {Concealer} 0.114 0.755
0.151 1.708 114
[37] {Concealer, Eye.shadow} => {Blush} 0.124 0.617
0.201 1.699 124
[38] {Concealer, Bronzer} => {Blush} 0.107 0.611
0.175 1.684 107
[39] {Bronzer, Mascara} => {Concealer} 0.102 0.745
0.137 1.684 102
[40] {Concealer, Lip.liner} => {Blush} 0.108 0.603
0.179 1.662 108
[41] {Eye.shadow, Eyeliner} => {Concealer} 0.130 0.714
Assignment-1 Group 13 Page | 7

0.182 1.616 130


[42] {Blush, Mascara} => {Concealer} 0.131 0.712
0.184 1.611 131
[43] {Blush, Mascara, Eye.shadow} => {Concealer} 0.119 0.704
0.169 1.593 119
[44] {Concealer, Lipstick} => {Eyeliner} 0.103 0.725
0.142 1.587 103
[45] {Blush, Eye.shadow} => {Concealer} 0.124 0.681
0.182 1.541 124
[46] {Lipstick, Eyeliner} => {Concealer} 0.103 0.665
0.155 1.503 103
[47] {Concealer, Bronzer} => {Eyeliner} 0.119 0.680
0.175 1.488 119
[48] {Eyeliner} => {Concealer} 0.297 0.650
0.457 1.470 297
[49] {Concealer} => {Eyeliner} 0.297 0.672
0.442 1.470 297
[50] {Concealer, Lip.liner} => {Eyeliner} 0.120 0.670
0.179 1.467 120
[51] {Concealer, Lip.Gloss} => {Eyeliner} 0.145 0.665
0.218 1.455 145
[52] {Lip.Gloss, Eyeliner} => {Concealer} 0.145 0.639
0.227 1.445 145
[53] {Foundation, Eyeliner} => {Concealer} 0.152 0.639
0.238 1.445 152
[54] {Concealer, Foundation} => {Eyeliner} 0.152 0.658
0.231 1.440 152
[55] {Concealer, Mascara} => {Eyeliner} 0.134 0.657
0.204 1.437 134
[56] {Blush, Lip.Gloss} => {Concealer} 0.112 0.629
0.178 1.424 112
[57] {Blush, Concealer} => {Eyeliner} 0.143 0.650
0.220 1.422 143
[58] {Bronzer} => {Concealer} 0.175 0.627
0.279 1.419 175
[59] {Foundation, Lipstick} => {Lip.Gloss} 0.116 0.695
0.167 1.418 116
[60] {Concealer, Eye.shadow} => {Eyeliner} 0.130 0.647
0.201 1.415 130
[61] {Eye.shadow, Foundation} => {Lip.Gloss} 0.146 0.692
0.211 1.412 146
[62] {Concealer, Mascara, Eye.shadow} => {Eyeliner} 0.114 0.637
0.179 1.394 114
[63] {Mascara, Foundation} => {Lip.Gloss} 0.130 0.677
0.192 1.382 130
[64] {Blush} => {Concealer} 0.220 0.606
0.363 1.371 220
[65] {Lip.Gloss, Lipstick} => {Foundation} 0.116 0.734
0.158 1.370 116
[66] {Mascara,Eye.shadow,Foundation} => {Lip.Gloss} 0.111 0.669
0.166 1.365 111
Assignment-1 Group 13 Page | 8

[67] {Lip.Gloss} => {Foundation} 0.356 0.727


0.490 1.355 356
[68] {Foundation} => {Lip.Gloss} 0.356 0.664
0.536 1.355 356
[69] {Eye.shadow, Lip.Gloss} => {Foundation} 0.146 0.726
0.201 1.355 146
[70] {Mascara, Lip.Gloss} => {Foundation} 0.130 0.718
0.181 1.340 130
[71] {Foundation, Eyeliner} => {Lip.Gloss} 0.156 0.655
0.238 1.338 156
[72] {Mascara, Eye.shadow, Lip.Gloss} => {Foundation} 0.111 0.703
0.158 1.311 111
[73] {Lip.Gloss, Eyeliner} => {Foundation} 0.156 0.687
0.227 1.282 156
[74] {Blush, Foundation} => {Lip.Gloss} 0.119 0.620
0.192 1.265 119
[75] {Blush, Lip.Gloss} => {Foundation} 0.119 0.669
0.178 1.247 119
[76] {Concealer, Foundation} => {Lip.Gloss} 0.141 0.610
0.231 1.246 141
[77] {Concealer, Lip.Gloss} => {Foundation} 0.141 0.647
0.218 1.207 141

vi. Interpret the first several rules in the output in words.


Ans:

R1: If brushes are purchased, then the likelihood of nailpolish also being purchased is 3.571.
Since the confidence is 1, therefore we can infer that everytime brushes has been purchased
nailpolish have also been purchased in the same transaction.

R2 : If Blush, Concealer, Eye.shadow are purchased, then the likelihood of Mascara also
being purchased is 2.688 . We can deduce that everytime Blush, Concealer, Eye.shadow has
been purchased mascara have also been purchased 96% of the times in the same transaction.
R3 : If Blush, Eyeshadow are purchased, then the likelihood of Mascara also being purchased
is 2.601 . We can deduce that every time Blush and Eyeshadow has been purchased mascara
have also been purchased 92.9% of the times in the same transaction.
R4 : If Blush, Eye.shadow are purchased, then the likelihood of Mascara also being
purchased is 2.545 . We can deduce that every time Blush and Eyeshadow has been
purchased mascara have also been purchased 90.8% of the times in the same transaction.
R5 : If Concealer and Eyeshadow are purchased, then the likelihood of Mascara also being
purchased is 2.495 . We can deduce that everytime Concealer and Eyeshadow has been
purchased mascara have also been purchased 89.1 % of the times in the same transaction.

vii. Reviewing the first couple of dozen rules, comment on their redundancy, and how
you would assess their utility.
Ans:
R5: {Concealer, Eye.shadow} => {Mascara}
R7: {Concealer, Eye.shadow, Eyeliner} => {Mascara}
R2: {Blush, Concealer, Eye.shadow} => {Mascara}
R3: {Blush, Eye.shadow} => {Mascara}
Assignment-1 Group 13 Page | 9

Among all the association rules that have been found, a number of them are found to be
redundant. Here, we have taken two such examples.
Rule 5 and Rule 2 are redundant in this case, since their characteristic is already being
represented by Rule 7 and Rule 3 respectively. Thus we can say, that Rule 5 and Rule 2 are
subsets of Rule 7 and Rule 3 respectively.
In Rule 2 and Rule 3, we can see that if along with blush and eyeshadow, concealer is also
purchased in a particular transaction, then the likeliness of mascara being purchased increases
by 0.08.
In Rule 5 and Rule 7, we can see that if along with concealer and eyeshadow, eyeliner is also
purchased in a particular transaction, then the likeliness of mascara being purchased
decreases by 0.039.
Therefore, even if some of the rules are redundant, but they can be used to compare the
change in the purchase behavior of a customer with the inclusion of a particular object in the
antecedent or consequent of the rules, thereby helping the retailer to decide upon the
combinations of objects which provide maximum sales and profits.

Point-of-sale display, Guidance to sales personnel and Recommender system:


Those products that are found to be associated with high values of lift and confidence should
be positioned in the shelf of the drugstore in such a manner so as to increase the likeliness of
them being bought as a bundle.
Observation 1:

 {Blush, Eye.shadow} => {Concealer} 0.124 0.681 0.182 1.541


 {Blush, Eye.shadow} => {Mascara} 0.169 0.929 0.182 2.601
 {Blush, Concealer, Eye.shadow}=> {Mascara} 0.119 0.960 0.124 2.688

If Blush and Eyeshadow is bought together, it is found that people are more likely to buy
Mascara than Concealer in the same transaction. But if they somehow buy Concealer along
with blush and Eyeshadow, then they are more likely to buy Mascara as well. Concealer is
more pricy than Mascara. Therefore, if the store is looking for a sales target, then mascara
should be placed closer to blush and eyeshadow since the data ensures more likeliness of
mascara to be sold in the same transaction in this case. But if we are targeting more profit
margin, we should push for the sale of Concealers. In this case, sales personnel can convince
the customers who are buying Blush and Eyeshadow by promoting concealers. This is because
if they are able to convince them to buy Concealer, then they are also seen to be buying mascara
most of the times. This would help the store to ensure high number of sales of both concealer
and mascara as well as more profit.

Observation 2:
 {Concealer, Mascara} => {Eye.shadow} 2.303
 {Concealer, Eye.shadow} => {Mascara} 2.495
 {Mascara, Eye.shadow, Eyeliner} => {Concealer} 1.708

In this case, we find that if concealer and mascara are purchased together, then eyeshadow is
also bought most of the times. Again if Concealer and Eyeshadow are purchased together, then
the likelihood of mascara being bought also increases. But if Mascara and and eyeshadow are
bought together, the likelihood of mascara being bought as well doesn’t satisfy the required
condition of support and lift values. But if eyeliner is bought along with mascara and
eyeshadow, then the likelihood of the purchase of concealer also increases. Therefore,
Assignment-1 Group 13 Page |
10

concealer, mascara, eyeshadow and eyeliner should be placed nearby in the shelves.

Combining observation 1 and 2, we find that eyeshadow, concealer, mascara are common while
eyeliner and blush are unique.
 {Blush, Concealer} => {Eyeliner} with lift 1.422

Therefore we can place all the 5 items in the same aisle so they can be considered a bundle and
thus should be easily available to the customers. Therefore, the recommender system can also
be designed in such a way that these 5 items are recommended accordingly to the purchase
behavior of the customers. For example if Concealer and Mascara are added to the cart of the
customer then it should recommend eyeshadow to the customer.

Observation 3:

 {Lip.Gloss} => {Foundation} 0.356 0.727 0.490 1.355 356


 {Foundation} =>{Lip.Gloss} 0.356 0.664 0.536 1.355 356

Here, both these products can be treated as a bundle and thus should be placed together since
if the if lip gloss is purchased then probability of foundation being purchased is high and vice
versa. In a recommender system, if a customer is seen to be buying a lip gloss then foundation
should definitely be recommended to the customer and vice versa.

You might also like