Here's a preview of the Product Network Analysis app in action:
This Shiny web application analyzes product transactions to discover frequently purchased product pairs and visualize the relationships between them. The app uses association rule mining (Apriori algorithm) to identify frequent itemsets, and it applies community detection to find clusters of related products.
- File Upload: Upload a CSV file containing transactional data.
- Frequent Itemsets: Discover frequently purchased product pairs using the Apriori algorithm.
- Product Pair Visualization: Display a table of frequently purchased product pairs with their support counts.
- Community Detection: Visualize product clusters based on frequent itemsets using a graph network plot.
Make sure you have the following R libraries installed before running the app:
shiny
arules
igraph
tidyr
You can install them using the following commands:
install.packages("shiny")
install.packages("arules")
install.packages("igraph")
install.packages("tidyr")
The app expects a CSV file with the following columns:
order_id
: Identifier for each transaction (or order).product_id
: Identifier for each product in the transaction.
git clone https://github.com/https://github.com/Sabareh/Product-Network-Analysis-Using-R.git
Once you've cloned the repository, open the project in RStudio.
You can run the application using the runApp()
function:
library(shiny)
runApp('product_analysis/app.R')
Alternatively, open the app.R
file and click "Run App" in RStudio.
- Go to the "Transactions" tab.
- Upload a CSV file that contains transactional data (
order_id
,product_id
).
- Go to the "Product Pairs" tab.
- View a table displaying frequently purchased product pairs and their support counts.
- Go to the "Community Detection" tab.
- See a graph visualization of product clusters, using community detection algorithms to find relationships between items.
.
├── app.R # Main Shiny app code
├── README.md # Project documentation
├── data # Sample transaction data
├── images # Images for the README
Feel free to customize the application:
- Modify support or confidence thresholds for frequent itemset generation.
- Adjust the visualization settings in the "Community Detection" tab (e.g., layout, node size).
Contributions are welcome! Please submit a pull request or open an issue for any improvements or bug fixes.
This project is licensed under the MIT License.