Question: Case Study : Pizzeria Shop Let us consider a pizzeria which sale 2000 pizzas classified according to their type as the following: 100 pizzas with
Case Study : Pizzeria Shop
Let us consider a pizzeria which sale 2000 pizzas classified according to their type as the following:
- 100 pizzas with mushrooms,
- 150 pizzas with peppers,
- 200 pizzas with cheeses,
- 400 pizzas with mushrooms AND peppers,
- 200 pizzas with peppers AND cheeses,
- 300 pizzas with mushrooms AND cheeses.
- 100 pizzas with mushrooms AND peppers AND cheeses.
- 550 pizzas sealless.
Question: Apply the different steps of Market Basket Analysis (MBA) process to this Pizzeria Shop.
Answer:
The different steps of Market Basket Analysis (MBA) process are the following:
- Select the relevant items.
- Achieve the Co-occurrence matrix.
- Generate association rules.
- Calculating rules Confidence.
- Calculating rules Lift.
- Select the rules having Lift > 1
- Negated result for rules having low Lift and high Confidence.
- Select the relevant items : Relevant item are selected according to the sale of the Pizzeria Shop. So mushrooms, peppers and cheeses are the relevant item.
- The Co-occurrence matrix: Table 1 gives the Co-occurrence matrix of pizzeria
|
| mushrooms | peppers | cheeses |
| mushrooms | 900 | 500 | 400 |
| peppers | 500 | 850 | 300 |
| cheeses | 400 | 300 | 800 |
Table 1: The Co-occurrence matrix of pizzeria
- Generate association rules :
- R1 : IF (mushrooms) THEN (peppers)
- R2 : IF (mushrooms) THEN (cheeses)
- R3 : IF (peppers) THEN (cheeses)
- R4 : IF (peppers) THEN (mushrooms)
- R5 : IF (cheeses) THEN (mushrooms)
- R6 : IF (cheeses) THEN (peppers)
- R7 : IF (cheeses AND mushrooms) THEN (peppers)
- R8 : IF (mushrooms AND peppers) THEN (cheeses)
- R9 : IF (cheeses AND peppers) THEN (mushrooms)
- R10 : IF (mushrooms) THEN (peppers AND cheeses)
- R11 : IF (peppers) THEN (mushrooms AND cheeses)
- R12 : IF (cheeses) THEN (mushrooms AND peppers)
In fact :
R1, R2 ans R3 are extracted from the co-occurrence matrix of pizzeria.
R4 is derived rule from R1.
R5 is derived rule from R2.
R6 is derived rule from R3.
R7 is a derived rule from R1 and R6.
R8 is a derived rule from R2 and R3.
R9 is a derived rule from R4 and R5.
R10 is a derived rule from R1 and R2.
R11 is a derived rule from R3 and R4.
R12 is a derived rule from R5 and R6.
- Calculating of the Confidence:
The Confidence is the percentage of antecedent transactions that also have the consequent item set. Let us consider the general format of any Association Rule: IF (antecedent) THEN (consequent)
Confidence = P(antecedent AND consequent)/P(antecedent)
- Calculating of the Lift:
Lift = Confidence/(benchmark confidence) = Confidence/ P(consequent)
Benchmark confidence = transactions with consequent as percentage of all transactions = P(consequent)
Lift > 1 indicates a rule that is useful in finding consequent items sets (i.e., more useful than just selecting transactions randomly)
- Select the rules having Lift > 1:
The calculus of Confidence and Lift for the different rules R1, ..., R12 is given by Table 2.
The rules R1, R2, R4 and R5, having the Lift>1, are useful in finding consequent items sets.
| Rules | Confidence | Lift |
| R1 | 55.55 % | 1.3 |
| R2 | 44.44 % | 1.11 |
| R3 | 35.30 % | 0.88 |
| R4 | 58.82 % | 1.30 |
| R5 | 50.00 % | 1.11 |
| R6 | 37.50 % | 0.88 |
| R7 | 25.00 % | 0.58 |
| R8 | 20.00 % | 0.50 |
| R9 | 33.33 % | 0.74 |
| R10 | 11.11 % | 0.74 |
| R11 | 11.70 % | 0.58 |
| R12 | 12.50 % | 0.50 |
Table 2: Calculus of Confidence and the Lift
- Negated result for rules having low Lift and high Confidence
According to results shown in table 2, the rules R3, R6 and R9 have low Lift and high Confidence comparing to R7, R8, R10, R11, and R12. Consequently, we will transform these 3 rules into new ones R3, R6 and R9 by negating their results in order to improve their Lift greater than 1. In this case, these 3 new rules R3, R6 and R9 will be useful in finding consequent items sets.
On the other hand, the rules R10, R11 and R12 have a few Confidence. Consequently, they cannot not be useful in finding consequent items sets and there is no need to transform them in new rules by negating their results.
We present in the following detail for calculus:
For R3 : R3 : IF (peppers) THEN (cheeses)
Confidence = P (peppers AND cheeses) / P(peppers)
= (P(peppers) P(peppers AND cheeses))/P(peppers)
= (0.425-0.15)/0.425 = 0.647
Lift = Confidence / P (cheeses)
= Confidence /(1-P(cheeses)
= 0.647/(1-0.4) = 1.078 > 1
For R6 : R6 : IF (cheeses) THEN (peppers)
Confidence = P (cheeses AND peppers ) / P(cheeses)
= (P(cheeses) P(cheeses AND peppers))/P(cheeses)
= (0.4 0.15)/0.4 = 0.625
Lift = Confidence / P (peppers)
= Confidence / (1 P(peppers))
= 0.625 /(1-0.425) = 1.086 > 1
For R9 : R9 : IF (cheeses AND peppers) THEN (mushrooms)
Confidence = P( cheeses AND peppers AND mushrooms) / P(cheeses AND peppers)
Or :
P(cheeses AND peppers AND mushrooms) = P(cheeses AND peppers) P(cheeses AND peppers AND mushrooms)
= (300 -100)/2000 = 0.1
So : Confidence = 0.1 /( 300/2000) = 0.66
Lift = Confidence / P(mushrooms) = 0.66 /(1100 / 2000) = 1.2 > 1
Appendix:
P(A) = 1 - P(A)
P(A and B) = P(A) P(A and B)
P(A and B and C) = P(A and B) P(A and B and C)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
