Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Apply Apriori algorithm on the grocery store example with support threshold s=33

ID: 3931441 • Letter: A

Question

Apply Apriori algorithm on the grocery store example with support threshold s=33.34% and confidence threshold c=60%, where H, B, K, C and P are different items purchased by customers. a) Show all final frequent itemsets.

b) Specify the association rules that are generated.

c) Show final association rules sorted by confidence.

d) Represent the transactions as graph.

Transaction ID          Items

T1                           H, B, K

T2                           H, B

T3                           H, C, P

T4                           P, C

T5                           P, K

T6                          H, C, P

Explanation / Answer

Support threshold =33.34% => threshold is at least 2 transactions.

Applying Apriori
Pass (k) Candidate k-itemsets and their support Frequent k-itemsets
k=1 H(4), B(2), K(2), C(3), P(4) H, B, K, C, P
k=2 {H, B}(2), {H, K}(1), {H, C}(2),
{H, P}(2), {B, K}(1), {B, C}(0), {H, B}, {H, C}, {H, P}, {C, P}
  {B, P}(0), {K, C}(0), {K, P}(1), {C, P}(3)
k=3 {H, C, P}(2) {H, C, P}
k=4   {}
Note that {H, B, C} and {H, B, P} are not candidates when k=3 because their subsets {B, C} and {B, P} are not frequent. Note also that normally, there is no need to go to k=4 since the longest transaction has only 3 items.
All Frequent Itemsets: {H}, {B}, {K}, {C}, {P}, {H, B}, {H, C}, {H, P}, {C, P}, {H, C, P}.

Association rules:
{H, B} would generate: H-> B (2/6=0.33, 2/4=0.5) and
B -> H (2/6=0.33, 2/2=1);

{H, C} would generate: H -> C (0.33, 0.5) and
C -> H (2/6=0.33, 2/3=0.66);

{H, P} would generate: H -> P (0.33, 0.5) and
P -> H (2/6=0.33, 2/4=0.5);

{C, P} would generate: C -> P (3/6=0.5, 3/3=1) and
P -> C (3/6=0.5, 3/4=0.75);


{H, C, P} would generate: H -> C ^ P (2/6=0.33, 2/4=0.5),
C ->P ^ H (2/6=0.33, 2/3=0.66), P ->C ^ H (2/6=0.33, 2/4=0.5), H ^ C ->P(2/6=0.33, 2/2=1), H ^ P ->C(2/6=0.33, 2/2=1) and C ^ P-> H(2/6=0.33, 2/3=0.66).

With the confidence threshold set to 60%, the Strong Association Rules are (sorted by confidence):
1. C -> P (0.5, 1)
2. B -> H (0.33, 1);
3. H ^ C -> P(0.33, 1)
4. H ^ P ->C(0.33, 1)
5. P -> C (0.5, 0.75);
6. C -> H (0.33, 0.66);
7. C -> P ^ H (0.33, 0.66)
8. C ^ P -> H(0.33, 0.66).

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote