- Year not given · 4+8 marks
Apriori on restaurant orders
Short answer
Apriori with min support 2 on restaurant orders. L1={Beer,buff,coke,lemon,peanut}. L2={Beer-lemon, Beer-peanut, buff-coke, buff-lemon, coke-lemon, coke-peanut}. L3={buff,coke,lemon} (count 2). Pruning removes candidates with infrequent subsets like lemon-peanut. Algorithm stops as no C4 possible.
Write the A-priori algorithm with its pruning principle. Find the candidate and large item sets from the following transaction in a restaurant using A-priori algorithm. (Min. support: 2)
| Transaction ID | Order Combination |
|---|---|
| 1 | Beer, chicken, peanut |
| 2 | Whisky, buff, coke, lemon |
| 3 | Beer, buff, coke, lemon |
| 4 | Buff, coke, peanut |
| 5 | Beer, peanut, lemon, fish |
| 6 | Peanut, coke |
Apriori algorithm and pruning principle
Apriori principle: if an itemset is frequent, all its subsets are frequent; so if an itemset is infrequent, no superset of it can be frequent. This pruning removes candidates without counting them.
L1 = frequent 1-itemsets (scan database)
for k = 2; L(k-1) not empty; k++:
Ck = join L(k-1) with itself
prune candidates having an infrequent (k-1)-subset
scan database, count Ck
Lk = candidates with count >= min_support
return all Lk
Solution (minimum support = 2 transactions)
Transactions: T1 {Beer, chicken, peanut}; T2 {Whisky, buff, coke, lemon}; T3 {Beer, buff, coke, lemon}; T4 {buff, coke, peanut}; T5 {Beer, peanut, lemon, fish}; T6 {peanut, coke}.
C₁ and L₁
| Item | Count | Frequent? |
|---|---|---|
| Beer | 3 | Yes |
| chicken | 1 | No |
| peanut | 4 | Yes |
| Whisky | 1 | No |
| buff | 3 | Yes |
| coke | 4 | Yes |
| lemon | 3 | Yes |
| fish | 1 | No |
L₁ = {Beer, buff, coke, lemon, peanut}
C₂ (all 10 pairs of L₁) and L₂
| Itemset | Count | Frequent? |
|---|---|---|
| Beer, buff | 1 | No |
| Beer, coke | 1 | No |
| Beer, lemon | 2 | Yes |
| Beer, peanut | 2 | Yes |
| buff, coke | 3 | Yes |
| buff, lemon | 2 | Yes |
| buff, peanut | 1 | No |
| coke, lemon | 2 | Yes |
| coke, peanut | 2 | Yes |
| lemon, peanut | 1 | No |
L₂ = {Beer-lemon, Beer-peanut, buff-coke, buff-lemon, coke-lemon, coke-peanut}
C₃ (join of L₂ pairs having the same first item, then prune)
| Candidate | From | All 2-subsets frequent? | Count |
|---|---|---|---|
| Beer, lemon, peanut | Beer-lemon + Beer-peanut | No (lemon-peanut) → pruned | - |
| buff, coke, lemon | buff-coke + buff-lemon | Yes | 2 (T2, T3) |
| coke, lemon, peanut | coke-lemon + coke-peanut | No (lemon-peanut) → pruned | - |
L₃ = {buff, coke, lemon} (count 2). No C₄ can be formed, so the algorithm stops.
Answer: candidate sets C₁, C₂, C₃ as above. Large (frequent) itemsets: L₁ = {Beer, buff, coke, lemon, peanut}; L₂ = the six pairs; L₃ = {buff, coke, lemon}.
✓ Answer checked by Claude Opus 5.5 (high effort)
Related questions
- Apriori on four transactions, support 2 · Data Mining, chapter 4
- Association analysis and Apriori pruning · Data Mining, chapter 4 · asked 2×
- Apriori on t1-t5 with rules · Data Mining, chapter 4
- Apriori on 8 transactions, 25% support · Data Mining, chapter 4
- Apriori on HotDogs data with rules · Data Mining, chapter 4
- FP-Growth and Apriori disadvantage · Data Mining, chapter 4
- Restaurant information system requirements · Software Engineering, chapter 1
- Second-order non-linear kinematic wave; FDM principle · Computational Techniques in Civil Engineering, chapter 5
- Triangulation principle; 1st order trilateration · Surveying I, chapter 8
- Triangulation principle; third-order specifications · Surveying I, chapter 8