Market Basket Analysis (MBA) is a data mining technique used to uncover associations between items purchased together in transactions. This project aims to implement MBA using Streamlit, a Python library for creating web applications, to provide an interactive and user-friendly interface for analyzing transaction data. The data used in this application is based on data from Toko Barokah, a grocery store that was founded in 1998 and is located in Indramayu, West Java. Currently, Toko Barokah is just a small shop that sells some food and drinks.
Figure above, based on Toko Barokah transaction, shows the execution time of the Apriori and FP-Growth algorithms. The Apriori algorithm works faster in processing small data, as seen in the graph with high minimum support values, while the FP-Growth algorithm works faster when processing larger data, as determined by low minimum support values. Additionally, the difference in execution time with high minimum support values for both algorithms is almost the same. Therefore, based on the execution time results of both algorithms, FP-Growth is a suitable model for implementation into a website using Streamlit.
- Interactive dashboard for visualizing top products, gross merchandise value (GMV), and percetage of customer type
- Support for uploading transaction data
- Customizable parameters for association rule mining algorithms based on support and confidence value
- Customizable bundling product
app.py
: The main Python script containing the Streamlit application code for market basket analysis.myclass.py
: Contains of data preparation and visualization.requirements.txt
: A list of Python dependencies required for running the application. Install these dependencies usingpip install -r requirements.txt
.
- Clone the repository
git clone https://github.com/aprayogaaa/streamlit-mba.git
- Navigate into the project directory
cd streamlit-mba
- Install dependency
pip install -r requirements.txt
- Sreamlit run app.py.
streamlit run app.py
- Follow the link the localhost.
- pload your transaction data in Excel format (must follow the data template provided).
- Adjust the parameters for association rule mining (e.g., support and confidence).
- Explore the generated association rules and visualizations.
If you'd like to contribute to this project, please follow these guidelines:
- Fork the repository.
- Create a new branch
git checkout -b feature
. - Make your changes.
- Commit your changes
git commit -am 'Add new feature
. - Push to the branch
git push origin feature
. - Create a new Pull Request.