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.
project link

Connect With Me

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

πŸ’Ό LinkedIn: linkedin.com/in/danielnnadi

πŸ™ GitHub: github.com/danielnnadi

Top comments (1)

Collapse
 
nicholasflores97187 profile image
Nicholas Flores

Reviving this thread because I’m curious about how the model has performed over a longer period. Have there been any tweaks or updates based on new data or patterns? It’d be interesting to hear if the initial success led to any further savings or improvements in efficiency. Anyone else implementing something similar with different tools or algorithms?