Forecasting Retail Sales using Machine Learning Models

Authors

  • Oluwasola Oluwaseun Mustapha
  • Dr. Terry Sithole

DOI:

https://doi.org/10.47672/ajsas.2679

Keywords:

Sales forecasting, Machine learning, Time series analysis, Random Forest, ARIMA, LSTM, XGBoost, Linear regression, RMSE, and MAE.

Abstract

Purpose: This paper’s main objective is to examine common machine learning techniques and also time series analysis for sales forecasting in a bid to get the best fitted technique and give more logical hypotheses for raising future profit margins while obtaining historical in-depth understanding of prior demand utilising business intelligence software’s like Tableau or Microsoft Power BI. The outcomes are laid forth with regards to dependability as well as precision of the various forecasting models that were employed.

Materials and Methods: In this project, a sales prediction is carried out on a 5 year store-item sales data for 50 different items in 10 different stores with a dataset obtained from Kaggle. This study focuses on using Machine Learning Methods including the Random Forest, Gradient Boosting Regression (XGBoost), Linear Regression and also the standard time series Autoregressive Integrated Moving Average (ARIMA) method were analysed and contrasted to measure the methods’ effectiveness for prediction of Sales.

Findings: This study demonstrates the potential of machine learning algorithms in accurately forecasting sales, which can be extremely valuable for businesses in optimizing their operations, inventory management, and financial planning. By leveraging these predictive models, companies can make data-driven decisions to improve efficiency, reduce costs, and increase profitability. The findings also highlight the importance of selecting the most appropriate algorithm for a given dataset and problem, as well as the need for proper model tuning and validation to ensure reliable results. Furthermore, the study underscores the significance of understanding and interpreting error metrics like RMSE and MAE to effectively evaluate and compare model performance.

Unique Contribution to Theory, Practice and Policy:  Factors such as Seasonality, Trend, Promotional offers and Randomity have been known to be important factors that affect the outcome of Sales Forecasting which is why the performances of the Mean Absolute Error (MAE), the Absolute error (R2) and the Root Mean Square Error (RMSE) are all compared in the different algorithms used, to help identify the best preferred algorithm to be adopted which turned out to be the XGBoost method.

Downloads

Download data is not yet available.

References

Akanksha, A., Yadav, D., Jaiswal, D., Ashwani, A., & Mishra, A. (2022). Store-sales forecasting model to determine inventory stock levels using machine learning. In 2022 international conference on inventive computation technologies (icict) (pp. 339–344).

Alexis, C. (2022, January). Time series - arima, dnn, xgboost comparison. http://www.kaggle.com/code/alexisbcook/xgboost.

Bajari, P., Nekipelov, D., Ryan, S. P., & Yang, M. (2015). Machine learning methods for demand estimation. American Economic Review, 105(5), 481–85.

Berry, M. J., & Linoff, G. S. (2004). Data mining techniques: for marketing, sales, and customer relationship management. John Wiley & Sons.

Betul, G. (2022, September).Time series-arima, dnn, xgboost comparison. http://www.kaggle.com/code/badl071/forecasting-future-sales -using-machine-learning.

Boulden, J. B. (1957). Fitting the sales forecast to your firm. Business Horizons, 1(1), 65–72.

Box, G. E., Jenkins, G. M., Reinsel, G. C., & Ljung, G. M. (2015). Time series analysis: forecasting and control. John Wiley & Sons.

Boyapati, S. N., & Mummidi, R. (2020). Predicting sales using machine learning techniques.

Breiman, L. (2001). Random forests. Machine learning, 45(1), 5–32.

Brownlee, J. (2021, November). How to grid search arima model hyperpa- rameters with python. machinelearningmastery.com/grid-search-arima-hyperparameters-with-python.

Chen, F., & Ou, T. (2009). Gray relation analysis and multilayer functional link network sales forecasting model for perishable food in convenience store. Expert Systems with Applications, 36(3), 7054–7063.

Cheriyan, S., Ibrahim, S., Mohanan, S., & Treesa, S. (2018). Intelligent sales prediction using machine learning techniques. In 2018 international conference on computing, electronics & communications engineering (iccece) (pp. 53–58).

Choi, T.-M., Hui, C.-L., Liu, N., Ng, S.-F., & Yu, Y. (2014). Fast fashion sales forecasting with limited data and time. Decision Support Systems, 59, 84–92.

Cui, R., Gallino, S., Moreno, A., & Zhang, D. J. (2018). The operational value of social media information. Production and Operations Management, 27(10), 1749–1769.

Deng, J. (1989). Introduction to grey theory system. The Journal of Grey System, 1(1), 1–24.

Derby, N. (2018). Reducing customer attrition with machine learning for financial institutions. Proceeding soft he SAS GlobalForum, 1796.

Dey, A., Singh, J., & Singh, N. (2016). Analysis of supervised machine learning algorithms for heart disease prediction with reduced number of attributes using principal component analysis. International Journal of Computer Applications, 140(2), 27–31.

Enolac5. (2018, May). Time series - arima, dnn, xgboost comparison. http://www.kaggle

Ensafi, Y., Amin, S. H., Zhang, G., & Shah, B. (2022). Time-series forecasting of seasonal items sales using machine learning–a comparative analysis. International Journal of Information Management Data Insights, 2(1), 100058.

Ferreira, K. J., Lee, B. H. A., & Simchi-Levi, D. (2016). Analytics for an online retailer: Demand forecasting and price optimization. Manufacturing & service operations management, 18(1), 69–88.

Fildes, R., & Petropoulos, F. (2015). Simple versus complex selection rules for forecasting many time series. Journal of Business Research, 68(8), 1692–1701.

Fildes, R., Ma, S., & Kolassa, S. (2022). Retail forecasting: Research and practice. International Journal of Forecasting, 38(4), 1283–1318.

Fisher, M. L., Raman, A., & McClelland, A. S. (2000). Rocket science retailing is almost here-are you ready? Harvard Business Review, 78(4), 115–123.

Fisher, M., & Raman, A. (2018). Using data and big data in retailing. Production and Operations Management, 27(9), 1665–1669.

Friedman, J. H. (2001). Greedy function approximation: a gradient boosting machine. Annals of statistics, 1189–1232.

Gamboa, J. C. B. (2017). Deep learning for time-series analysis. arXiv preprint arXiv:1701.01887.

Hamzaçebi, C. (2008). Improving artificial neural network sâ performance in seasonal time series forecasting. Information Sciences, 178(23), 4550–4559.

Ho, S. L., & Xie, M. (1998). The use of arima models for reliability forecasting and analysis. Computers & industrial engineering, 35(1-2), 213–216.

Hochreiter, S., & Schmidhuber, J. (1997). Long short-term memory. Neural computation, 9(8), 1735–1780.

Hsu, C.-C., & Chen, C.-Y. (2003a). Applications of improved grey prediction model for power demand forecasting. Energy Conversion and management, 44(14), 2241–2249.

Hsu, C.-C., & Chen, C.-Y. (2003b). Applications of improved grey prediction model for power demand forecasting. Energy Conversion and management, 44(14), 2241–2249.

Hsu, L.-C. (2009). Forecasting the output of integrated circuit industry using genetic algorithm based multivariable grey optimization models. Expert systems with applications, 36(4), 7898–7903.

Hsu, L.-C., & Wang, C.-H. (2007). Forecasting the output of integrated circuit industry using a grey model improved by the Bayesian analysis. Technological Forecasting and Social Change, 74(6), 843–853.

Hyndman, R., Lee, A., Wang, E., & Wickramasuriya, S. (2018). hts: Hierarchical and grouped time series. R package version 5.1. 5.

Jain, A., Menon, M. N., & Chandra, S. (2015). Sales forecasting for retail chains. San Diego, California: UC San Diego Jacobs School of Engineering.

Kaggle.com. (2019, September). Store item demand forecasting challenge. http://https:// www.kaggle.com/competitions/demand-forecasting-kernels-only/ data.

Kalaoglu, Ö. I˙., Akyuz, E. S., Ecemis¸, S., Eryuruk, S. H., Sümen, H., & Kalaoglu, F. (2015).

Kotzur, L., Markewitz, P., Robinius, M., & Stolten, D. (2018). Impact of different time series aggregation methods on optimal energy system design. Renewable energy, 117, 474–487.

Lei, M., & Feng, Z. (2012). A proposed grey model for short-term electricity price forecasting in competitive power markets. International Journal of Electrical Power & Energy Systems, 43(1), 531–538.

Levy, M., Weitz, B. A., Grewal, D., & Madore, M. (2012). Retailing management (Vol. 6).

Li, Z., Ma, X., & Xin, H. (2017). Feature engineering of machine-learning chemisorption models for catalyst design. Catalysis today, 280, 232–238.

Lin, Y.-H., & Lee, P.-C. (2007). Novel high-precision grey forecasting model. Automation in construction, 16(6), 771–777.

Liu, N., Ren, S., Choi, T.-M., Hui, C.-L., & Ng, S.-F. (2013). Sales forecasting for fashion retailing service industry: a review. Mathematical Problems in Engineering, 2013.

Lo, T. (1994). An expert system for choosing demand forecasting techniques. International Journal of Production Economics, 33(1-3), 5–15.

Lou, W., Wang, X., Chen, F., Chen, Y., Jiang, B., & Zhang, H. (2014). Sequence based prediction of dna-binding proteins based on hybrid feature selection using random forest and gaussian naive bayes. PloS one, 9(1), e86703.

Ma, S., & Fildes, R. (2021). Retail sales forecasting with meta-learning. European Journal of Operational Research, 288(1), 111–128.

Manaswi, N. K. (2018). Understanding and working with keras. In Deep learning with applications using python (pp. 31–43). Springer.

Mancuso, P., Piccialli, V., & Sudoso, A. M. (2021). A machine learning approach for forecasting hierarchical time series. Expert Systems with Applications, 182, 115102.

McKinney, W. (2012). Python for data analysis: Data wrangling with pandas, numpy, and ipython. “O’Reilly Media, Inc.".

Mitchell, T. M. (1997). Does machine learning really work? AI magazine, 18(3), 11–11.

Mitra, A., Jain, A., Kishore, A., & Kumar, P. (2022). A comparative study of demand forecasting models for a multi-channel retail company: A novel hybrid machine learning approach. In Operations research forum (Vol. 3, pp. 1–22).

Ofoegbu, K. (2021). A comparison of four machine learning algorithms to predict product sales in a retail store (Unpublished doctoral dissertation). Dublin Business School.

Pal, M. (2005). Random forest classifier for remote sensing classification. International journal of remote sensing, 26(1), 217–222.

Pavlyshenko, B. M. (2019). Machine-learning models for sales time series forecasting. Data, 4(1), 15.

Pedregosa, F., Varoquaux, G., Gramfort, A., Michel, V., Thirion, B., Grisel, O., others (2011). Scikit-learn: Machine learning in python. The Journal of machine learning research, 12, 2825–2830.

Prudêncio, R. B., & Ludermir, T. B. (2004). Meta-learning approaches to selecting time series models. Neurocomputing, 61, 121–137.

Retail demand forecasting in clothing industry. Textile and Apparel, 25(2), 172–178.

Rokach, L. (2016). Decision forest: Twenty years of research. Information Fusion, 27, 111–125.

Sakai, H., Nakajima, H., Higashihara, M., Yasuda, M., & Oosumi, M. (1999). Development of a fuzzy sales forecasting system for vending machines. Computers & industrial engineering, 36(2), 427–449.

Samuel, A. L. (1959). Some studies in machine learning using the game of checkers. IBM Journal of Research and Development, 3(3), 210-229. doi: 10.1147/rd.33.0210

Sanders, N. R., & Graman, G. A. (2009). Quantifying costs of forecast errors: A case study of the warehouse environment. Omega, 37(1), 116–125.

Saradhi, V. V., & Palshikar, G. K. (2011). Employee churn prediction. Expert Systems with Applications, 38(3), 1999–2006.

Schaeffer, S. E., & Sanchez, S. V. R. (2020). Forecasting client retentionâa machine-learning approach. Journal of Retailing and Consumer Services, 52, 101918.

Shearer, C. (2000). The crisp-dm model: the new blueprint for data mining. Journal of data warehousing, 5(4), 13–22.

Sherstinsky, A. (2020). Fundamentals of recurrent neural network (rnn) and long short-term memory (lstm) network. Physica D: Nonlinear Phenomena, 404, 132306.

Sial, A. H., Rashdi, S. Y. S., & Khan, A. H. (2021). Comparative analysis of data visualization libraries matplotlib and seaborn in python. International Journal, 10(1).

Su, X., Yan, X., & Tsai, C.-L. (2012). Linear regression. Wiley Interdisciplinary Reviews: Computational Statistics, 4(3), 275–294.

Swami, D., Shah, A. D., & Ray, S. K. (2020). Predicting future sales of retail products using machine learning. arXiv preprint arXiv:2008.07779.

Tanaka, K. (2010). A sales forecasting model for new-released and nonlinear sales trend products. Expert Systems with Applications, 37(11), 7387–7393. Tosi, S. (2009). Matplotlib for python developers. Packt Publishing Ltd.

Tsao, Y.-C., Chen, Y.-K., Chiu, S.-H., Lu, J.-C., & Vu, T.-L. (2022a). an innovative demand forecasting approach for the server industry. Technovation, 110, 102371.

Tsao, Y.-C., Chen, Y.-K., Chiu, S.-H., Lu, J.-C., & Vu, T.-L. (2022b). an innovative demandforecasting approach for the server industry. Technovation, 110, 102371.

Tsoumakas, G. (2019a). A survey of machine learning techniques for food sales prediction. Artificial Intelligence Review, 52(1), 441–447.

Tsoumakas, G. (2019b). A survey of machine learning techniques for food sales prediction. Artificial Intelligence Review, 52(1), 441–447.

Valbuena, R., Hernando, A., Manzanera, J. A., Görgens, E. B., Almeida, D. R., Silva, C. A., & García-Abril, A. (2019). Evaluating observed versus predicted forest biomass: R- squared, index of agreement or maximal information coefficient? European Journal of Remote Sensing, 52(1), 345–358.

Van Der Walt, S., Colbert, S. C., & Varoquaux, G. (2011). The numpy array: a structure for efficient numerical computation. Computing in science & engineering, 13(2), 22–30.

Vincent, T. (2021, November). Arima time series data forecasting and visualization in python.www.digitalocean.com/community/tutorials/a-guide-to-time-series-forecastingwith-arima-in-python-3.

Wang, Z., & Bovik, A. C. (2009). Mean squared error: Love it or leave it? A new look at signal fidelity measures. IEEE signal processing magazine, 26(1), 98–117.

Wei, Z., & Shan, X. (2019). Research on forecast method of railway passenger flow demand in pre-sale period. In Iop conference series: Materials science and engineering (Vol. 563, p. 052080).

Winters, P. R. (1960a).Forecasting sales by exponentially weighted moving averages. Management science, 6(3), 324–342.

Winters, P. R. (1960b).Forecasting sales by exponentially weighted moving averages. Management science, 6(3), 324–342.

Wolpert, D. H., & Macready, W. G. (1997). No free lunch theorems for optimization. IEEE transactions on evolutionary computation, 1(1), 67–82.

Wong, W. K., & Guo, Z. (2010). A hybrid intelligent model for medium-term sales forecasting in fashion retail supply chains using extreme learning machine and harmony search algorithm. International Journal of Production Economics, 128(2), 614–624.

Yao, A. W., Chi, S., & Chen, J. (2003). An improved grey-based approach for electricity demand forecasting. Electric Power Systems Research, 67(3), 217–224.

Yoo, T.-W., & Oh, I.-S. (2020). Time series forecasting of agricultural products sales volumes based on seasonal long short-term memory. Applied Sciences, 10(22), 8169.

Yucesan, M., Gul, M., & Erkan, E. (2017). Application of artificial neural networks using Bayesian training rule in sales forecasting for furniture industry. Drvna industrija, 68(3), 219–228.

Zhang, C., Zhang, H., Sun, Q., & Liu, K. (2018). Mechanical properties of zr41. 2ti13. 8ni10cu12. 5be22. 5 bulk metallic glass with different geometric confinements. Results in Physics, 8, 1–6.

Zhuge, Q., Xu, L., & Zhang, G. (2017). Lstm neural network with emotional analysis for prediction of stock price. Engineering letters, 25(2).

Downloads

Published

2025-04-19

How to Cite

Mustapha, O. O., & Sithole, D. T. (2025). Forecasting Retail Sales using Machine Learning Models. American Journal of Statistics and Actuarial Sciences, 6(1), 35–67. https://doi.org/10.47672/ajsas.2679

Issue

Section

Articles