Customer Segmentation in E-Commerce Based on the Recency, Frequency, and Monetary (RFM) Model and K-Means Clustering
Abstract
Reliable customer segmentation is difficult when studies report final clusters without showing how data cleaning and cluster-number choices affect validity. This study examines customer segmentation in e-commerce using the Recency, Frequency, and Monetary (RFM) model and K-Means clustering. The Online Retail II dataset contains 1,067,371 invoice-line records from 1 December 2009 to 9 December 2011. After removing missing customer identifiers, cancelled invoices, and non-positive quantities or prices, 805,549 valid purchase rows and 5,878 customers remained. RFM indicators were log-transformed, standardized, and clustered with candidate values from k = 2 to k = 8. Although k = 2 achieved the highest silhouette score (0.440), k = 4 was retained as a more interpretable exploratory solution with a positive silhouette score (0.365). The four segments reveal strong value concentration: high-value loyal customers represent 19.0% of customers but 72.2% of valid spending, while dormant low-value customers represent 35.0% of customers but only 4.0% of spending. The results show how a transparent RFM-based workflow can support retention and reactivation priorities while requiring experimental validation before managerial deployment.