International Journal of Scientific Research in Science and Technology
Print ISSN: 2395-6011 | Online ISSN: 2395-602X ([Link])
doi : [Link]
Customer Segmentation using RFM Model and K-Means Clustering
Rahul Shirole, Laxmiputra Salokhe, Saraswati Jadhav
Department of Computer Engineering, Vishwakarma Institute of Technology Pune, Maharashtra, India
ABSTRACT
Article Info Today as the competition among marketing companies, retail stores, banks to
Volume 8, Issue 3 attract newer customers and maintain the old ones is in its peak, every
Page Number : 591-597 company is trying to have the customer segmentation approach in order to
have upper hand in competition. So Our project is based on such customer
Publication Issue clustering method where we have collected, analyzed, processed and visualized
May-June-2021 the customer’s data and build a data science model which will help in forming
clusters or segments of customers using the k-means clustering algorithm and
Article History RFM model (Recency Frequency Monetary) for already existing customers. The
Accepted : 03 June 2021 input dataset we used is UK’s E-commerce dataset from UCI repository for
Published : 10 June 2021 Machine Learning which is based on customer’s purchasing behavioral. At the
very simple the customer clusters would be like super customer, intermediate
customers, customers on the verge of churning out based on RFM score .Along
with this we also have created a web model where an e-commerce startup or e-
commerce business analyst can analyze their own customers based on model
we created .So using this it will be easy to target customers accordingly and
achieve business strength by maintaining good relationship with the
customers .
Keywords - RFM, Clustering, Silhouette Index.
I. INTRODUCTION Every customer is different, here different in the
sense we are talking about their age, location,
The focus of many companies is to provide the best psychology but the most potential parameter is it’s
product along with quality service to stand out in the purchasing behavior .Therefore, every segment of
market. But along with their quality service and customer requires different product at different price.
better product they also have to make sure that Therefore, every group of customer requires different
customer don’t slip out in search of alternatives marketing strategy, to develop different we first have
because company exists cause of them and they create to group similar customer in one segments.
every company market share which generates
revenue and profits for the company. The use of data mining techniques is one of the way
to solve the problem of customer segmentation for
Copyright: © the author(s), publisher and licensee Technoscience Academy. This is an open-access article distributed under the 591
terms of the Creative Commons Attribution Non-Commercial License, which permits unrestricted non-commercial use,
distribution, and reproduction in any medium, provided the original work is properly cited
Rahul Shirole et al Int J Sci Res Sci & Technol. May-June-2021, 8 (3) : 591-597
developing new market strategy. Data mining is model. They form 2 Clusters from dataset of 82648
extremely powerful tool and has change many entries.
companies’ fortune. Identification of customers is Other research was done in PD karya Mulya [2]a local
based on data collect from customers and grouping wood product company. The segmentation was done
them in some meaningful order. Clustering based on the sales transaction the same company as
[1][2][3][4][5]is a task of diving or grouping customer the company grew a lot faster than expected. This also
on the basis of their interaction with the company uses k-means based on RMF model and form cluster
either direct or indirect. Here customer data can be of 3. Clustering was done to identify the profit-
anything like time spend on social media platform, making costumer and develop the marketing strategy
transaction data, time spend on particular post but accordingly.
this paper focuses on the transaction data of a In this research they have investigated the scope of
customer of UK online retail ecommerce . There are the customer value based on current value, cross-
several other attributes in the dataset but one need to selling probability and customer loyalty, this paper
make a good selection of these attribute to get optimal user uses neural network approach which uses Self
results. To overcome this problem many of the data Organization Map (SOM) to form clusters for banking
scientists prefer to use K-means algorithm which is a use.[3]
(unsupervised learning) along with RFM model[1][2]. This paper is to segment customer based on
RFM stands for recency, frequency and monetary transaction from a supermarket which include 200
values of a given customer. Now, the data that has data entries. Here the clustering was done to help
been collected can be a base for segmentation of retail industry to develop new market strategy [4].
customers. This paper user Hierarchical clustering algorithm
which does not prerequire information about no of
The aim of this paper is to find out the type of clusters required.
customer (super customer, intermediate customers, This paper user DBSCAN algorithm to segment
base customers) and to determine the value of customer. Which uses wholesale customers dataset of
customers so that companies can decide which class 440 entries to analyze the spending habit of customer.
of customer generate healthy revenue and which do As we know K-means algorithm forms on well-spaced
not, and also what new market strategy they can and circular shaped clusters, but in real life clusters
apply to improve their revenue growth. can be arbitrary and k-means can give best possible
clusters. So, the use of DBSCAN algorithm is made
II. LITERATURE SURVEY here.[5]
There are some previous studies related to the III. METHODOLOGY
segmentation of customer some of them are listed
below: STEP 1 : Business Understanding
Stages of business focus on understanding the purpose
In some pervious studies published in 2018 [1] and of needs based on business valuation. After
was published by students of Bina Sarana University. understanding the business initial data mining plan is
This paper is to segment customer based on their designed to reach the goal. The study of this paper is
credit taken from the company called Nine reload. of an online retail E-commerce website of a UK retail.
The algorithm used here is k-means based on RFM The transaction are of year 2010 and 2011.
International Journal of Scientific Research in Science and Technology ([Link]) | Volume 8 | Issue 3 592
Rahul Shirole et al Int J Sci Res Sci & Technol. May-June-2021, 8 (3) : 591-597
Table 1. Sample Dataset STEP 3 : Data Preparation
Data preparation consists of Data
cleansing/preprocessing, Data visualization[2].
Removing errors, filling missing values, dropping
negative transaction are all done in this phase of data
science lifecycle.
STEP 2 : Data Understanding
After the data is collected, we have be familiar with
the data what actually the data. In this paper as said
earlier we are using an online retail E-commerce
website of a UK retail which consists of sales
transaction from December 2010 to December
2011[1]. The dataset has 7 attributes which are listed
below in table 1:
Table 1. Attributes during Data Understanding
No Attribute Description
1 Invoice No Invoice No which is auto
generated by Software,
and Invoice no preceding
C indicate Cancelled
order
2 Stock Code A Stock code definition
an items of stock on stock
quotation scheme. Made
of Alphanumeric
characters Figure 1. Block Diagram
3 Description Description of item
purchased by customer Data Pre-processing
4 Quantity Quantity of purchased
item on an single order • Generally In real world data is not proper like it
5 Invoice Date Date and time of purchase may be incomplete, inconsistent and contains
of an item by Customer
errors .Also if there is missing attributes, attribute
6 Unit Price Unit product price
values or contains duplicate and wrong data then
7 Country Country to which product
is to be shipped it is called as unclean data.[3]
International Journal of Scientific Research in Science and Technology ([Link]) | Volume 8 | Issue 3 593
Rahul Shirole et al Int J Sci Res Sci & Technol. May-June-2021, 8 (3) : 591-597
• So this behaviours degrade the quality of the STEP 4 : Modelling
result In this research paper we are using K -means
• Hence we have to pre-process the data to use it algorithm for clustering because of it simplicity and
more efficiently. We need to transform raw data advantageous over other algorithm.
into understandable format and this technique is K-Means Algorithm
called as Data Pre-processing..
K-means is the mostly popular and widely used
• In Data Pre-processing we remove the null values algorithm for grouping data into groups to get right
, missing values and the outliers from given data number of clusters.[1][2]
to make it a clean data.[3]
K-means is an iterative Algorithm which try to
partition the data into k distinct groups. Here K is the
Data Visualization number of clusters to be formed which is
predetermined by Elbow method which we will
• The graphical representation of data is Data discuss further in the paper.
Visualization. Visual elements such as graphs,
Clustering Steps to follow while using K -means
maps and charts are used for data visualization.
Algorithm:
• It provides us an accessible way to understand
and analyze trends, patterns in data and outliers • Predetermine Number of clusters K.
too. • Initialize Centroid by randomly selecting K data
• When we have such big data, data visualization points.
technologies and tools are necessary to analyze • Compute the distance of the next data points with
huge amount of information. And thus, making all centroids.
data driven decisions. • Assign the data point to the nearest cluster
• Repeat this step until all data points converges to
RFM Model a cluster.
Formula for Centroid Determination:
• Recency, frequency and monetary values are Ci = 1/M ∑j=1m Xj
analysis tools being used to identify any
Formula for Euclidean Distance
organisation's best customers[1][2]. RFM Model
has 3 factors: d (p, q) = √(p1-q1)2 + (p2-q2)2
• Recency: How recently customer made a buy.
Elbow Method
• Frequency: How often customer buys.
• Monetary: how much amount customer buys. Elbow method is used to determine the optimal
• Model ranks customers in each of these categories. number of clusters based on the dataset. The idea is
simple behind it, i.e., plotting the SSE (Sum squared
Error) against suitable no of cluster value. Then we
Table 3. Snapshot of Customer Transaction Data
will select the value at which there is maximum curve
in the graph[2].
STEP 5: Evaluation
Evaluation is a major aspects of any machine learning
model. To know your model produces the right
output with correct accuracy.
International Journal of Scientific Research in Science and Technology ([Link]) | Volume 8 | Issue 3 594
Rahul Shirole et al Int J Sci Res Sci & Technol. May-June-2021, 8 (3) : 591-597
Silhouette Index
Silhouette Index is a value which is used to check the
interpretation and validation consistency within
clusters of data. This method/technique a brief
graphical Representation of how well each object in a
dataset is classified. Silhouette Index measures how
similar is the object to its own cluster compared to
other clusters. Silhouette value ranges between -1 to
+1, high value indicates object is well matched and
vice versa. Silhouette Index is useful to determine the
right cluster configuration, i.e., if many points have
Figure 2 Web Model using Streamlit
low or negative then clustering configuration may
have many or few clusters[1].
IV. RESULT
The Formula is :
S(i) = bi-ai / max (bi, ai) Based on the results of our model are from the data of
UK online retail store from December 2010 to dec
where:
2011 which consists of total 13 months. The data
bi = The average distance between i and the same consists of total 4 attributes which are listed above in
cluster. Table 3.
ai = The average distance between i with different After the data was prepared there was still some
clusters. skewness of data in RMF model which required
further modification to reduce the skewness of the
Max (bi, ai) = Average distance between bi with ai.
data.
I. STEP 6: Web Model
So based on this data science model we have also
created a web model where any E-commerce based
analyst, start-up can analyse it’s own customers by
just feeding it’s customer dataset to our website and
the detailed analysis of those customers will be made.
So that will help them to know more about their
customers and they can make business strategies
based on that thereby avoiding future churn of less
responsive customers, giving different attention to
potential customers etc.
Figure 3 Skewness in RFM Model
International Journal of Scientific Research in Science and Technology ([Link]) | Volume 8 | Issue 3 595
Rahul Shirole et al Int J Sci Res Sci & Technol. May-June-2021, 8 (3) : 591-597
Figure 4 Normalized in RFM Model
After cluster testing the calculation of the silhouette
index is continued by measuring the similarities of
data points with its own cluster and other clusters as Figure 6 Clustering
well.
V. CONCLUSION
Based on the process of making a customer
segmentation which is based on RFM model using K-
means algorithm on a transaction data of a UK online
retail store, we categorised the customer into 4
clusters based on the characteristics. These 4 clusters
are basically Class A, Class B, Class C and Class D.
Where Class A generates the highest revenue and
Class D least. Customer segmentation is a very
powerful tool to get the business insights and on how
Figure 5 Elbow Graph the customer behave. The value of silhouette index is
0.442 which is considered as good for the given
Based on the Elbow Method we can see that the right dataset. Based on this result we obtained, this can
number of clusters is 4 which is showing the highest help the company to develop market strategies and
silhouette value. also can use as a promotional medium to their loyal
Figure 5 Displays the final output of our model which customers. There are many other tools and method
has grouped the data in 3,4,5 clusters. which can be used as comparison to the system that
are already developed.
International Journal of Scientific Research in Science and Technology ([Link]) | Volume 8 | Issue 3 596
Rahul Shirole et al Int J Sci Res Sci & Technol. May-June-2021, 8 (3) : 591-597
VI. REFERENCES
[1]. Tushar Kansal; Suraj Bahuguna; Vishal Singh;
Tanupriya ChoudhuryCustomer, “
Segmentation based on RFM model and
Clustering Techniques With K-Means
Algorithm”, IEEE 2018
[2]. Muhammad Iqbal Dzulhaq ,Kartika Wulan Sari,
Syaipul Ramdhan, Rahmat Tullah ,Sutarman,”
Customer Segmentation Based on RFM Value
Using K-Means Algorithm”, ICIC 2019
[3]. Chaohua Liu,”Customer Segmentation and
Evaluation Based On RFM, Cross- selling and
Customer Loyalty”, IEEE 2011
[4]. Shreya Tripathi1, Aditya Bhardwaj ,
Poovammal,” Approaches to Clustering in
Customer Segmentation”, IJET 2018
[5]. A.S.M. Shahadat Hossain,”Customer
Segmentation using Centroid Based and Density
Based Clustering Algorithms”, IEEE 2017
Cite this article as :
Rahul Shirole, Laxmiputra Salokhe, Saraswati Jadhav,
"Customer Segmentation using RFM Model and K-
Means Clustering", International Journal of Scientific
Research in Science and Technology (IJSRST), Online
ISSN : 2395-602X, Print ISSN : 2395-6011, Volume 8
Issue 3, pp. 591-597, May-June 2021. Available at
doi : [Link]
Journal URL : [Link]
International Journal of Scientific Research in Science and Technology ([Link]) | Volume 8 | Issue 3 597