Logo Lanfrica

JUBRIL-ADEBOGUN/ML-Commodity-Forecasting

Domain:

agriculture

Record type:

project
Creator:
JUB
Host:
Can you accurately forecast weekly market prices for maize in Kenya?. ccurate forecasts will help farmers time their sales effectively, increase earnings, and strengthen agriBORA’s integrated storage, credit, and market intelligence service to East African farmers. # ML-Commodity-Forecasting # AgriBORA Maize Price Forecasting Challenge - 3rd Place Solution ## πŸ“‹ Executive Summary This repository contains the **3rd place winning solution** for the Zindi agriBORA Commodity Price Forecasting Challenge. The solution implements a sophisticated machine learning pipeline for multi-step ahead time series forecasting of weekly maize wholesale prices across five Kenyan counties. **Achievement:** 3rd place ranking through robust feature engineering, Bayesian hyperparameter optimization, and ensemble modeling techniques with composite score (50% RMSE + 50% MAE). --- ## πŸ”„ Notebook Workflow Summary The **Agribora_modelling.ipynb** implements a comprehensive 14-section machine learning pipeline: ### Workflow Overview ``` SECTION 1-2: ENVIRONMENT & DATA LOADING β”œβ”€ Setup Python environment, import libraries β”œβ”€ Load raw data from 4 CSV sources └─ Display data summaries & availability SECTION 3: EXPLORATORY DATA ANALYSIS (EDA) β”œβ”€ Examine data structure and distributions β”œβ”€ Identify date ranges and county coverage └─ Assess data quality and completeness SECTION 4: DATA PREPROCESSING & CLEANING β”œβ”€ Aggregate daily prices to weekly β”œβ”€ Consolidate multiple data sources β”œβ”€ Filter target counties and validate └─ Handle missing values strategically SECTION 5: PANEL DATA CONSTRUCTION β”œβ”€ Create complete county Γ— week grid β”œβ”€ Merge price data with external features β”œβ”€ Forward/backward fill missing values └─ Drop incomplete records SECTION 6: FEATURE ENGINEERING β”œβ”€ Generate 60+ features: β”‚ β”œβ”€ Temporal (week, month, day) β”‚ β”œβ”€ Seasonal (Fourier sin/cos) β”‚ β”œβ”€ Lagged prices (1W, 2W, 4W, 8W, 12W) β”‚ β”œβ”€ Momentum indicators (rate of change) β”‚ β”œβ”€ Volatility (rolling std dev) β”‚ β”œβ”€ Trends (rolling means, ratios) β”‚ β”œβ”€ Transformations (log prices) β”‚ └─ External feature lags (FX, CPI) └─ Fill remaining NaN values intelligently SECTION 7: TRAIN-TEST SPLIT β”œβ”€ Time-series aware split (last 2 weeks = test) β”œβ”€ Prepare feature matrix (X) and target (y) β”œβ”€ T …