Customer Segmentation and Purchasing Behaviour Analysis Using RFM and K-Means Clustering | IJCSE Volume 13 β Issue 6 | IJCSE-V13I6P60
IJCSE
International Journal of Computer Science Engineering Techniques
ISSN 2455-135X Β· Peer-Reviewed Β· Open Access
π Volume 13, Issue 6
π
November 23, 2026
π Pages 498β509
π ID: IJCSE-V13I6P60
Table of Contents
ToggleCustomer Segmentation and Purchasing Behaviour Analysis Using RFM and K-Means Clustering
Author(s)
Anushka Sharma
Abstract
It is important for a retailer to understand their customersβ purchasing behaviours to keep valuable customers and create effective marketing strategies. This paper analyses customer transactions from the Online Retail II dataset, which contains 1,048,575 records and eight variables, to understand what customers buy, how often they purchase and how much they spend. After removing missing, duplicate and cancelled records, customers were described using Recency, Frequency and Monetary (RFM) measures, and the log-transformed, standardized RFM values were grouped using K-Means clustering. The Elbow method and the Silhouette score, which reached 0.44 at K = 2, supported the choice of two clusters. Cluster 0 contains 2,301 active, high-value customers (average monetary value 6,431.31, frequency 12.62, recency 51.70 days), whereas Cluster 1 contains 3,559 lapsed, lower-value customers (606.48, 2.09 and 297.50 days respectively). Exploratory analysis also shows that the United Kingdom dominates the transactions and that purchasing activity peaks in November. Based on these segments, retention and win-back marketing strategies are proposed. The study shows that RFM-based clustering is a simple and interpretable approach to customer segmentation and business decision-making.
Keywords
Customer Segmentation, Purchasing Behaviour, RFM Analysis, K-Means Clustering, Silhouette Score, Elbow Method, Online Retail
Conclusion
In this study we have analysed the Online Retail II transactions to understand customer purchasing behaviour. Some key findings from the study are: The United Kingdom had the most transactions. Data was cleaned removing missing, duplicated, cancelled and invalid records. RFM analysis showed there was a clear difference between customer recency, frequency and monetary. The Elbow method and Silhouette score (0.44) suggested there should be 2 clusters. Cluster 1 had the majority of customers (3,559). Cluster 0 had fewer customers (2,301) who were very active with the highest average frequency and monetary value. This means they are the most valuable segment. Overall we have seen there is a large difference in purchasing behaviour between different customer groups. Using descriptive analysis, RFM analysis and K-Means we can separate a small portion of highly active high value customers from a larger relatively lower value segment. This can help with targeted marketing, customer retention and making better business decisions. Understanding customer behaviour can help businesses target the right customers with the correct strategy. Some limitations to this study are that we only looked at one retailers data and mostly from one country. The Elbow curve decreased gradually meaning the number of clusters was mostly confirmed by the Silhouette score. Future work could look at more clusters, compare K-Means with hierarchical clustering, look at other features such as product category and forecasting sales.
References
[1] A. M. Hughes, Strategic Database Marketing. Probus Publishing, Chicago, IL, USA, 1994.
[2] D. Chen, S. L. Sain and K. Guo, "Data mining for the online retail industry: A case study of RFM model-based customer segmentation using data mining". Journal of Database Marketing & Customer Strategy Management, vol. 19, no. 3, pp. 197-208, 2012.
[3] A. J. Christy, A. Umamakeswari, L. Priyatharsini and A. Neyaa, "RFM ranking – An effective approach to customer segmentation". Journal of King Saud University – Computer and Information Sciences, vol. 33, no. 10, pp. 1251-1257, 2021.
[4] P. Anitha and M. M. Patil, "RFM model for customer purchase behavior using K-Means algorithm". Journal of King Saud University – Computer and Information Sciences, vol. 34, no. 5, pp. 1785-1792, 2022.
[5] "The Implementation of RFM Analysis to Customer Profiling Using K-Means Clustering". Mathematical Modelling of Engineering Problems, vol. 10, no. 1, 2023.
[6] "Exploring Customer Segmentation in E-Commerce using RFM Analysis with Clustering Techniques". Journal of Telecommunications and the Digital Economy, vol. 12, no. 3, 2024.
[7] D. Chen, "Online Retail II", UCI Machine Learning Repository, 2019. [Online]. Available: https://archive.ics.uci.edu/dataset/502/online+retail+ii
[8] J. MacQueen, "Some methods for classification and analysis of multivariate observations", in Proc. 5th Berkeley Symp. on Mathematical Statistics and Probability, Vol. 1, 1967, pp. 281-297.
[9] P. J. Rousseeuw, "Silhouettes: A graphical aid to the interpretation and validation of cluster analysis", Journal of Computational and Applied Mathematics, vol. 20, pp. 53-65, 1987.
[10] R. L. Thorndike, "Who belongs in the family?", Psychometrika, Vol. 18, No. 4, pp. 267-276, 1953.
[11] F. Pedregosa et al., "Scikit-learn: Machine learning in Python". Journal of Machine Learning Research, vol. 12, pp. 2825-2830, 2011.
[12] W. McKinney, "Data structures for statistical computing in Python", in Proc. 9th Python in Science Conf., pp. 56-61, 2010.
[13] J. D. Hunter, "Matplotlib: A 2D graphics environment". Computing in Science & Engineering, vol. 9, no. 3, pp. 90-95, 2007.
[14] A. K. Jain, "Data clustering: 50 years beyond K-means". Pattern Recognition Letters, vol. 31, no. 8, pp. 651-666, 2010.
[15] C. R. Harris et al., "Array programming with NumPy". Nature, vol. 585, pp. 357-362, 2020.
[2] D. Chen, S. L. Sain and K. Guo, "Data mining for the online retail industry: A case study of RFM model-based customer segmentation using data mining". Journal of Database Marketing & Customer Strategy Management, vol. 19, no. 3, pp. 197-208, 2012.
[3] A. J. Christy, A. Umamakeswari, L. Priyatharsini and A. Neyaa, "RFM ranking – An effective approach to customer segmentation". Journal of King Saud University – Computer and Information Sciences, vol. 33, no. 10, pp. 1251-1257, 2021.
[4] P. Anitha and M. M. Patil, "RFM model for customer purchase behavior using K-Means algorithm". Journal of King Saud University – Computer and Information Sciences, vol. 34, no. 5, pp. 1785-1792, 2022.
[5] "The Implementation of RFM Analysis to Customer Profiling Using K-Means Clustering". Mathematical Modelling of Engineering Problems, vol. 10, no. 1, 2023.
[6] "Exploring Customer Segmentation in E-Commerce using RFM Analysis with Clustering Techniques". Journal of Telecommunications and the Digital Economy, vol. 12, no. 3, 2024.
[7] D. Chen, "Online Retail II", UCI Machine Learning Repository, 2019. [Online]. Available: https://archive.ics.uci.edu/dataset/502/online+retail+ii
[8] J. MacQueen, "Some methods for classification and analysis of multivariate observations", in Proc. 5th Berkeley Symp. on Mathematical Statistics and Probability, Vol. 1, 1967, pp. 281-297.
[9] P. J. Rousseeuw, "Silhouettes: A graphical aid to the interpretation and validation of cluster analysis", Journal of Computational and Applied Mathematics, vol. 20, pp. 53-65, 1987.
[10] R. L. Thorndike, "Who belongs in the family?", Psychometrika, Vol. 18, No. 4, pp. 267-276, 1953.
[11] F. Pedregosa et al., "Scikit-learn: Machine learning in Python". Journal of Machine Learning Research, vol. 12, pp. 2825-2830, 2011.
[12] W. McKinney, "Data structures for statistical computing in Python", in Proc. 9th Python in Science Conf., pp. 56-61, 2010.
[13] J. D. Hunter, "Matplotlib: A 2D graphics environment". Computing in Science & Engineering, vol. 9, no. 3, pp. 90-95, 2007.
[14] A. K. Jain, "Data clustering: 50 years beyond K-means". Pattern Recognition Letters, vol. 31, no. 8, pp. 651-666, 2010.
[15] C. R. Harris et al., "Array programming with NumPy". Nature, vol. 585, pp. 357-362, 2020.
π How to Cite This Paper
Anushka Sharma (2026). Customer Segmentation and Purchasing Behaviour Analysis Using RFM and K-Means Clustering. International Journal of Computer Science Engineering Techniques, 13(6), 498β509. ISSN: 2455-135X. DOI: https://doi.org/10.5281/zenodo.24474421
