With the rapid growth of online businesses, instant delivery systems, and on-demand ordering services, supply chain management has become one of the most dynamic and complex industries globally. Each day, millions of goods are transported across vast networks involving manufacturers, distributors, sup- pliers, and vendors. This intricate system, collectively known as supply chain management, is critical for ensuring timely delivery and customer satisfaction. However, despite significant techno- logical advancements, many supply chain operations still rely on outdated, heuristic-based decision-making methods. This results in persistent challenges such as overstocking, under stocking, and resource wastage, which negatively impact both efficiency and profitability .This research proposes an AI- and ML-driven web application to address these inefficiencies. By applying forecast- ing algorithms and intelligent inventory management strategies, our application aims to provide a cost-effective solution . The integration of machine learning techniques enables data-driven decision-making, resulting in better decisions by predicting the number of stocks a user must buy with a reasonable error margin.
Introduction
The rise of e-commerce and instant delivery services has reshaped consumer behavior and strained traditional supply chain management (SCM) systems. While large businesses adopt advanced SCM solutions, small and medium enterprises (SMEs) often lack access due to cost and technical barriers. The authors developed a cost-effective, cloud-based SCM solution using ensemble machine learning models to assist SMEs in making data-driven decisions.
2. Related Work
AI has transformed SCM through:
Demand forecasting
Inventory management
Route optimization
Predictive maintenance
Automated quality control
Digital twins and chatbots
However, these technologies mainly benefit large firms. SMEs struggle due to high implementation costs and limited technical infrastructure, widening the digital divide.
3. System Overview
The application has a full-stack architecture:
Frontend: Built with Next.js and React for an interactive UI.
Backend: Powered by Spring Boot, it handles API logic, data validation, and communication with ML models.
ML Models: Integrated into the backend via REST APIs or embedded microservices. The system enables real-time predictions based on user-input data.
4. Methodology
A. Data Collection & Processing
Data was collected from sources like Kaggle and local vendors, covering categories such as electronics, groceries, beverages, and pharmaceuticals. It included:
Temporal (e.g., manufacturing/expiry dates)
Inventory (stock levels, lead times)
Financial (costs, margins)
Preprocessing involved cleaning, normalization, feature engineering, and validation to prepare data for modeling.
B. Data Insights & Patterns
Key patterns:
Shelf life varies by category (e.g., electronics vs. perishables)
Price reductions occur near expiry
Transport costs differ by region and product
Strong seasonality and habitual buying behavior found
Strong correlations between past demand and current demand, stock levels, and logistics metrics
C. Model Training
Six models were evaluated: Random Forest, Gradient Boosting, AdaBoost, ARIMA, SARIMA, and LSTM, using a 70-30 train-test split. Hyperparameter tuning was applied for performance optimization.
D. Model Formulations
Mathematical formulations were given for each model, including time-series (ARIMA/SARIMA) and deep learning (LSTM) models.
5. Evaluation and Performance
A. Performance Metrics
Measured using MSE, RMSE, MAE, and R².
B. Results
Best General Model: Random Forest (R² = 0.996)
Gradient Boosting: R² = 0.993
AdaBoost: R² = 0.980
Category-specific models performed as follows:
Grocery: R² = 0.963
Beverages: R² = 0.944
Raw Materials: R² = 0.808
Pharmaceuticals: R² = 0.493
Electronics: R² = 0.349
General-purpose models outperformed domain-specific ones, highlighting a need for more tailored feature engineering.
6. Deployment Architecture
A. Model Packaging
Best models were deployed as RESTful APIs using FastAPI, with serialized models for fast inference.
B. Spring Boot Integration
Acts as a middleware layer, handling API calls, business logic, and user session management.
C. Frontend Interface
Built with React.js and Tailwind CSS, the UI supports:
Data input
Real-time predictions
Historical insights via charts and tables
Conclusion
This study set out to develop and evaluate machine learning- based demand forecasting models across various product do- mains using historical data and engineered features. Through comprehensive experimentation, we implemented and com- pared multiple ensemble models—including Random Forest, Gradient Boosting, and AdaBoost—alongside domain-specific forecasting models tailored for categories such as groceries, beverages, raw materials, pharmaceuticals, and electronics.
Our findings reveal that the general-purpose Random Forest model significantly outperforms others, achieving an R2 value of 0.996 and an RMSE of 14.85, indicating exceptional predictive power and minimal error. Gradient Boosting and Ad- aBoost also demonstrated strong performances, with R2 values exceeding 0.98, underscoring the effectiveness of ensemble learning in capturing complex demand patterns even without domain-specific tuning. Among the domain-specific models, those built for grocery and beverage categories performed well, with R2 values above 0.94, suggesting that the historical features used were well-aligned with demand behavior in these segments. However, a significant disparity in performance was ob- served for models related to pharmaceuticals and electronics, where R2 values dropped below 0.50. These results highlight potential deficiencies in feature representation, such as missing temporal trends, promotional activity, or external macroe- conomic factors, which may be more influential in these sectors. The relatively high RMSE and MAE values in these categories further point to the need for enhanced data quality and additional contextual variables. While the study demonstrates promising outcomes, several limitations must be acknowledged. Firstly, the dataset used for modeling was relatively constrained in both scope and feature richness compared to datasets used in industry-standard bench- marks. Benchmark models, often trained on larger, more di- verse datasets with access to richer features—such as customer behavior, economic indicators, and product metadata—can leverage deeper insights that were unavailable in our study. Therefore, while our results show competitive performance, particularly for general models, direct comparisons with ex- isting solutions must be interpreted with caution. Secondly, the current study relied primarily on classical machine learning approaches. Although ensemble methods have shown strong results, the exclusion of deep learning tech- niques, such as Long Short-Term Memory (LSTM) networks or Transformer-based models, may have limited our ability to capture intricate temporal dependencies, especially in volatile or highly seasonal categories. Lastly, our models assumed stationarity in the feature space and did not dynamically adapt to changes over time or exter- nal shocks (e.g., sudden market disruptions, policy changes), which can be critical in real-world demand forecasting sce- narios.
References
[1] D. Perez, M. Gonzalez, A. Torres, and L. Ramirez, “Algorithmic approaches to inventory management optimization,” *Processes*, vol. 9, no. 1, p. 102, 2021.
[2] D. Singh and A. Verma, “Inventory management in supply chain,” *Materials Today*, vol. 5, no. 2, pp. 3867–3872, 2018.
[3] H. Haberleitner, H. Meyr, and A. Taudes, “Implementation of a demand planning system using advance order information,” *Int. J. Prod. Econ.*, vol. 128, no. 2, pp. 518–526, 2010.
[4] H. Abbasimehr, M. Shabani, and M. Yousefi, “An optimized model using LSTM network for demand forecasting,” *Comput. Ind. Eng.*, vol. 143, p. 106435, 2020.
[5] A.-L. Beutel and S. Minner, “Safety stock planning under causal demand forecasting,” *Int. J. Prod. Econ.*, vol. 140, no. 2, pp. 637–645, 2012.
[6] P. Sridhar, C. Vishnu, and R. Sridharan, “Simulation of inventory management systems in retail stores: A case study,” *Materials Today*, vol. 47, pp. 5130–5134, 2021.
[7] R. Granillo-Mac´?as, “Inventory management and logistics optimization: A data mining practical approach,” *LogForum*, vol. 16, no. 4, pp. 535–547, 2020.
[8] S. Nallusamy, “Performance measurement on inventory management and logistics through various forecasting techniques,” *Int. J. Perform. Eng.*, vol. 17, no. 2, pp. 216–228, 2021.
[9] R. Carbonneau, K. Laframboise, and R. Vahidov, “Application of ma- chine learning techniques for supply chain demand forecasting,” *Eur. J. Oper. Res.*, vol. 184, no. 3, pp. 1140–1154, 2008.
[10] M. H. Naseem and J. Yang, “Role of Industry 4.0 in supply chains sustainability: A systematic literature review,” *Sustainability*, vol. 13, no. 17, p. 9544, 2021.
[11] M. Al-Okaily, H. Younis, and A. Al-Okaily, “The impact of management practices and Industry 4.0 technologies on supply chain sustainability: A systematic review,” *Heliyon*, vol. 10, no. 17, p. e36421, 2024.
[12] J. C. Quiroz-Flores, R. J. Aguado-Rodriguez, E. A. Zegarra-Aguinaga, M. F. Collao-Diaz, and A. E. Flores-Perez, “Industry 4.0, circular economy and sustainability in the food industry: A literature review,” *Int. J. Ind. Eng. Oper. Manag.*, vol. 6, no. 1, pp. 1–24, 2024.
[13] M. A. Jahin, A. Shahriar, and M. Al Amin, “MCDFN: Supply chain demand forecasting via an explainable multi-channel data fusion network model,” *arXiv preprint*, arXiv:2405.15598, 2024.
[14] S. Punia and S. Singh, “Machine learning and deep learning models for demand forecasting in supply chain management: A critical review,” *Information*, vol. 7, no. 5, p. 93, 2023.