Thursday, October 29, 2026
HomeData ScienceData Science in Supply Chain โ€“ Demand Forecasting, Inventory Optimisation and Logistics...

Data Science in Supply Chain โ€“ Demand Forecasting, Inventory Optimisation and Logistics ML

Table of Content

📋 KEY INSIGHTS

  • Supply chain data science encompasses three interconnected forecasting and optimisation problems: demand forecasting (how much of each product will be needed, when, and where?), inventory optimisation (how much stock to hold at each node to meet demand at minimum cost?), and logistics optimisation (how to route shipments, assign vehicles, and schedule operations efficiently?). ML and operations research work together: ML generates probabilistic demand forecasts; optimisation algorithms use those forecasts to compute optimal inventory and routing decisions.
  • Demand forecasting at scale โ€” forecasting thousands of SKUs across hundreds of locations simultaneously โ€” is a global multi-series time series problem where tree-based models (LightGBM, XGBoost) with lag features and external regressors often outperform classical univariate methods (ARIMA, ETS). The key features are: lag features (sales at t-1, t-7, t-28, t-365), rolling aggregates (4-week moving average), calendar features (day-of-week, week-of-year, holiday indicators), promotional events, and external signals (weather, economic indicators, competitor pricing).
  • Probabilistic demand forecasting โ€” producing the full predictive distribution P(demand | features) rather than just a point estimate โ€” is essential for inventory optimisation: safety stock calculations require the standard deviation of forecast error, and the optimal order quantity under the newsvendor model depends on the forecast distribution quantiles. Quantile regression, conformal prediction intervals, and deep probabilistic models (TFT, DeepAR) produce calibrated forecast distributions.
  • The newsvendor model is the foundational inventory optimisation model: given a single-period uncertain demand D with known distribution, a unit cost c, a selling price p, and a salvage value s, the optimal order quantity Q* = Fโปยน(cr), where cr = (p-c)/(p-s) is the critical ratio (service level) and Fโปยน is the inverse CDF of the demand distribution. The newsvendor model generalises to multi-period safety stock calculations via the cycle service level formula and connects directly to the forecast distribution.
  • Route optimisation โ€” finding the shortest or most efficient vehicle routes for delivering goods to customers โ€” is the Vehicle Routing Problem (VRP), a combinatorial optimisation problem that is NP-hard in general. Practical VRP solvers combine classical operations research algorithms (Clarke-Wright savings, 2-opt/3-opt local search, LKH3) with ML-guided heuristics (pointer networks, attention models for constructive heuristics) and cloud solver APIs (Google OR-Tools, VROOM, OptaPlanner) that scale to thousands of stops.
  • Supply chain disruption prediction โ€” identifying impending supplier failures, port congestion events, or logistics bottlenecks before they impact operations โ€” is an emerging ML application that combines time series anomaly detection, graph neural networks (for supply chain network topology), and NLP-based news monitoring to provide early warning of supply chain risks, enabling proactive mitigation rather than reactive firefighting.

Supply chains generate some of the most voluminous and commercially valuable data in the world: transaction records for every stock movement, sensor readings from warehouses and vehicles, external signals from suppliers and logistics partners, and downstream demand signals from point-of-sale systems and e-commerce platforms. Getting demand forecasting right at Amazon, Walmart, or Zara is worth hundreds of millions of dollars in reduced inventory costs and improved customer service levels. Getting route optimisation right for a last-mile delivery network saves fuel, reduces driver hours, and improves delivery reliability. Data science applied to supply chain is therefore a domain where marginal improvements in model quality translate directly and immediately into measurable business value. This guide covers the full supply chain ML toolkit: probabilistic demand forecasting at scale, inventory optimisation under uncertainty (newsvendor model, safety stock, reorder points), vehicle routing optimisation, and supply chain risk analytics.

Demand Forecasting at Scale โ€” Feature Engineering and Model Selection

Demand forecasting at scale is a global time series problem: train a single model on all SKU-location combinations simultaneously, producing forecasts for thousands of series that benefit from shared statistical strength. The standard approach combines LightGBM or XGBoost with a rich feature set derived from the demand history and external signals. The feature engineering for demand forecasting is the most important modelling decision:

Lag features capture recent demand history: sales at tโˆ’1 (yesterday), tโˆ’7 (same day last week), tโˆ’14, tโˆ’28 (four weeks ago), and tโˆ’364/365 (same period last year) are nearly universal. For weekly or monthly data, use tโˆ’1, tโˆ’4, tโˆ’12, tโˆ’52 respectively. Lag features must be constructed with strict point-in-time correctness โ€” the value at time t must use only information available before t, never information from t or later, to avoid data leakage. This is the demand forecasting analogue of the feature store’s point-in-time correct join.

Rolling aggregate features smooth short-term noise: 4-week moving average, 8-week moving average, 52-week moving average, exponentially weighted moving average (EWMA with various decay rates), and rolling standard deviation (capturing demand volatility, which is needed for safety stock). Calendar features: day-of-week (sine/cosine encoded for cyclicality), week-of-year, month, is_weekend, days_until_holiday, and days_since_holiday are essential for consumer goods with strong seasonal and weekly patterns. Promotional features: is_promotion, promotion_discount_pct, promotion_type are among the strongest predictors for FMCG and retail demand. The connection to our time series analysis guide is direct: classical decomposition (trend, seasonality, residual) informs which lag and calendar features to construct, and the residuals after classical decomposition are what the tree model most needs to learn.

Model FamilyBest ForHandles Promotions?Probabilistic?Scalability
LightGBM + lagsGlobal, tabular, many covariatesExcellent (feature)Via quantile regressionExcellent (millions of rows)
ProphetSingle series with holidaysVia extra regressorsAdditive noise modelPoor (one model per series)
Temporal Fusion TransformerMultivariate with rich covariatesExcellent (feature)Native quantilesGood (global model)
DeepAR (Amazon)Probabilistic, global, autoregressiveVia covariatesParametric distributionGood
ARIMA / ETSSingle series, no covariatesARIMAX onlyAnalytical CIPoor
Croston / ADIDAIntermittent demand (many zeros)NoPartialGood

Inventory Optimisation โ€” Newsvendor Model, Safety Stock and Service Levels

yellow driving forklift
Photo by National Cancer Institute on Unsplash

Inventory optimisation answers the question: given a probabilistic demand forecast, how much stock should we hold to meet demand at minimum total cost? The costs are asymmetric: holding too much inventory incurs holding costs (capital tied up, storage, obsolescence risk); holding too little incurs stockout costs (lost sales, expediting costs, customer dissatisfaction). The optimal inventory policy balances these costs using the forecast distribution.

The newsvendor model is the single-period inventory model: a retailer orders Q units before observing demand D ~ F(d). If D โ‰ค Q, excess inventory is salvaged at value s; if D > Q, the retailer loses the margin on unsatisfied demand. The optimal order quantity Q* satisfies F(Q*) = cr, where cr = (pโˆ’c)/(pโˆ’s) is the critical ratio (profit-weighted service level). For a critical ratio of 0.9 (high stockout cost relative to holding cost), Q* is the 90th percentile of the demand distribution โ€” so a 90% service level is optimal. This directly requires a probabilistic demand forecast: Q* is a quantile of the forecast distribution, not a point estimate. Conformal prediction intervals provide distribution-free quantile estimates with guaranteed coverage, making them directly applicable to newsvendor inventory optimisation.

Safety stock is the buffer inventory held above the mean demand forecast to cover demand variability and forecast error during the replenishment lead time. The standard safety stock formula: SS = z_ฮฑ ร— ฯƒ_LTD, where z_ฮฑ is the z-score corresponding to the desired service level ฮฑ and ฯƒ_LTD is the standard deviation of demand over the lead time (lead time demand). For a 95% service level, z_ฮฑ = 1.645. ฯƒ_LTD is estimated from the forecast error distribution โ€” a well-calibrated probabilistic forecast model whose residuals have known variance provides exactly this. The connection to our statistics fundamentals guide is direct: safety stock calculations are an application of normal distribution quantiles and confidence interval theory to inventory management. The reorder point (ROP = mean lead time demand + safety stock) triggers replenishment orders when inventory falls to this level, implementing the (s, Q) continuous review inventory policy.

Vehicle Routing, Last-Mile Optimisation and Disruption Prediction

The Vehicle Routing Problem (VRP) asks: given a depot, a set of customers with locations and demand volumes, and a fleet of vehicles with capacity constraints, find the minimum-cost set of routes that serves all customers. The Capacitated VRP (CVRP) adds vehicle capacity constraints; VRP with Time Windows (VRPTW) adds delivery time window constraints; Multi-Depot VRP (MDVRP) adds multiple depot locations. All variants are NP-hard for general instances, but practical solvers achieve near-optimal solutions for instances with hundreds to thousands of stops in seconds to minutes.

Google OR-Tools is the most widely used open-source VRP solver for supply chain applications: it implements constraint programming and local search metaheuristics that handle all VRP variants natively, with Python API and integration with Google Cloud. The Clarke-Wright savings algorithm provides a fast construction heuristic (O(nยฒ log n)) that generates an initial solution; 2-opt and 3-opt local search then improve it by iteratively swapping route segments. For very large instances (thousands of stops), ML-guided construction heuristics โ€” Attention Model (Kool et al., 2019) and POMO โ€” use Transformer-based pointer networks trained with reinforcement learning to construct near-optimal routes in milliseconds, enabling real-time route re-optimisation as conditions change.

Supply chain disruption prediction applies anomaly detection and predictive modelling to supply chain signals: on-time delivery rates per supplier, lead time variability, port congestion indices, news sentiment from supply chain monitoring feeds, and financial health indicators of key suppliers. Graph neural networks on the supplier network graph (where nodes are suppliers/factories/ports and edges are material flows) capture cascading risk propagation โ€” a disruption at a tier-2 supplier may be predictable from anomalies in their tier-1 customers’ order patterns days or weeks before the disruption surfaces. The connection to our time series analysis guide and streaming ML guide is direct: disruption signals arrive as streaming time series, and the monitoring pipeline uses the same Kafka + Flink architecture for real-time anomaly scoring as other streaming ML systems.

✦ SUMMARIZE THIS ARTICLE WITH AI

Demand forecasting model families โ€” LightGBM lag models, TFT, DeepAR, Prophet โ€” are in our Time Series Analysis guide and Time Series Deep Learning guide. Probabilistic forecasting and conformal prediction for newsvendor quantile estimation are in our Conformal Prediction guide. Feature engineering for lag features, rolling aggregates, and calendar encoding is in our Feature Engineering guide. Graph neural networks for supply chain network risk modelling are in our Graph Neural Networks guide. Anomaly detection for supply chain disruption signals is in our Anomaly Detection guide. Reinforcement learning for route optimisation and dynamic scheduling is in our Reinforcement Learning guide.

Leave feedback about this

  • Rating

Durgesh Kekare
Durgesh Kekarehttps://www.dataexpertise.in
Durgesh Kekare is a data science educator and founder of DataExpertise.in. With expertise in Python, machine learning, and analytics, he helps 10,000+ learners break into data careers.

Latest Posts

List of Categories