Association Rule Mining–Apriori Algorithm Solved Problems

Q.1) For the following given Transaction Data-set, Generate Rules using Apriori Algorithm.
Consider the values as Support=50% and Confidence=75%

Transaction IDItems Purchased
1Bread, Cheese, Egg, Juice
2Bread, Cheese, Juice
3Bread, Milk, Yogurt
4Bread, Juice, Milk
5Cheese, Juice, Milk

Answer:
Given Support=50% and Confidence=75%

Step 1) Find Frequent Item Set and their support

ItemFrequencySupport (in %)
Bread44/5=80%
Cheese33/5=60%
Egg11/5=20%
Juice44/5=80%
Milk33/5=60%
Yogurt11/5=20%

Support (item) = Frequency of item/Number of transactions

Step 2) Remove all the items whose support is below given minimum support.

ItemFrequencySupport (in %)
Bread44/5=80%
Cheese33/5=60%
Juice44/5=80%
Milk33/5=60%

Step 3) Now form the two items candidate set and write their frequencies.

Items PairFrequencySupport (in %)
Bread, Cheese22/5=40%
Bread, Juice33/5=60%
Bread, Milk22/5=40%
Cheese, Juice33/5=60%
Cheese, Milk11/5=20%
Juice, Milk22/5=40%

Step 4) Remove all the items whose support is below given minimum support

Item PairFrequencySupport ( in %)
Bread, Juice33/5=60%
Cheese, Juice33/5=60%

Step 5) Generate rules

For Rules we consider item pairs:
a) (Bread, Juice)
Bread->Juice and Juice->Bread
b) (Cheese, Juice)
Cheese->Juice and Juice->Cheese

Confidence (A->B) = support (AUB)/support (A)

Therefore,

  1. Confidence (Bread->Juice) = support (Bread U Juice)/support (Bread)
    = 3/5 * 5/4=3/4= 75%
  2. Confidence (Juice->Bread) = support (Juice U Bread)/support (Juice)
    = 3/5*5/4=3/4=75%
  3. Confidence (Cheese->Juice) = support (Cheese U Juice)/support (Cheese)
    =3/5*5/3=1=100%
  4. Confidence (Juice->Cheese) = support (Juice U Cheese)/support (Juice)
    = 3/5*5/4=3/4=75%
    All the above rules are good because the confidence of each rule is greater than or equal to
    the minimum confidence given in the problem.

Related Posts

Leave a Reply

Your email address will not be published. Required fields are marked *