Analysis of sales patterns and product segmentation using k-means clustering and linear regression
Keywords:
Data Mining; K-Means Clustering; Linear Regression; Product Segmentation; Sales PredictionAbstract
Sales transaction data contain valuable information that can support business decision-making, including product segmentation and sales forecasting. However, many organizations still utilize transaction data solely for operational purposes, limiting its potential to generate strategic business insights. This study proposes an integrated framework combining K-Means Clustering and Linear Regression to analyze product sales patterns and predict future sales trends. A quantitative experimental approach was employed using a publicly available sales dataset obtained from Kaggle. Data preprocessing involved data cleaning, feature selection, and Min-Max normalization to ensure consistent feature scales prior to the clustering process. The optimal number of clusters was determined using the Elbow Method, resulting in four product clusters representing distinct sales characteristics. Subsequently, an independent Linear Regression model was developed for each cluster
using an 80:20 train-test split to predict sales trends. Model performance was evaluated using the coefficient of determination (R²), Mean Absolute Error (MAE), and Mean Squared Error (MSE).
The experimental results demonstrate that the proposed framework successfully grouped products into four meaningful clusters and achieved satisfactory prediction performance, with the highest R²
value reaching 0.9215, indicating a strong relationship between historical sales patterns and predicted values within the corresponding cluster. The integration of clustering and regression provides more comprehensive analytical insights than applying prediction directly to the entire dataset, facilitating a better understanding of product characteristics and sales behavior. Therefore, the proposed approach can support data-driven decision making in inventory management, product prioritization, and
marketing strategy development. Future research is recommended to evaluate the proposed framework using larger datasets and to compare its performance with other clustering and regression
algorithms.
References
1] F. Desryani, B. Ginting, and M. Ramadhan, "The Application of Data Mining in the Grouping of Bottled Mineral Water Sales Shop Areas Using the K-Means Clustering Algorithm," vol. 4, no. September, pp. 1243–1257, 2025.
[2] M. Fajar, N. Rahaningsih, and R. Danar Dana, "Analysis of Drug Sales Patterns at An-Naafi Pharmacy Using the K-Means Clustering Method," JATI (Journal of Mhs. Tek. Inform., vol. 8, no. 1, pp. 486–492, 2024, doi: 10.36040/jati.v8i1.8395.
[3] M. Imron Zamzani, A. Andini, K. R. K. Rahayu, and N. Muhasdi, "Segmentation Analysis of MSME Customers of Albynha Cake Shop Using RFM and K-Means Methods," J. Ind. Eng. Technol., vol. 2, no. 1, pp. 1–11, 2026, doi: 10.36277/jietech.v2i1.57.
[4] N. K. Ahmadi and Herlina, "Segmentation Analysis of Eiger Product Purchase Decisions in Bandar Lampung," J. Manaj. Magister, Vol 03. No.01, January 2017, vol. 03, no. 01, pp. 75–95, 2017.
[5] G. Triyandana, L. A. Putri, and Y. Umaidah, "Application of Data Mining for Food and Beverage Menu Grouping Based on Sales Level Using the K-Means Method," vol. 6, no. 1, pp. 40–46, 2022.
[6] M. R. Fahlepi and A. Widjaja, "Application of Multiple Linear Regression Method for Prediction of Boarding House Rental Prices," vol. 1, no. November, pp. 615–629, 2019.
[7] Henry Adam, Tukino, Elfina Novalia, and A. L. Hananto, "Prediction of Goods Sales Using K-Means Method and Linear Regression," Bull. Comput. Sci. Res., vol. 5, no. 4, pp. 298–307, 2025, doi: 10.47065/bulletincsr.v5i4.541.
[8] Sulistyowati, B. E. Ketherin, A. A. Arifiyanti, and A. Sodik, "Analysis of Consumer Segmentation Using the K-Means Clustering Algorithm of the Department of Information Systems, Adhi Tama Institute of Technology Surabaya," no. September, 2018.
[9] Anggelia Deli, Petronela Kurniati Kondang, Wilnotus Daniel Awil, and Astina Ranti, "Analysis of Marketing and Product Sales Budget Segmentation in the Retail Industry Using K-Means Clustering Based on R Shiny," Instink Inov. Education, Technology. Inf. and Comput., vol. 4, no. 1, pp. 41–54, 2025, doi: 10.30599/9a8f3305.
[10] Nayla Salsabila, Karina Aulisari, and Hani Zulfia Zahro, "Application of K-Means Algorithm for Clustering Productivity of Ginger Plants," Infotek J. Inform. and Technology., vol. 8, no. 1, pp. 228–238, 2025, doi: 10.29408/jit.v8i1.28195.
[11] A. Gafari and R. Sovia, "An Analysis of Public Satisfaction with Government Services : A Multi-Method Approach Using PCA, K-Means Clustering, and Linear Regression," vol. 30, no. 1, pp. 1–8, 2026, doi: 10.46984/sebatik.v29i1.2742.
[12] R. Luthfiansyah and B. Wasito, "Application of Deep Learning Techniques (Long Short Term Memory) and Classical Approaches (Linear Regression) in Prediction of BRI Stock Movements," J. Inform. and Business, vol. 12, no. 2, pp. 42–54, 2023, doi: 10.46806/jib.v12i2.1059.
[13] N. Aminudin, N. Hidayat, D. Feriyanto, D. Septasari, and I. Awaliyani, "Digital Landscape and Behavior in Indonesia 2024: A National Survey Analysis of Internet Penetration, Cybersecurity Risks, and User Segmentation Using K-Means Clustering and Logistic Regression," J. Tek. Inform., vol. 6, no. 5, pp. 3336–3351, 2025, doi: 10.52436/1.jutif.2025.6.5.5117.
[14] F. Erza et al., "Object Tracking System on Quadcopter Using Image Segmentation with Hsv Color Detection and Linear Regression Method Based on," vol. 9, no. 7, pp. 1733–1740, 2022, doi: 10.25126/jtiik.202296808.
[15] N. M. Fithryani, A. R. Dikananda, D. Rohman, and K. Cirebon, "K-MEANS ALGORITHM FOR," vol. 13, no. 1, pp. 997–1003, 2025.
Downloads
Published
Issue
Section
License
Copyright (c) 2026 Machine Intelligence for Societal Advancement

This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.
