DEV Community

DanielNnadi
DanielNnadi

Posted on • Edited on

How I Built a Python Demand Forecasting Model That Saved $18,000

Emergency procurement was happening 23 times per month at the automotive parts company where I work. The purchasing team was reactive rather than proactive, causing stockouts and premium shipping costs.

I built a demand forecasting model that reduced emergency procurement by 65% and saved $18,000 annually.


The Problem

The team was restocking after stock hit zero rather than before. By the time they noticed, supplier lead times meant there was already a gap. Emergency orders cost more and disrupted operations.


The Solution

Data Collection

I pulled 13 months of stock movement data from our SQL inventory database โ€” roughly 195,000 rows across 512 SKUs.

Feature Engineering

I engineered features including:

  • Rolling average consumption (7-day and 30-day)
  • Days of stock remaining
  • Stock buffer ratio
  • Seasonal indicators (month, day of week)

Model Selection

I tested three approaches:

  • Simple threshold rule (too many false positives)
  • Gradient Boosting (good but lower precision)
  • Random Forest (best balance)

Random Forest gave 78% precision and 76% recall.


Deployment

The model runs daily at 7 AM and outputs a prioritized reorder list directly to the operations team as an Excel report.


Results

Metric Before After
Emergency orders/month 23 8
Reduction - 65%
Annual savings - $18,000

Key Takeaway

The model's accuracy mattered less than the cross-functional review process. Consistent weekly meetings between procurement and data teams drove the real behavior change.
(https://danielnnadi.github.io/DanielNnadi/article-1-sql-optimization.html))

Connect With Me

๐Ÿ“Š Portfolio:
(https://danielnnadi.github.io/DanielNnadi/)

๐Ÿ’ผ LinkedIn: linkedin.com/in/danielnnadi

๐Ÿ™ GitHub: github.com/danielnnadi

Top comments (0)