IPC phase classification for Madagascar using FEWS NET & HDX
# Madagascar Food Security Early Warning System
> Predicting acute food insecurity phases for Madagascar livelihood zones using
> FEWS NET IPC data and XGBoost — deployed as a serverless AWS Lambda function
> behind API Gateway, with a FastAPI local service and Docker support.
---
## Overview
This project builds an end-to-end machine learning pipeline that ingests IPC
(Integrated Food Security Phase Classification) data from the FEWS NET API,
engineers temporal lag and cold-start interaction features, trains binary and
multiclass XGBoost classifiers with walk-forward cross-validation, and serves
predictions via both a local FastAPI service and a serverless AWS Lambda function.
The system outputs a crisis probability and binary label for any Madagascar
livelihood zone based on its historical food security trajectory.
**Domain context**: Madagascar experiences chronic food insecurity, particularly
in the Grand Sud (Androy, Atsimo Andrefana) and Grand Sud-Est (Befotaka,
Farafangana, Ikongo) regions. The lean season runs October–March. This system
is designed to support humanitarian early warning, not replace IPC technical
working group processes.
---
## Results
### Walk-forward cross-validation (2019–2023)
| Fold | n Crisis | ROC-AUC | Precision | Recall | F1 |
|------|----------|---------|-----------|--------|----|
| 2019 | 11 | 0.990 | 0.556 | 0.909 | 0.690 |
| 2020 | 23 | 0.975 | 0.759 | 0.957 | 0.846 |
| 2021 | 63 | 0.977 | 0.920 | 0.730 | 0.814 |
| 2022 | 79 | 0.987 | 0.716 | 0.987 | 0.830 |
| 2023 | 4 | 0.978 | 0.125 | 1.000 | 0.222 |
| **Mean** | — | **0.981** | **0.615** | **0.917** | **0.680** |
### Held-out test set (2024–2026)
| Model | ROC-AUC | Crisis Recall | Crisis F1 |
|-------|---------|---------------|-----------|
| Binary (Crisis vs Not) | 0.801 | 0.00 | 0.00 |
| Multiclass (P1 / P2 / P3+) | — | 0.00 | 0.00 |
**The model fails on the 2024–2026 test period due to distributional shift** —
Crisis events in 2024/2026 arrive from lower …