In the modern retail and supply chain landscape, maintaining optimal inventory levels while accurately predicting dynamic consumer demand remains a critical operational challenge. Traditional inventory decisions often rely on static historical averages and manual estimations, which fail to capture fluctuating demand patterns, seasonal shifts, and product pricing dynamics. To address these challenges, we propose an integrated Demand Forecasting and Inventory Management System—a unified, data-driven analytics and web platform designed to empower enterprise inventory planners. This platform integrates historical sales data analysis, machine learning-driven multi-horizon demand forecasting using XGBoost and Random Forest, and automated inventory optimization calculations, including safety stock and reorder point identification. Moreover, it embeds interactive business intelligence dashboards using Power BI and a responsive full-stack web application built with React.js, Node.js, and Microsoft SQL Server to deliver real-time stock-level monitoring and intelligent replenishment alerts. Trained and evaluated on the large-scale M5 Walmart retail sales dataset, the proposed system demonstrates how predictive machine learning models and operational dashboards can be integrated to minimize stockouts, prevent costly overstocking, reduce supply chain wastage, and align with UN Sustainable Development Goal 12 (Responsible Consumption and Production). This paper presents the end-to-end system architecture, comparative literature survey, machine learning methodology, implementation details, and experimental dashboard outcomes.
Introduction
The text presents an AI-based Demand Forecasting and Inventory Management System designed to help businesses maintain optimal stock levels, reduce inventory costs, and prevent stockouts. In modern retail and manufacturing environments, customer demand frequently changes due to seasonal variations, holidays, promotional activities, pricing changes, and purchasing patterns. Traditional inventory management techniques rely mainly on historical averages and manual estimations, which often fail to capture complex demand fluctuations. This results in overstocking, increased storage expenses, product wastage, and stock shortages.
To overcome these challenges, the proposed system integrates machine learning-based demand forecasting with automated inventory optimization. It analyses historical sales data to predict future product demand and uses these predictions to calculate safety stock, reorder points, and replenishment requirements. Unlike traditional approaches that treat forecasting and inventory management separately, the proposed platform connects both processes within a unified system.
The literature survey reviews research on machine learning-based demand forecasting, probabilistic forecasting, and inventory optimization. Previous studies demonstrate that algorithms such as XGBoost, LightGBM, and ensemble learning models can outperform traditional statistical methods when analysing complex retail demand patterns. The literature also highlights the importance of incorporating demand uncertainty into inventory decisions to reduce excess stock and backorders.
The research identifies several major inventory management challenges:
Overstocking: Excess inventory increases storage costs, occupies working capital, and creates product obsolescence risks.
Stockouts: Insufficient inventory leads to lost sales, order cancellations, and reduced customer satisfaction.
Difficulty in demand prediction: Traditional methods cannot effectively identify complex seasonal patterns and sudden demand changes.
Manual estimation: Replenishment decisions often depend on subjective assumptions rather than data-driven predictions.
Disconnected processes: Separate forecasting and inventory systems create inefficiencies in stock replenishment.
The proposed methodology consists of four major technical stages.
1. Data Preprocessing and Exploratory Data Analysis (EDA)
Historical retail sales data from the M5 Walmart benchmark dataset are cleaned and prepared for analysis. The process includes handling missing values, removing duplicate records, standardizing dates, identifying outliers, and analysing sales patterns across stores, products, and time periods.
2. Feature Engineering
Different features are extracted to improve forecasting accuracy, including:
Time-based features such as weekdays, months, quarters, and fiscal weeks.
Holiday, promotional, and special-event indicators.
Historical sales or lag features for 1, 7, 14, and 28 days.
Rolling averages and standard deviations over 7-day and 28-day periods.
Economic variables such as selling prices, discounts, and store-specific price differences.
3. Machine Learning-Based Demand Forecasting
The system uses machine learning regression algorithms, primarily XGBoost and Random Forest, alongside traditional time-series baseline models. Their performance is evaluated using Mean Absolute Error (MAE), Root Mean Squared Error (RMSE), and Weighted Absolute Percentage Error (WAPE). Cross-validation is used to identify suitable models for demand prediction.
4. Forecast-Driven Inventory Optimization
Predicted demand is directly incorporated into inventory planning through three important calculations:
Safety Stock (SS): Determines the additional inventory required to handle variations in demand and supplier lead time.
Reorder Point (ROP): Calculates the stock level at which replenishment should begin.
Conclusion
The proposed Demand Forecasting and Inventory Management System provides an effective, data-driven methodology that unifies predictive machine learning with operational inventory planning. By leveraging historical retail sales data, robust feature engineering, and high-performance regression models (XGBoost and Random Forest), the system accurately predicts future product demand across dynamic horizons. The tight integration with stochastic inventory optimization routines ensures that demand forecasts are immediately converted into actionable safety stocks, reorder points, and automated replenishment recommendations. Supported by Microsoft SQL Server warehousing, Node.js backend services, React.js web interfaces, and Power BI business intelligence dashboards, the platform empowers supply chain practitioners to minimize stockouts, prevent costly overstocking, and promote sustainable consumption in alignment with UN SDG 12.
References
[1] Feature-based / causal demand forecasting and safety stock Beutel & Minner, Safety stock planning under causal demand forecasting — discusses demand influenced by factors such as price and weather and integrates forecasting with safety-stock planning.
ScienceDirect – Safety stock planning under causal demand forecasting
[2] Demand forecasting + inventory optimization A new key performance indicator model for demand forecasting in inventory management considering supply chain reliability and seasonality (2023).
ScienceDirect – Demand forecasting and inventory management
[3] Machine learning and inventory optimization A data-driven newsvendor problem: From data to decision — evaluates machine-learning approaches using retail point-of-sale data and connects forecasting with inventory decisions.
ScienceDirect – A data-driven newsvendor problem
[4] Ensemble deep learning for demand forecasting and inventory Order-up-to-level inventory optimization model using time-series demand forecasting with ensemble deep learning (2023).
ScienceDirect – Ensemble deep learning and inventory optimization
[5] Recent ML-based inventory optimization research Predictive models for inventory optimization: a machine learning application for demand forecasting at a construction supplies distributor (2026).
Springer Nature – Predictive models for inventory optimization