The Retail Recommender System is a Shiny-based web application that provides recommendations for cross-sell opportunities using association rule mining. Built with R, it analyzes customer transaction data, extracts purchasing patterns, and generates rules for cross-sell recommendations. The app is designed to provide business insights, particularly in retail environments, by leveraging market basket analysis.
- Transaction Data Analysis: Loads transactional data from CSV files and processes it using the
arules
package for association rule mining. - Cross-Sell Rule Discovery: Applies the Apriori algorithm to identify frequent itemsets and generates rules to highlight cross-sell opportunities.
- Interactive Visualization: Provides interactive plots and graphs to explore the generated rules.
- Customizable Thresholds: Allows users to adjust support and confidence thresholds via a simple UI to fine-tune rule generation.
- Explore Panel: View and analyze the generated rules based on support, confidence, and lift.
- R Programming Language
shiny
: For creating the web application.arules
: For implementing association rule mining.plotly
: For creating interactive plots.igraph
: For visualizing rule relationships using graphs.arulesViz
: For visualizing association rules.
To run this project locally, follow these steps:
-
Clone the Repository
git clone https://github.com/sabareh/retail-recommender-system.git cd retail-recommender-system
-
Install Dependencies Make sure you have R installed on your machine. Install the required packages:
install.packages(c("shiny", "plotly", "arules", "igraph", "arulesViz", "DT"))
-
Run the Application
runApp('Recommender-App')
-
Access the App Once the application starts, access it by navigating to
http://127.0.0.1:6849
in your web browser, whereXXXX
is the port number displayed in the console.
Retail-Recommender-System/
│
├── data/
│ └── data.csv # Sample transaction data
├── Recommender-App/
│ ├── app.R # Main Shiny app file
│ └── ...
├── README.md # Project documentation
└── LICENSE # License information
Ensure the data.csv
file follows the below structure:
order_id | product_id |
---|---|
1 | A |
1 | B |
2 | A |
2 | C |
3 | B |
3 | D |
You can modify the data to fit your retail environment, using unique identifiers for products and orders.
- Transaction Loading: The app reads in transaction data from a CSV file.
- Apriori Algorithm: The Apriori algorithm finds frequent itemsets and generates rules with specified support and confidence thresholds.
- Visualization: The app displays rules in tabular form and as interactive graphs, allowing for deeper exploration.
Contributions are welcome! To contribute:
- Fork the repository.
- Create a new feature branch (
git checkout -b feature/your-feature
). - Commit your changes (
git commit -m 'Add feature'
). - Push to the branch (
git push origin feature/your-feature
). - Open a pull request.
This project is licensed under the MIT License. See the LICENSE file for more details.
For any inquiries or issues, feel free to reach out:
- Victor Oketch Sabare
- Email: [email protected]
This README provides a detailed overview of your project, including instructions for installation, usage, and contribution, as well as a sample structure and visualizations to make the repository more accessible for users and contributors.