Back to Main
06 August 2025

Building a Recommendation System with Apriori and FP-Growth

https://img.shields.io/badge/Flask-000000?style=plastic&logo=flask&logoColor=white https://camo.githubusercontent.com/4dce60ea89cb3aa057821308adb53572bda116e55488689f85cd4d2059c95d62/68747470733a2f2f696d672e736869656c64732e696f2f62616467652f707974686f6e2d3336373041303f7374796c653d706c6173746963266c6f676f3d707974686f6e266c6f676f436f6c6f723d666664643534 https://img.shields.io/badge/OpenPyXL-217346?style=plastic&logo=data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgAgMAAAAOFJJnAAAACVBMVEVGUViMoa/i5+sa4fYGAAAAKklEQVR4AWPAAxhDQx1WrVrVgI0RwOqwgAEvgxbaEQy4GkwGhnbCDNwAAKEvTZMFFgusAAAAAElFTkSuQmCC&logoColor=white https://img.shields.io/badge/Pandas-150458?style=plastic&logo=pandas&logoColor=white https://img.shields.io/badge/MySQL-4479A1?style=plastic&logo=mysql&logoColor=white
Cover
     The Recommendation System with Apriori and FP-Growth is a web-based data mining application designed to analyze customer purchasing patterns from cosmetic product transactions. The system applies two widely used Association Rule Mining, algorithms Apriori and FP-Growth to discover relationships between products that are frequently purchased together.

🎯  Objectives 

 The recommendation system is developed with several primary objectives: 
  1. Analyze purchasing patterns from cosmetic product transaction data.
  2. Discover associations between products frequently bought together. 
  3. Generate recommendation rules based on minimum support and confidence values.  Compare the performance of Apriori and FP-Growth algorithms. 
  4. Assist businesses in designing optimal product layouts for cross-selling. 
  5. Provide visual insights through statistical dashboards and comparison charts.

📌  Workflow

The overall workflow consists of the following stages: 
  1. Upload cosmetic transaction dataset (CSV).
  2. Validate and preview transaction records. 
  3. Perform data preprocessing (cleaning, basket transformation, one-hot encoding, optional train-test split). 
  4. Configure minimum support and confidence values. 
  5. Execute the Apriori algorithm. 
  6. Execute the FP-Growth algorithm. 
  7. Generate frequent itemsets and association rules. 
  8. Compare algorithm performance through charts and statistical summaries. 
  9. Produce product placement recommendations. 
  10. Draw conclusions and identify the most suitable algorithm based on the experimental results.

⚙️ Algorithms Implemented

1.  Apriori Algorithm
The Apriori algorithm identifies frequent itemsets by generating candidate combinations iteratively.
Characteristics
  •  Uses iterative candidate generation. 
  •  Prunes infrequent itemsets based on minimum support. 
  •  Generates association rules using confidence values. 
  •  Easy to understand and implement. 
  •  Computational cost increases significantly as the dataset grows. 
Advantages
  •  Simple methodology. 
  •  Well-established algorithm. 
  •  Suitable for small and medium-sized datasets. 
Limitations
  •  Generates many candidate itemsets. 
  •  Multiple database scans. 
  •  Less efficient for large datasets. 

2.  FP-Growth Algorithm
FP-Growth (Frequent Pattern Growth) improves efficiency by avoiding repeated candidate generation.
Instead of creating numerous candidate combinations, FP-Growth compresses the transaction database into a compact Frequent Pattern Tree (FP-Tree).
Characteristics
  •  Uses FP-Tree structure. 
  •  Requires fewer database scans. 
  •  Eliminates repetitive candidate generation. 
  •  Performs efficiently on large datasets. 
Advantages
  •  Faster execution. 
  •  Lower memory consumption. 
  •  Better scalability. 
  •  Suitable for large transaction datasets. 
Limitations
  •  FP-Tree construction is more complex. 
  •  More difficult to understand compared to Apriori. 
Home Projects Experience Gallery Blog Contact Map