Skip to content

The goal of this project is to analyze transactional data from a grocery store to identify patterns and associations between items frequently bought together

Notifications You must be signed in to change notification settings

Elilora/Market-basket-analysis

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Market Basket Analysis

Market Basket Analysis

Market Basket Analysis is a data mining technique used to discover associations between items in large datasets. This project demonstrates how to perform Market Basket Analysis on a grocery store dataset using Python. The goal of this project is to analyze transactional data from a grocery store to identify patterns and associations between items frequently bought together. This type of analysis can be used for various applications such as optimizing store layouts, creating targeted marketing campaigns, and improving inventory management.

Table of Contents

Installation

To get started with this project, follow the instructions below:

  1. Clone the repository:
    git clone https://github.com/Elilora/Market-basket-analysis.git
    cd Market_Basket_Analysis
    
  2. Create a virtual environment:
     python -m venv venv
     source venv/bin/activate   # On Windows, use `venv\Scripts\activate`
    
  3. Install the required packages:
    pip install -r requirements.txt
    

Usage

Follow these steps to run the Market Basket Analysis:

Prepare the data: Ensure your dataset 'groceries.csv' is placed in the project directory.

```sh
 python analyze_market_basket.py

View the results: The results will be displayed in the terminal and saved as images in the project directory.

Methodology

  1. Data Preprocessing: Read the transactional data from a CSV file. Clean and preprocess the data by handling missing values and standardizing item names.

  2. Market Basket Analysis: Apply the Apriori algorithm to identify frequent itemsets. Generate association rules based on the frequent itemsets. Calculate support, confidence, and lift for the rules.

  3. Visualization: Create a word cloud to visualize the frequency of items. Plot the association rules using matplotlib for better understanding.

Results

The project generates the following outputs:

Frequent itemsets and their support values. Association rules with confidence and lift values. A word cloud visualizing the frequency of items in transactions.

Contributing

Contributions are welcome! If you have any suggestions, bug reports, or improvements, please create an issue or submit a pull request.

Fork the repository. Create a new branch (git checkout -b feature/your-feature). Commit your changes (git commit -am 'Add your feature'). Push to the branch (git push origin feature/your-feature). Create a new Pull Request.

About

The goal of this project is to analyze transactional data from a grocery store to identify patterns and associations between items frequently bought together

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published