
Moving Beyond Excel: Predicting Inventory Demand With Machine Learning
Why traditional stock taking is costing you money, and how predictive models can optimize your supply chain.
Wilmer Heras
Inventory Management, Demand Forecasting
Having capital trapped in dead inventory is just as dangerous as stocking out of your best-selling product. Yet most mid-size retailers and distributors still manage their purchasing with the same tools they used a decade ago: Excel spreadsheets, gut feeling, and last month's numbers.
In a market where consumer behavior shifts weekly and supply chains remain unpredictable, that approach is a guaranteed way to bleed margin.
The Real Cost of Guessing
Let's put numbers to it. A typical mid-size retailer holds 20–30% more inventory than they actually need at any given time. That's not a rounding error — that's capital sitting on shelves instead of generating returns.
The costs compound in ways most operators don't track:
- Holding costs: Warehouse space, insurance, depreciation, and shrinkage on unsold goods
- Opportunity cost: Cash locked in dead stock can't fund marketing, hiring, or better-margin products
- Stockout losses: On the flip side, running out of a top seller during peak season means lost revenue you never recover
- Manual labor: Purchasing managers spending hours per week reviewing spreadsheets instead of making strategic decisions
Moving averages and "last month + 10%" formulas ignore seasonality, promotional effects, weather, and competitive dynamics. They work until they don't — and when they fail, they fail big.
How Predictive Demand Forecasting Works
Machine learning doesn't replace your purchasing team's expertise — it augments it with precision they can't achieve manually. Here's the approach, step by step:
Step 1: Data Collection & Cleaning
We start by pulling your historical sales data. The more history, the better — but even 12 months of clean data is enough to build a useful model.
Key data sources:
- Point-of-sale transactions — daily sales by SKU, location, and channel
- Inventory snapshots — current stock levels and reorder points
- Calendar data — holidays, paydays, school schedules, promotional periods
- External signals — weather forecasts, local events, marketing campaign schedules
You don't need "big data" for this to work. A retailer with 200 SKUs and 18 months of daily sales data has more than enough signal for accurate forecasting.
Step 2: Feature Engineering
Raw data isn't predictive on its own. We transform it into features the model can learn from:
- Lag features: Sales from 7, 14, 28, and 90 days ago
- Rolling statistics: 7-day and 30-day rolling averages and standard deviations
- Seasonality indicators: Day of week, month, quarter, holiday flags
- Trend components: Is this SKU trending up, flat, or declining?
- Promotional effects: Was there a discount or ad campaign running?
This is where domain knowledge meets data science. The best models are built by people who understand both the math and the business.
Step 3: Model Training
We use XGBoost (gradient-boosted decision trees) as the primary algorithm for most demand forecasting tasks. Why?
- Handles mixed data types — numeric, categorical, and time-based features without preprocessing headaches
- Captures non-linear relationships — seasonal patterns, promotional spikes, and interaction effects that linear models miss
- Fast to train and iterate — we can test dozens of configurations in hours, not days
- Interpretable — feature importance scores tell you why the model predicts what it does
For products with strong temporal patterns (e.g., weekly cycles), we layer in time series models (Prophet, ARIMA) and ensemble the predictions.
Step 4: Validation & Backtesting
No model goes to production without rigorous backtesting. We:
- Hold out the most recent 4–8 weeks of data
- Train the model on everything before that cutoff
- Generate predictions for the held-out period
- Compare predicted vs. actual demand at the SKU level
- Measure accuracy using MAPE (Mean Absolute Percentage Error) and bias metrics
A good demand forecasting model hits 85–95% accuracy at the SKU-weekly level. For category-level forecasts, accuracy typically exceeds 95%.
A distribution company we worked with achieved 92% forecast accuracy at the SKU level within the first month — up from roughly 60% using their previous Excel-based approach.
Step 5: Deployment & Delivery
The model runs on an automated weekly schedule:
- Monday morning: New forecasts generated for the next 4–8 weeks
- Output: A clean dashboard (or CSV/API) showing exactly what to order, in what quantity, and when
- Alerts: Anomaly detection flags unexpected demand spikes or drops so your team can investigate early
- Retraining: The model automatically retrains monthly with fresh data to stay accurate as patterns shift
What the Output Looks Like
Your purchasing manager opens a dashboard on Monday morning and sees:
| SKU | Current Stock | Predicted Demand (2 weeks) | Recommended Order | Reorder By | |-----|--------------|---------------------------|-------------------|------------| | A-1042 | 340 units | 520 units | 250 units | Tuesday | | B-0871 | 1,200 units | 380 units | Skip this cycle | — | | C-2299 | 45 units | 190 units | 180 units | Today |
No guessing. No hours in spreadsheets. Just a clear, prioritized list of actions.
Real-World Impact
Here's what happened when we deployed this system for a regional distributor with 1,800 SKUs:
Within 90 days:
- Dead stock reduced by 18% — freeing up warehouse space and $140,000 in trapped capital
- Stockout events dropped by 62% — protecting revenue on high-margin products
- Purchasing manager time went from 15 hours/week on spreadsheets to 3 hours/week reviewing model recommendations
- Gross margin improved by 2.3 percentage points from better stock mix and fewer emergency orders
The system has now been running for 8 months, retraining monthly, with no manual intervention.
The ROI
The math on demand forecasting is straightforward:
- Reduced holding costs: 10–20% less capital trapped in excess inventory
- Fewer stockouts: Direct revenue protection on your best products
- Better cash flow: Order what you need, when you need it — no more, no less
- Time savings: Purchasing decisions that took hours now take minutes
For a business doing $5M in annual inventory purchases, even a 10% improvement in ordering accuracy represents $500,000 in better-deployed capital per year.
Getting Started
You don't need to overhaul your systems or hire a data science team. The requirements are simpler than most expect:
- 12+ months of sales history at the SKU level (daily or weekly)
- Current inventory levels in any exportable format
- A purchasing workflow — even if it's "someone checks a spreadsheet"
We handle the data pipeline, model development, validation, and deployment. Most implementations go live in 3–4 weeks. The first forecast arrives Monday morning, and your team starts making better decisions immediately.