← portfolio
Technical Report · Agri-Supply Chain

Agri-Demand Optimizer:
Predicting Fresh Produce Orders
for Kenyan Distribution Networks

Abstract

This report describes a demand forecasting system built for Farm To Feed, a Kenyan agri-commerce platform that redistributes surplus produce. The model predicts whether individual buyers will purchase specific products in the next one to two weeks, and estimates order volumes. Accurate demand signals allow farmers to harvest against committed orders rather than guesswork, and allow buyers to plan procurement without over-ordering. The final ensemble achieved a private leaderboard AUC of 0.9165, placing it in the top tier of the Zindi competition submissions.

Performance Summary

0.9165
Private AUC
Purchase prediction, held-out test set
0.612
Volume RMSE
2-week order quantity, cross-validated
65/35
Ensemble Blend
CatBoost / LightGBM weighted average
Purchase Prediction AUC across development versions
AUC on held-out validation set — higher is better. Plateau begins after V9 as diminishing returns from feature engineering set in.
Note: V1–V4 used single-model baselines. Ensemble introduced at V8. Overfitting guard applied from V10.
Volume forecast error (RMSE) vs. baseline
1-week and 2-week forecast windows compared against a naive mean-repeat baseline.
Baseline: predicting the historical mean order quantity per buyer-product pair. Delta-modeling architecture produced the largest single improvement (+0.07 RMSE).

Context & Problem

Food waste as a supply-demand coordination failure

Farm To Feed connects smallholder farmers with commercial buyers (restaurants, schools, corporate kitchens) in Kenya. A persistent challenge is demand uncertainty: buyers order conservatively to avoid spoilage, farmers harvest optimistically to maximise income. The mismatch produces avoidable post-harvest losses — estimated at 30–40% of perishable produce in Kenya's fresh market chain.

The core hypothesis is simple: if buyers can be shown accurate demand signals two weeks ahead, they can commit earlier, and farmers can harvest against confirmed orders rather than projected ones.

Simulated weekly surplus reduction — model-guided vs. unguided ordering
Modelled across a representative 8-week deployment window. Values are illustrative based on estimated 28% mean waste reduction from advance demand visibility.
* Simulated. Actual reduction will vary by buyer category, seasonality, and adoption rate. Real-world validation is recommended for Week 1–4 of any pilot deployment.

Methodology

Delta-modeling architecture

The model separates the forecasting problem into two parts: (1) a binary purchase classifier predicting whether a buyer will order at all in a given week, and (2) a volume regression estimating how much they will order. The two-week volume prediction is computed as: V₂w = V₁w + ΔV, where ΔV is modelled independently to capture temporal drift without compounding baseline error.

Business Impact

Stakeholder Problem addressed Measurable outcome Status
Smallholder farmers Harvest decisions made without buyer commitment Income variance reduced via advance order signals (est. 20–30%) Live
Commercial kitchens Over-ordering to buffer against supply uncertainty Spoilage rate reduction through tighter weekly commits (est. 25–35%) Live
Farm To Feed logistics Reactive route planning and late supplier coordination 14-day forward demand visibility enables pre-planned routes Pilot
NGOs and impact investors Difficulty quantifying food waste reduction Weekly demand signal dashboard with surplus diversion metrics Planned

Resources

Conversational Analytics

Talk to the data

This interface demonstrates how stakeholders can query demand forecasting data using natural language, powered by an MCP server backend. In production, an LLM agent connects to the MCP server to parse questions, select the right tool, and return data-driven answers.

MCP-FARM · AGENT READY · 6 TOOLS AVAILABLE
TRY:
Architecture: Stakeholder question → LLM Agent (parses intent) → MCP Server (selects tool: top_products, query_demand, waste_estimate, etc.) → Data Layer → Formatted response. The MCP server code is available at mcp_farm.py.
Simulated impact figures (waste reduction, income variance) are derived from competition-provided dataset statistics and documented research on Kenyan fresh-produce supply chains. They are not audited. Actual outcomes will depend on adoption rate, product mix, and market conditions at the time of deployment.