A statistically rigorous time-series forecasting and machine learning pipeline, predicting crop outputs across Maha & Yala seasons using SARIMAX, Random Forest, and Residual Hybrid Models.
Rice cultivation is the backbone of Sri Lanka\'s food supply. Accurate forecasting guides imports, pricing policy, and agricultural planning, safeguarding against monsoon-driven crop failures.
Traditional models drop outliers or use random splits. This project strictly prevents data leakage by implementing chronological training/testing splits and handles outliers using Robust Scaling to keep sequential series indexing intact.
Economic, environmental, and climatic feature vectors mapped from census records.
| Feature Name | Type | Description | Monotonic correlation (r) |
|---|---|---|---|
| Year_New | Temporal | Chronological Year (1950 - 2024) | Trended |
| Season | Categorical | Cultivating cycle (Yala = southwest monsoon, Maha = northeast monsoon) | Strong seasonal driver |
| Sown (*000 Acres) | Continuous | Total land area sown with paddy seed | +0.887 (Strong positive) |
| Harvested (*000 Acres) | Continuous | Total land area successfully harvested | +0.904 (Strongest positive) |
| GDP B$ | Continuous | Sri Lanka GDP in billions of USD | +0.835 |
| Inflation(%) | Continuous | Annual inflation rate | +0.337 |
| Rainfall(mm) | Continuous | Mean seasonal cumulative precipitation | +0.365 |
| Temperature(°C) | Continuous | Mean seasonal temperature | -0.295 (Negative correlation) |
| Production (*000 Mt.) 🌾 | Continuous | Total paddy crop harvested (target variable) | Target |
Chronological split validation (Train: 1950Q2–2018Q4, Test: 2019Q2–2024Q2) preventing data leakage.
| Model Pipeline | Validation strategy | R² Score | RMSE (Mt) | MAPE (%) |
|---|---|---|---|---|
| Baseline SARIMA (1,1,1)(1,1,0,2) | Chronological Split | 0.5401 | 238.45 | 8.12% |
| Advanced SARIMAX (1,1,1)(1,1,0,2) | Chronological + Exog Forecasted | 0.8924 | 114.65 | 6.67% |
| Random Forest Regressor | RobustScaled features | 0.9134 | 210.33 | 19.25% |
| XGBoost Regressor | RobustScaled features | 0.8789 | 248.81 | 21.96% |
| Hybrid SARIMAX + RF Residuals 🏆 | Residual Coupling | 0.9254 | 98.11 | 5.12% |
| Season | Year | Forecasted Production | 95% CI Range |
|---|---|---|---|
| Maha | 2024/2025 | 1,942.53 | [1,805.10, 2,090.41] |
| Yala | 2025 | 2,003.28 | [1,822.14, 2,202.61] |
| Maha | 2025/2026 | 2,105.59 | [1,889.30, 2,346.70] |
| Yala | 2026 | 2,230.89 | [1,955.10, 2,545.92] |
| Maha | 2026/2027 | 2,341.22 | [2,014.20, 2,721.43] |
| Yala | 2027 | 2,488.10 | [2,102.50, 2,944.51] |
The forecast reveals a stable upward trend in production, expecting Sri Lanka to surpass 2,400 thousand Metric Tons by Yala 2027 under normal weather assumptions. The predicted exogenous variables prevent the "flatline" projection error present in the original model, resulting in a highly realistic confidence interval (shaded region).
A modular, leakage-free processing architecture combining statistical forecasting and non-linear regression.
Evidence-backed insights that shape the prediction architecture.
Available for agricultural forecasting, time series consulting, and ML projects on Kaggle and GitHub.