Inventory Replenishment And Stockout Analytics
Asked of: Data Scientist
Last updated
What's being tested
Interviewers probe your ability to turn sales and inventory signals into defensible analytics and ML models that reduce stockouts and optimize replenishment. They expect crisp metric design (service levels, fill rate), statistical reasoning about demand variability and lead time, causal thinking for policy changes, and practical model-evaluation choices that matter for business outcomes rather than pure ML metrics. Walmart cares because small improvements in stock availability meaningfully increase revenue and reduce customer churn; the interviewer wants to see you balance statistical rigor, business impact, and operational constraints.
Core knowledge
-
Stockout vs backorder vs lost sales: define the observable in data—stockout event when on-hand inventory ≤ 0; backorder if order is accepted; lost sale if demand signal disappears. Distinguish each for correct metric attribution.
-
Fill rate and service level: fill rate = fulfilled units / demanded units; cycle service level = P(no stockout during lead time). These are related but not identical; design experiments around the one that ties to revenue.
-
Reorder point (R) and safety stock (SS): classical formula R = expected demand during lead time + SS, with SS = z *
σ_d* sqrt(LT) assuming iid demand; specify distributional assumptions and z (target service percentile). -
Lead time variability: when lead time is stochastic, use E[
demand]E[LT] and Var(demandLT) terms; approximate SS with delta method or simulate if independence fails. -
Forecasting errors & metrics: use MAE, RMSE, and MAPE but prefer scale-free metrics (sMAPE, MASE) when comparing
SKUsof different volumes; calibrate error distribution tails—stockouts depend on tail behavior, not just mean error. -
Probabilistic forecasts: prefer full predictive distributions (quantiles) over point forecasts for safety-stock sizing; evaluate with CRPS or quantile loss because upper quantiles inform reorder decisions.
-
Causal evaluation: for policy changes (faster replenishment), use randomized experiments or quasi-experimental methods like difference-in-differences and synthetic controls; check for inventory-level spillovers across
SKUs/stores. -
Aggregation & hierarchy: forecast at
SKU-store-dayif you can; aggregate forecasts upward carefully—sum of medians != median of sums. Use top-down/bottom-up reconciliation (e.g.,MinT) when required. -
Sparse low-volume SKUs: use hierarchical Bayesian shrinkage or
Poisson/Negative Binomialdemand models to borrow strength; naive ML will overfit noise on intermittent series. -
Anomaly detection for stockouts: monitor
KPIshifts like sudden rise in stockout rate or fall in fill rate; use change-point tests (CUSUM) or control charts on rolling windows, and prioritize by monetary impact. -
Experiment metric design: choose primary metric tied to customer experience (e.g., % orders without substitution), power calculations must account for clustered traffic (
store-SKUclusters) and overdispersion in counts. -
Model evaluation aligned to business: AUC or RMSE are secondary; evaluate using "lost revenue avoided," reduction in emergency shipments, or inventory turns improvement simulated in a simple inventory policy.
Worked example — "Estimate effect of faster replenishment policy on SKU-level stockouts"
Frame: ask clarifying questions—what is the policy (reduced lead time vs more frequent batches), rollout scope, available data (POs, on-hand inventory, sales, store-level prices/promotions), and whether stockouts lead to lost sales or backorders. Skeleton: (1) define primary metric (SKU-store 7-day stockout rate or lost-sales dollars), (2) choose evaluation design (prefer randomized A/B at store-SKU or rollout stagger enabling difference-in-differences), (3) control for demand shocks (promotions, seasonality) using covariates or fixed effects, (4) estimate treatment effect and heterogeneity, (5) translate effect into business value via revenue uplift or reduced emergency freight. Tradeoff: randomization gives unbiased causal effect but may be operationally costly; a staggered rollout with good pre-trends and store-SKU fixed effects trades some internal validity for feasibility. Close: report intent-to-treat and per-protocol estimates, run robustness checks (placebo windows), and say "if more time, I'd build a counterfactual simulator combining probabilistic forecasts with the new lead-time distribution to quantify long-run inventory economics."
A second angle — "Detect and prioritize SKU-store anomalous stockout spikes"
Here the problem is detection and triage rather than causal estimation. Build SKU-store daily time series of stockout indicator and use hierarchical smoothing to reduce noise. Apply change-point detection (e.g., rolling z-score on smoothed rate, CUSUM) with minimum-impact threshold in dollars to prioritize. Then perform quick root-cause regression: regress stockout spike magnitude on covariates (shipments missed, lead time increases, sudden demand surge, price changes) to surface likely causes. The core concept is the same—tie metrics to business impact and prefer aggregated, probabilistic signals—while constraints emphasize speed, interpretability, and prioritization rather than causal attribution.
Common pitfalls
Pitfall: Designing metrics that confuse availability with demand suppression.
Analysts often treat decreased sales during stockouts as lower demand; instead, mark missing sales as censored and avoid evaluating policy impact on naive sales counts without correcting for lost sales.
Pitfall: Using point-forecast error (RMSE) to size safety stock.
Because stockouts depend on tails, optimizing RMSE won't minimize lost sales; prefer quantile forecasts (e.g., 95th percentile) and evaluate with quantile loss or CRPS.
Pitfall: Ignoring clustering and spillovers in experiments.
Randomizing at order-line level while replenishment is atstore-SKUor supplier level induces contamination; state cluster-level randomization and account for intra-cluster correlation in power calculations.
Connections
Interviewers may pivot to demand forecasting techniques (time-series, hierarchical models) or to supply chain optimization topics like lot-sizing and transportation cost tradeoffs; they may also ask about model monitoring and data drift for forecast degradation. Be ready to move from causal effect to simulation-based decisioning.
Further reading
-
Forecasting: Principles and Practice (Hyndman & Athanasopoulos) — practical time-series forecasting methods and evaluation, strong on probabilistic forecasts.
-
Forecasting at Scale (Taylor & Letham, Prophet) — introduces pragmatic forecasting with seasonality and changepoints, useful for business calendars.
-
Silver, Pyke, Peterson — Inventory Management and Production Planning and Scheduling — classic treatment of safety stock, service levels, and inventory policy tradeoffs.