Association Rule
Association Rule
solution :
Items: {A,B,C,D,E}
# of all transactions: 5
# AD
Support A→D: = 2/5
# of all transactions
# AD
Confidence A→D: = 2/3
# of transactions of A
TID
solution :
TID S C
Step-1: K=1
(I) Create a table containing support count of each item present in dataset
– Called C1(candidate set)
=> L1
if support_count of candidate set items is less than min_support then
remove those items(min_sup_count=2)
Step-2: K=2
Generate candidate set C2 using L1
and find support count of these itemsets
if support_count of candidate set item is less than min_support then
remove those items
=> L2
Step-3:
Generate candidate set C3 using L2
if support_count of candidate set item is less than min_support then remove
those items
=> L3
Step-4:
Generate candidate set C4 using L3
l1,l2,l3,l5 => count = 1 => not frequent
no itemset in C4
stop
by taking an example of any frequent itemset, we will show the rule generation.
Itemset {I1, I2, I3} //from L3
SO rules can be
[I1^I2]=>[I3] //confidence = sup(I1^I2^I3)/sup(I1^I2) = 2/4*100=50%
[I1^I3]=>[I2] //confidence = sup(I1^I2^I3)/sup(I1^I3) = 2/4*100=50%
[I2^I3]=>[I1] //confidence = sup(I1^I2^I3)/sup(I2^I3) = 2/4*100=50%
[I1]=>[I2^I3] //confidence = sup(I1^I2^I3)/sup(I1) = 2/6*100=33%
[I2]=>[I1^I3] //confidence = sup(I1^I2^I3)/sup(I2) = 2/7*100=28%
[I3]=>[I1^I2] //confidence = sup(I1^I2^I3)/sup(I3) = 2/6*100=33%
So if minimum confidence is 50%, then first 3 rules can be considered as strong
association rules.
4. Consider the data set from a supermarket as shown in the Table. Apply the
Apriori algorithm to the dataset of transactions and identify all frequent k
itemsets. (Min_sup= 20%)
2 Bread, Sugar
3 Bread, Cheese
5 Milk, Chesse
6 Bread, Chesse
7 Milk, Chesse