Next Article in Journal
FDM Process Parameters Impact on Roughness and Dimensional Accuracy of PLA Parts
Previous Article in Journal
Development of an Integrated Satellite-Based Estimation Method for Water Transparency and Algal Beds in the Mekong River
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Proceeding Paper

Optimization of Forecasting Performance in the Retail Sector Using Artificial Intelligence †

by
Hoda Jatte
1,*,
Sara Belattar
2 and
El Khatir Haimoudi
1
1
ISISA Team, Department of Computer Science, Faculty of Sciences, Abdelmalek Essaâdi University, Tetouan 93000, Morocco
2
Artificial Intelligence Research and Applications Laboratory (AIRA), National School of Business and Management (ENCG), Hassan First University, Settat 26000, Morocco
*
Author to whom correspondence should be addressed.
Presented at the 7th edition of the International Conference on Advanced Technologies for Humanity (ICATH 2025), Kenitra, Morocco, 9–11 July 2025.
Eng. Proc. 2025, 112(1), 37; https://doi.org/10.3390/engproc2025112037
Published: 16 October 2025

Abstract

In the retail industry, demand forecasting is absolutely crucial for guaranteeing efficient inventory and supply chain control. Different artificial intelligence (AI) techniques have been used lately to improve forecasting performance. Demand fluctuation, seasonal patterns, and outside influences continue to create difficulties, though. Using several machine-learning techniques Linear Regression, XGBoost, Random Forest, Decision Tree, Prophet, and LSTM this paper offers a comparative study to forecast product demand. A retail dataset obtained from Kaggle served as the basis for training and testing the forecasting models. The experimental results demonstrate that the LSTM model outperforms all others with accuracy, precision, recall, and F1-score of 92.31%, 92.31%, 100.00%, and 96.00%, respectively, followed by Prophet with 85.71%, 92.31%, 92.31%, and 92.31%, respectively, Decision Tree with 93.05%, 75.76%, 76.13%, and 75.94%, respectively, Random Forest with 91.99%, 66.86%, 88.08%, and 76.02%, respectively, XGBoost with 83.21%, 45.70%, 87.84%, and 60.12%, respectively, and Linear Regression with 60.67%, 25.46%, 89.75%, and 39.67%, respectively. These results verify that ensemble and deep learning models can greatly help retailers in raising operational efficiency and notably improve forecasting accuracy.

1. Introduction

In recent years, the retail sector has seen substantial changes as a result of the integration of modern technology, particularly artificial intelligence (AI) [1]. Demand forecasting, a vital component of inventory and supply chain management, is increasingly relying on advanced predictive models. Traditional statistical methods frequently fail when dealing with complex, nonlinear patterns in sales data. As a result, machine learning and deep learning approaches have developed as effective methods for enhancing forecast accuracy.
This study investigates and compares the performance of various AI algorithms for anticipating retail demand, including Linear Regression, XGBoost, Random Forest, Decision Tree, Prophet, and Long Short-Term Memory (LSTM) networks. Using a publicly available dataset from Kaggle [2], we present empirical evidence on the strengths and limits of each technique, providing significant insights for shops looking to enhance operations.
Machine learning (ML) [3] and artificial intelligence (AI) technologies have emerged as viable tools for improving demand forecasting in recent years. These methods provide excellent predictive accuracy, pattern recognition capabilities, flexibility, and the ability to learn from previous data sets. This research focuses on intelligent forecasting systems that aim to increase operational efficiency and support decision-making in retail environments. The literature investigates many demand forecasting methods, ranging from simple, interpretable models like Decision Tree and Linear Regression to complex ensemble methods such as Random Forest and XGBoost. Recent models, such LSTM and Prophet, efficiently capture temporal interdependence. This study compares the performance of six models with a Kaggle retail dataset, utilizing metrics such as accuracy, precision, recall, and F1-score.
A novel contribution is the systematic comparison of several models using a unified experimental setup that includes both regression and binary classification viewpoints. Furthermore, computational efficiency training and inference time, as well as memory usage is examined, addressing practical factors that are sometimes disregarded in retail demand forecasting.
This paper is organized as follows: Section 2 reviews the relevant literature on AI-based forecasting techniques. Section 3 describes the research methodology, including data preprocessing and model implementation. Section 4 presents and discusses experimental results. Section 5 concludes the study and outlines future research directions.

2. Related Literature

Recent research has demonstrated the efficacy of Machine Learning and Deep Leraning in retail forecasting. Thivakaran and Ramesh [4] discovered that Random Forest outperformed XGBoost in predicting BigMart sales. Falatouri et al. [5] demonstrated that LSTM outperforms SARIMA for some fresh items. Rahman Mahin et al. [6] developed a voting regression that outperformed RF and KNN in accuracy. Riachy et al. [7] utilized COVID-19 constraints to improve Deep Learning forecast robustness. Darshan et al. [8] used pattern mining and Prophet to optimize inventory planning. Ref. [9] utilized EDA and ML to demonstrate that Decision Trees accurately forecasted financial earnings. Seyedan et al. [10] used LSTM, CNN, and Bayesian averaging to enhance inventory forecasting. Asma ul Husna. [11] used forecasting and fuzzy optimization to make supplier decisions.
Table 1 and Table 2 provide an overview of recent studies, highlighting their forecasting methods, key contributions, and identified limitations.

3. Materials and Methods

3.1. Proposed Methodology

This research attempts to provide a dependable and effective forecasting system for retail goods demand. Accurate projections aid in inventory optimization, stockout prevention, and supply chain decision-making. Six machine learning and deep learning models were examined using a structured pipeline in Figure 1 to determine the optimal technique.
  • Data preparation: involves cleaning and preparing the input features.
  • Feature engineering: to extract relevant temporal and product-related characteristics.
  • Model training and evaluation: models are trained and evaluated using consistent criteria across all methods.
  • Performance comparison: using standard classification and regression metrics.
  • Final model selection: based on experimental results.
To ensure a comprehensive evaluation, the following models were chosen:
  • Linear Regression: a conventional regression method utilized as a reference point.
  • Decision Tree: a rule-based model known for interpretability.
  • Random Forest: an ensemble of decision trees that improves generalization.
  • XGBoost: a gradient boosting model known for accuracy and performance.
  • Prophet: a time-series forecasting model designed to capture seasonality and trend.
Figure 1. Overview of the proposed forecasting pipeline.
Figure 1. Overview of the proposed forecasting pipeline.
Engproc 112 00037 g001
All models were developed utilizing an identical dataset and input factors, which encompassed past demand figures, parts of the date (like month, day, and day of the week), and product identifiers. To properly learn temporal patterns, the LSTM model requires reorganizing the input into a sequential shape. To convert the regression task into a binary classification problem, a fixed classification threshold was utilized, defined as the target variable’s mean (Order_Demand = 5248.1).

3.2. Dataset Description

The dataset used in this study was obtained from Kaggle and contains historical retail sales records. The primary target variable is Order_Demand, which represents the number of product units requested. The dataset includes the following:
  • Over 100,000 records;
  • Key variables: product code, warehouse ID, date, and order demand;
  • CSV format, with missing and inconsistent values.

3.3. Data Preprocessing and Binarization

The data preprocessing stage involved the following:
  • Removing null or inconsistent entries;
  • Transforming categorical variables through label encoding or one-hot encoding;
  • Extracting time components such as day, month, and weekday from the date;
  • Exploratory Data Analysis (EDA):The data reveals a clear rising trend, with a 30 day rolling average of 3,069,188 units and weekly seasonality averaging 2,733,319 units. Outliers were deleted to better model training.
To convert the regression issue into a binary classification challenge, a specific limit was established using the average value of Order_Demand (5248.1). According to this limit:
  • Low Demand: instances where Order_Demand ≤ 5248.1
  • High Demand: instances where Order_Demand > 5248.1
This binary transformation mirrors practical business concerns, where choices are frequently based on whether demand reaches a key threshold rather than exact quantities. It also facilitates model evaluation by providing simple measures such as accuracy and recall, which are easier to grasp for operational decision-making and allowed us to evaluate classification performance in addition to regression metrics.

3.4. Model Implementation

Each forecasting model was implemented using Python 3.12 and trained on the same dataset to ensure a fair and consistent comparison. All models were provided with an identical set of input features, which included historical demand values, date based attributes (such as day, month, and day of the week), and product identifiers.
Model-specific preprocessing and tuning: LSTM inputs were organized to capture temporal patterns and long-term relationships needed for time series forecasting. To ensure consistency, all models employed the same relevant input features, such as time-based signals and product identification. Feature uniformity and hyperparameter tuning: To ensure consistency, all models used the same input features, regardless of their internal architecture or learning mechanisms. Demand forecasting features such as time-based signals and product identifiers were routinely used. Grid search was used to tune hyperparameters such as tree depth, learning rate, and regularization in tunable models (e.g., XGBoost, Random Forest).
This exhaustive search method systematically evaluated different parameter combinations to identify configurations that achieved the best performance on validation data.

3.5. Experimental Setup

The experiments were carried out utilizing Google Colab (Python 3.12) and Jupyter Notebook 7.5.0, which allowed for rapid development, code execution, and interactive visualization. These platforms also allowed seamless integration with machine learning libraries and cloud-based resources.
To manage and monitor training, MLflow was used to track experiments, log performance metrics, and store models, assuring repeatability and ease of comparison between runs. Models were built utilizing existing libraries.
  • Scikit-learn for preprocessing, evaluation metrics, and baseline models;
  • XGBoost for gradient boosting;
  • Prophet for additive time series forecasting;
  • Keras/TensorFlow for implementing the LSTM model.
Common Training Settings:
  • Number of epochs (LSTM): 50
  • Batch size: 32
  • Train/test split: 80% 20%
Additional performance study was undertaken to analyze training and inference times, as well as the models’ memory consumption:
-
XGBoost
  • training time: 4.12 s
  • Training memory use: 6.71 MB
  • Prediction time: 0.09 s
  • Peak memory usage during prediction: 1.68 MB.
-
LSTM
  • training time: 20.60 s
  • Maximum memory use during training: 4.68 MB
  • Prediction time: 0.39 s
Evaluation metrics: Accuracy, Precision, Recall, F1-score, R2 (coefficient of determination), RMSE (Root Mean Squared Error). These unified settings ensured that all models were evaluated under consistent conditions, enabling a fair and reliable comparison of their performance.

4. Results

This section presents and analyzes the forecasting results obtained from the various models applied to predict product demand in the retail sector. To assess classification performance, the continuous target variable Order_Demand was binarized using a fixed threshold equal to its mean (5248.1), distinguishing between two classes: Low Demand and High Demand. The performance metrics accuracy, precision, recall, F1-score, RMSE, R2 summarized in Table 3.
  • Accuracy: Measures the model’s overall accuracy by calculating the proportion of true findings (including true positives and true negatives) across all examples evaluated.
    Accuracy = T P + T N T P + T N + F P + F N
  • Precision (Pre): Indicates the percentage of accurately predicted positive observations among all predicted positives.
    Precision = T P T P + F P
  • Recall (Rec): Measures the proportion of true positives that were successfully identified.
    Recall = T P T P + F N
  • F1-Score: The harmonic mean of Precision and Recall achieves a balance between the two.
    F 1 = 2 × Precision × Recall Precision + Recall
  • RMSE (Root Mean Square Error): Determines the average magnitude of prediction mistakes in regression tasks.
    R M S E = 1 n i = 1 n ( y i y ^ i ) 2
  • R2 Score (Coefficient of Determination): Indicates how closely the forecasts match the actual facts.
    R 2 = 1 i = 1 n ( y i y ^ i ) 2 i = 1 n ( y i y ¯ ) 2
To supplement the quantitative performance study, this section provides visual representations of each model. We include the confusion matrices (Figure 2) and, which provide detailed insight into the correct and incorrect predictions. These visuals provide a better grasp of each model’s strengths and limits in categorizing demand as ’High Demand’ or ’Low Demand’.

5. Discussion

The overview show that LSTM and Prophet outperform traditional regression models. LSTM excels at modeling temporal dependencies, whereas Prophet produces accurate and interpretable forecasts with high F1 and recall scores. Among classical models, Decision Tree [12] and Random Forest [13] perform well, with Random Forest having the lowest RMSE. XGBoost produces balanced measures with reduced precision, while Linear Regression performs poorly. These findings emphasize the relevance of time-aware models in demand forecasting, with LSTM being the preferable method for dynamic inventory management.

6. Conclusions

This study sought to improve demand forecasting in the retail sector by utilizing a variety of artificial intelligence (AI) technologies. Using historical sales data, we conducted a thorough comparison of the performance of various forecasting models, including Linear Regression, Random Forest, XGBoost, and LSTM. The findings showed that sophisticated machine learning algorithms, particularly XGBoost and LSTM, outperformed traditional methods for predicting future demand. XGBoost displayed great stability and efficiency in processing structured data, whereas LSTM excelled at identifying temporal dependencies, making it ideal for time-series forecasting. These findings highlight the significant potential of AI-based models to improve demand prediction accuracy and, as a result, optimize inventory management and supply chain operations in the retail business. By synchronizing supply and demand, AI-driven forecasting enables retailers to make data-driven decisions, save money, and enhance customer happiness.
Automating demand forecasts eliminates stockouts and overstocking while optimizing resources and reducing waste. Future work could include conducting more exploratory data analysis to find trends and better feature engineering, as well as including external elements such as weather and marketing. Hybrid models that combine sequential and non-sequential methods may improve forecast accuracy and robustness.

Author Contributions

Conceptualization, H.J., S.B. and E.K.H.; methodology, H.J.; software, H.J.; validation, S.B. and E.K.H.; formal analysis, H.J.; investigation, H.J.; resources, H.J.; data curation, H.J.; writing original draft preparation, H.J.; writing review and editing, S.B. and E.K.H.; visualization, H.J.; supervision, S.B. and E.K.H. All authors have read and agreed to the published version of the manuscript.

Funding

This research received no external funding.

Institutional Review Board Statement

Not applicable.

Informed Consent Statement

Not applicable.

Data Availability Statement

The dataset used in this study is publicly available on Kaggle at https://www.kaggle.com/ (accessed on 9 May 2025).

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Belattar, S.; Abdoun, O.; Haimoudi, E.K. New learning approach for unsupervised neural networks model with application to agriculture field. Int. J. Adv. Comput. Sci. Appl. 2020, 11, 360–369. [Google Scholar] [CrossRef]
  2. Dash, R. Retail Demand Forecasting Dataset. 2024. Available online: https://www.kaggle.com/datasets/rishavdash/retail-demand-forecasting-dataset (accessed on 9 May 2025).
  3. Belattar, S.; Abdoun, O.; Haimoudi, E.K. A novel strategy for improving the counter propagation artificial neural networks in classification tasks. J. Commun. Softw. Syst. 2022, 18, 17–27. [Google Scholar] [CrossRef]
  4. Thivakaran, T.K.; Ramesh, M. Exploratory Data analysis and sales forecasting of bigmart dataset using supervised and ANN algorithms. Meas. Sens. 2022, 23, 100388. [Google Scholar] [CrossRef]
  5. Falatouri, T.; Darbanian, F.; Brandtner, P.; Udokwu, C. Predictive Analytics for Demand Forecasting - A Comparison of SARIMA and LSTM in Retail SCM. Procedia Comput. Sci. 2022, 200, 993–1003. [Google Scholar] [CrossRef]
  6. Mahin, M.P.R.; Shahriar, M.; Das, R.R.; Roy, A.; Reza, A.W. Enhancing Sustainable Supply Chain Forecasting Using Machine Learning for Sales Prediction. Procedia Comput. Sci. 2025, 252, 470–479. [Google Scholar] [CrossRef]
  7. Riachy, C.; He, M.; Joneidy, S.; Qin, S.; Payne, T.; Boulton, G.; Occhipinti, A.; Angione, C. Enhancing deep learning for demand forecasting to address large data gaps. Expert Syst. Appl. 2025, 268, 126200. [Google Scholar] [CrossRef]
  8. Darshan, S.M. Integrating Data Mining and Predictive Modeling Techniques for Enhanced Retail Optimization. arXiv 2024, arXiv:2409.19248. [Google Scholar] [CrossRef]
  9. Chakri, P.; Pratap, S.; Lakshay; Gouda, S.K. Analyzing financial accounting data using machine learning. Data Anal. J. 2023, 7, 100212. [Google Scholar] [CrossRef]
  10. Mafakheri, F.; Wang, C.; Seyedan, M. Order-up-to-level inventory optimization model using time-series demand forecasting with ensemble deep learning. Sustain. Comput. Inform. Syst. 2023, 3, 100024. [Google Scholar] [CrossRef]
  11. ul Husna, A.; Amin, S.H.; Ghasempoor, A. Machine learning techniques and multi-objective programming to select the best suppliers and determine the orders. Mach. Learn. Appl. 2025, 19, 100623. [Google Scholar] [CrossRef]
  12. Belattar, S.; Abdoun, O.; Haimoudi, E.K. Comparing machine learning and deep learning classifiers for enhancing agricultural productivity. Case study: Larache Province, Northern Morocco. Int. J. Electr. Comput. Eng. 2023, 13, 1689–1697. [Google Scholar] [CrossRef]
  13. Belattar, S.; Abdoun, O.; Haimoudi, E.K. Performance analysis of the application of convolutional neural networks architectures in the agricultural diagnosis. Indones. J. Electr. Eng. Comput. Sci. 2022, 27, 156–162. [Google Scholar] [CrossRef]
Figure 2. Confusion matrices of the six forecasting models (a)–(f): Linear Regression, Random Forest, XGBoost, LSTM, Decision Tree, Prophet.
Figure 2. Confusion matrices of the six forecasting models (a)–(f): Linear Regression, Random Forest, XGBoost, LSTM, Decision Tree, Prophet.
Engproc 112 00037 g002
Table 1. Summary of forecasting approaches in the literature (Part 1).
Table 1. Summary of forecasting approaches in the literature (Part 1).
Author(s)YearStudied VariablesResearch MethodsFindingsLimitations
Thivakaran and Ramesh2022BigMart salesANN, Random Forest, XGBoostRandom Forest outperforms XGBoostData limited to BigMart
Falatouri2022Fresh product salesSARIMA, LSTMLSTM better for potatoes and tomatoesSARIMA better for cucumbers and lettuce
Rahman Mahin2025Sales dataRF, KNN, Voting RegressorR2 = 0.9997Complex hybrid model
Riachy2025Sales with COVID-19 restrictionsDeep LearningImproved forecasting accuracyPandemic-specific data
Table 2. Summary of forecasting approaches in the literature (Part 2).
Table 2. Summary of forecasting approaches in the literature (Part 2).
Author(s)YearStudied VariablesResearch MethodsFindingsLimitations
Sri M Darshan2024Sales dataAssociation Rules, ProphetPattern mining + time-seriesMethod complexity
Potta Chakri2023Financial ratios, revenueEDA, LR, KNN, SVR, Decision TreeDecision Tree (depth=9) bestNo time-series or risk analysis
Asma ul Husna2025Demand, costs, customs, deliveryRF, GBR, LSTM, ARIMA, Fuzzy logicSupplier optimization modelNo real-time test
Seyedan Mahya2023Retail demand, inventoryLSTM, CNN, Bayesian AveragingBetter inventory forecastingNo real-time adaptability
Table 3. Comparative performance of forecasting models.
Table 3. Comparative performance of forecasting models.
MetricLinear RegressionXGBoostRandom ForestDecision TreeLSTMProphet
Accuracy (%)60.6783.2191.9993.0592.3185.71
Precision (%)25.4645.7066.8675.7692.3192.31
Recall (%)89.7587.8488.0876.13100.0092.31
F1-score (%)39.6760.1276.0275.9496.0092.31
RMSE28,803.5722,469.0221,527.8025,317.23--
R2 Score0.02260.40520.45400.2449--
ClassesHigh Demand, Low Demand
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Jatte, H.; Belattar, S.; Haimoudi, E.K. Optimization of Forecasting Performance in the Retail Sector Using Artificial Intelligence. Eng. Proc. 2025, 112, 37. https://doi.org/10.3390/engproc2025112037

AMA Style

Jatte H, Belattar S, Haimoudi EK. Optimization of Forecasting Performance in the Retail Sector Using Artificial Intelligence. Engineering Proceedings. 2025; 112(1):37. https://doi.org/10.3390/engproc2025112037

Chicago/Turabian Style

Jatte, Hoda, Sara Belattar, and El Khatir Haimoudi. 2025. "Optimization of Forecasting Performance in the Retail Sector Using Artificial Intelligence" Engineering Proceedings 112, no. 1: 37. https://doi.org/10.3390/engproc2025112037

APA Style

Jatte, H., Belattar, S., & Haimoudi, E. K. (2025). Optimization of Forecasting Performance in the Retail Sector Using Artificial Intelligence. Engineering Proceedings, 112(1), 37. https://doi.org/10.3390/engproc2025112037

Article Metrics

Back to TopTop