Forecasts tomato and onion prices by state in Nigeria using WFP market data. 3MTT NextGen capstone AI-07.
cat > README.md <<'MDEOF'
# Market Price Predictor - Tomato & Onion
**3MTT NextGen | Brief AI-07 | AI & Machine Learning cohort**
Fellow: Kabiru Usman Bashir | Omni Digital Media Institute, FCT
A forecasting tool for retail tomato and onion prices in Nigeria, built to help
traders, food vendors and households answer one recurring question: buy now, or
wait?
---
## What it does
Pick a state and a commodity, and the app shows the recorded price history, a
forecast one to six months ahead, and - critically - the range that forecast is
likely to fall within. It also reports how volatile that market is, how prices
compare to a year ago, and whether a seasonal pattern exists at all.
## The headline finding
I set out to model seasonality: tomato prices are supposed to spike in the rainy
lean season and fall at harvest. **In this data, they do not.**
Measured on the cleaned series, the calendar month explains only **2% of
month-to-month price movement** in Borno and Yobe. A seasonal-naive forecast
(assume this month repeats last year's move) loses to simple persistence by
**44%**. These are conflict-affected markets: prices are driven by road closures,
insecurity and fuel costs, not the agricultural calendar.
So the tool tests three candidate forecasts on held-out data - a trained
gradient-boosting model, a drift term, and naive persistence - and uses whichever
wins. Here, persistence wins, and the tool says so rather than manufacturing a
trend. The forecast is presented with an empirical uncertainty band, because in a
market that moves +/-16% a month, the range is the honest answer and a single
number is not.
## Results
Tested on 21 observations from January to June 2026, never seen during training
(3,340 training rows).
| Forecast | MAE (N per 0.5 kg) | MAPE |
|---|---|---|
| Naive persistence baseline | 36.00 | 12.6% |
| This system | 36.00 | 12.6% |
| Learned weights | model 0.00, drift 0.00 | |
The model weight of zero is the result, not a bug: the system …