rppradhan08 / rfm-segmentation

Behavioral segmenting customers of online retail store based on Recency-Frequency-Monetary (RFM) metrics and K-Means clustering.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

GitHub Repo stars GitHub forks contributors-shield LinkedIn


Customer Segmentation
Customer Segmentation

Table of Contents

About the Project

In this project, I have used E-Commerce dataset from Kaggle to perform RFM Analysis and used K-means clustering to segment customers into different clusters based on their behavioral characteristics.

Business Problem

As a manager of the online store, you would want to group the customers into different clusters, so that you can make a customized marketing campaign for each of the groups. You would have to decide what the important business criteria are on which you would want to segregate the customers. This is a transnational data set that contains all the transactions occurring between 01/12/2010 and 09/12/2011 for a UK-based and registered non-store online retail. The company mainly sells unique all-occasion gifts. Many customers of the company are wholesalers.

Task

  • Decide the important business criteria to segregate the customers
  • Group customers into clusters to run targeted campaigns

Approach

Customer segmentation can be grouped into 3 types i.e. demographic segmentation, attitudinal segmentation, and behavioral segmentation. The idea is to segment customers based on when their last purchase was, how often they’ve purchased in the past, and how much they’ve spent overall. All three of these measures have proven to be effective predictors of a customer's willingness to engage in marketing messages and offers. In this scenario, since we have the customer's purchase history available with us it's easy to move forward with behavioral segmentation. In B2C business, RFM i.e. Recency-Frequency-Monetary are the most commonly used metrics to measure a customer's purchase behavior. Upon deriving the RFM metrics, the K-means algorithm is used to perform clustering.

RFM Segmentation

Steps Involved

  1. Overview and understanding of data
  2. Data preprocessing
  3. Data preparation for modeling
  4. Cluster assignment using K-means clustering
  5. Recommendations

Getting Started

Installations

Firstly, execute the below commands in the terminal for setting up the virtual environment and installing packages:

  1. Create a virtual environment
python3 -m venv env
  1. Activate newly created virtual environment env
env/Scripts/activate.bat
  1. Execute the below command to install python packages used in this project
pip install requirement.txt

Overview and understanding of data

Getting familiar with the data and performing descriptive statistics to identify inconsistencies in the dataset.

Data Preprocessing

Dealing with missing values and inconsistencies in data to make the data uniform. Formatting columns to required data types for easier data transformations.

Data Preparation

Before we start with data modeling, we have to group transactions at the customer level and calculate their R-F-M metrics. Once metrics are calculated data preparation pipelines are created for scaling and dimensionality reduction.

Cluster assignment using K-means clustering

Choosing the appropriate number of clusters depends on business understanding and domain expertise. However in this case we use techniques like Elbow curve and silhouette analysis for determining the optimal number of clusters.

Elbow curve

After cluster assignment, the following are the unique characteristics traits that were observed:

  • Cluster 0 contains the customers who generate the least revenue and are not frequent, most likely because these were one-time customers. Hence they can be labeled as Slipping.
  • Cluster 1 seems to have the most loyal customers, as they bring the most revenue and are often the most frequent customers.
  • Cluster 2 customers seem promising as it consists of frequent buyers. However, revenue generation is not as high as Loyal customers.
cluster profiling

Finally, after cluster profiling below was the distribution of customers across clusters:

target distribution

Recommendations

After segmenting customers into loyal, slipping, and promising it empowers businesses to run personalized, high-performing campaigns and preserves profit margin. Below are a few recommendations or targeted strategies for each customer segment:

  • Loyal - Loyalty programs are effective for these repeat visitors. Advocacy programs and reviews are also common X1X strategies. Lastly, consider rewarding these customers with Free Shipping or other like benefits.

  • Promising - Focus on increasing monetization through product recommendations based on past purchases and incentives tied to spending thresholds.

  • Slipping - Customers leave for a variety of reasons. Depending on your situation price deals, new product launches, or other retention strategies.

Contacts

Socials : Linkedin
E-mail : rppradhan310@gmail.com

About

Behavioral segmenting customers of online retail store based on Recency-Frequency-Monetary (RFM) metrics and K-Means clustering.

License:MIT License


Languages

Language:Jupyter Notebook 100.0%