Coder Social home page Coder Social logo

alavi-sam / rfm-analysis Goto Github PK

View Code? Open in Web Editor NEW
0.0 1.0 0.0 24.12 MB

This repository contains code and analysis for performing RFM (Recency, Frequency, Monetary) analysis on retail store customer data. The analysis is followed by customer segmentation using the KMeans clustering algorithm to gain insights into customer behavior and enable data-driven marketing strategies.

Jupyter Notebook 48.00% HTML 52.00%
customer-segmentation data-analysis data-visualization kmeans kmeans-clustering machine-learning marketing pandas rfm-analysis unsupervised-learning clustering python

rfm-analysis's Introduction

Retail Customer Segmentation with RFM Analysis

Introduction

Welcome to the Retail Customer Segmentation project! In this repository, we perform an RFM (Recency, Frequency, Monetary) analysis on retail store customer data obtained from the UCI Machine Learning Repository. This analysis is followed by customer segmentation using the K-means clustering algorithm to gain insights into customer behavior and enables data-driven marketing strategies.

Dataset

The dataset used in this project comprises the following columns:

  • StockID: Identifier for items purchased.
  • InvoiceNo: Unique identifier for each purchase transaction.
  • CustomerID: Unique identifier for each customer.
  • InvoiceDate: The date of the purchase transaction.
  • UnitPrice: The price of each item.
  • Quantity: The number of items purchased.
  • Country: The country where the purchase was made.
  • Description: The name of the purchased item.

The dataset provides a comprehensive view of customer transactions, allowing us to perform meaningful RFM analysis and segmentation.

RFM Analysis

Alt text

RFM analysis is a customer segmentation technique that leverages three key metrics:

  1. Recency (R): How recently a customer made a purchase. It measures customer engagement and loyalty.
  2. Frequency (F): How often a customer makes purchases. It indicates customer activity and buying patterns.
  3. Monetary (M): The total amount a customer has spent. It quantifies the customer's value to the business.

By calculating these metrics for each customer, we gain valuable insights into their behavior. For example, a customer with high recency, frequency, and monetary value is considered a loyal and valuable customer.

Customer Segmentation

Alt text

To segment customers effectively, we employ the KMeans clustering algorithm. KMeans groups customers into clusters based on their RFM values, allowing us to identify distinct customer segments. These segments can then be targeted with tailored marketing strategies.

The key steps in the customer segmentation process include:

  • Preprocessing the data.
  • Determining the optimal number of clusters using techniques like the elbow method.
  • Applying KMeans clustering.
  • Analyzing and interpreting the results.

Usage

To run the code and replicate the analysis, follow these steps:

  1. Clone this repository to your local machine.
  2. Install the required dependencies by running pip install -r requirements.txt.
  3. Run the Jupyter Notebook customer_segmentation.ipynb.

The notebook contains detailed explanations and code for each step of the analysis.

Results

The results of the customer segmentation analysis are presented in the Jupyter Notebook. The clusters identified can be used for targeted marketing campaigns, product recommendations, and customer retention strategies.

Here are some potential actions based on the segments:

  • Legandary Customers: Offer loyalty rewards or personalized product recommendations.
  • Loyal Customers: Thank them for their loyalty, provide incentives to upgrade to legendary status.
  • Potential loyalists: Upsell higher-margin products.
  • Need Attention: Survey why purchasing dropped, provide VIP treatment, target with win-back offers.
  • Hibernate Customers: Reactivate with specialized campaigns if worth the effort, otherwise focus on other segments.

By leveraging these insights, businesses can optimize their marketing efforts and ultimately improve their bottom line.

Contributing

Contributions to this project are welcome! If you have ideas for improvements or new features, please feel free to submit issues or pull requests.


Thank you for exploring our Retail Customer Segmentation project. We hope you find the insights and code valuable for your data-driven marketing initiatives. If you have any questions or feedback, please don't hesitate to reach out!

GitHub LinkedIn

Happy analyzing and segmenting! ๐Ÿ›๏ธ๐Ÿ“Š๐ŸŽฏ

rfm-analysis's People

Contributors

alavi-sam avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.