Philippine Food Price Dashboard: March 2026 Upgrade Changelog
Philippine Food Price Dashboard: March 2026 Upgrade Changelog

Published: March 18, 2026 • Companion post to Predicting Philippine Food Prices with Machine Learning • See also: Before Upgrade | After Upgrade

On March 18, 2026, the Philippine Food Price Prediction system underwent its largest upgrade since the initial Random Forest + PyTorch analysis was published on March 5, 2026. This post documents every change — what was added, what was improved, and a side-by-side comparison of the old and new capabilities.

Upgrade Timeline

Timestamp (PHT) Component Action
2026-03-18 07:30 Wave 1 — Core Infrastructure Dark mode, PWA, Excel export, parallel training, caching, retry logic, API server, data quality dashboard, 136 initial tests
2026-03-18 08:15 Wave 2 — Advanced ML Models LSTM deep learning, exogenous features (NOAA/Frankfurter/FAO), climate scenarios, early warning system, ensemble stacking, model comparison report
2026-03-18 09:00 Cross-Validation 4-worker cross-review: La Niña bug fix (climate_scenarios.py), ensemble NameError fix, TimeSeriesSplit→KFold correction. All 174 tests passing.
2026-03-18 10:30 Wave 3 — Documentation & Reporting README rewrite (355 lines), model comparison report, blog post update, integration test suite (174/174 pass)
2026-03-18 12:00 Truth Verification Cross-checked blog claims against actual code. Fixed 3 discrepancies. Live site verified.

Before vs. After — System Comparison

Model Architecture

Capability Before (March 5) After (March 18)
ML Models Random Forest (500 trees) + PyTorch feedforward NN (2×50 hidden) 5 scikit-learn families (25 variants) + LSTM (2-layer, 128 hidden) + Stacking Ensemble (GB + ExtraTrees + RF → Ridge meta-learner)
Deep Learning Simple feedforward NN, 4 inputs, 100 epochs, CrossEntropyLoss 2-layer LSTM (hidden=128, dropout=0.2), AdamW optimizer, HuberLoss, ReduceLROnPlateau scheduler, early stopping (patience=10), gradient clipping (max_norm=1.0), 12-month sliding windows
Ensemble None — single model predictions StackingRegressor: GradientBoosting (200 trees, depth 4) + ExtraTrees (200 trees, depth 10) + RandomForest (200 trees, depth 10) with Ridge(α=1.0) meta-learner, 5-fold CV
External Data WFP price data only — no exogenous features NOAA Oceanic Niño Index (ENSO), USD/PHP exchange rates (Frankfurter API), FAO Food Price Index. Lagged values (1–6 months), ENSO dummies, momentum indicators. JSON caching with configurable TTL.
Climate Analysis Mentioned as future work 7-phase ENSO correlation (Strong/Moderate/Weak × El Niño/La Niña + Neutral). Impact lag testing at 0, 3, 6 months. Per-commodity, per-region breakdown. 95% confidence scenario projections.
Early Warning Mentioned as future work 4-detector system: price spikes, YoY surges, regional divergence, model-forecast divergence. FEWS NET-inspired 4-level severity (low/medium/high/critical). 949 alerts generated. Interactive Leaflet.js map dashboard.

Infrastructure & Developer Experience

Capability Before (March 5) After (March 18)
Dashboard UI Light theme only, basic Chart.js, no export Dark/light theme toggle, zoom/pan (chartjs-plugin-zoom + Hammer.js), Excel/CSV/PNG/JSON export, Leaflet.js regional heatmap, keyboard shortcuts, PWA installable, 60fps animations
API No API — static HTML dashboards only REST API (7 endpoints): /api/health, /api/commodities, /api/regions, /api/forecast, /api/data-quality, /api/alerts, /api/scenarios. 30s response caching. Port 8787.
Data Pipeline Manual download + retrain daily_update.py with SHA-256 change detection, exponential backoff retry (3 attempts), –dry-run validation, data quality gates (10 checks: min rows, required columns, null %, date range, positive prices)
Training Sequential training, single model family Parallel training across 5 model families × 5 variants (25 models per commodity). ProcessPoolExecutor for CPU parallelism. Per-commodity best model selection by validation MAPE.
Test Suite No tests 174 automated tests across 4 files: data quality validation, model accuracy benchmarks, API endpoint testing, ensemble integration, exogenous feature pipeline integrity
Documentation Basic README 355-line README with architecture diagrams, 15 sections, full API reference, installation guide, model specifications, quick start
Model Reporting Manual comparison Automated model_report.py: MAPE/MAE/R²/Bias per model, best-per-commodity ranking, regional accuracy heatmap, feature importance, priority recommendations (JSON + Markdown output)

Technical Deep Dive

LSTM Architecture (lstm_model.py — 639 lines)

The LSTM replaces the simple feedforward neural network with a sequence-aware architecture designed for time series:

Parameter Value
Architecture 2-layer stacked LSTM → FC(128,64) → ReLU → Dropout(0.2) → FC(64,1)
Hidden Size 128 per layer
Dropout 0.2 (between LSTM layers + FC head)
Sequence Length 12 months (sliding window)
Input Features 6: price_norm, month_sin, month_cos, year_norm, region_enc, pt_enc
Optimizer AdamW (weight_decay=1e-5)
Loss Function HuberLoss (robust to price spike outliers)
LR Scheduler ReduceLROnPlateau (factor=0.5, patience=5, min_lr=1e-6)
Early Stopping Patience=10 epochs on validation loss
Gradient Clipping max_norm=1.0 (prevents exploding gradients)
Batch Size 64
Validation Last 24 months held out

Ensemble Stacking (ensemble_model.py — 577 lines)

The stacking ensemble combines three diverse tree-based learners through a regularized linear meta-learner:

Layer Model Trees Max Depth Key Config
Base 1 GradientBoosting 200 4 lr=0.05, subsample=0.8
Base 2 ExtraTrees 200 10 min_samples_leaf=5
Base 3 RandomForest 200 10 min_samples_leaf=3
Meta-Learner Ridge Regression α=1.0, 5-fold CV

Early Warning Thresholds

Detector Low Medium High Critical
Price Spike >15% >20% >30% >50%
Year-over-Year >20% >30% >50% >80%
Regional Z-Score >1.5σ >2.0σ >2.5σ >3.0σ
Model Divergence >15% >25% >40% >60%

REST API Endpoints (api_server.py)

Endpoint Method Purpose
/api/health GET Server health, uptime, data file status
/api/commodities GET 73 commodities with categories, price ranges, record counts
/api/regions GET 17 administrative regions with price averages
/api/forecast GET Forecasts per commodity (5 models), accuracy metrics
/api/data-quality GET Coverage stats, anomaly counts, model accuracy summary
/api/alerts GET Early warning alerts (filters: severity, type, commodity)
/api/scenarios GET ENSO climate scenario projections

Bugs Found & Fixed During Cross-Validation

Four independent AI agents cross-reviewed each other’s implementations. Three bugs were caught and fixed:

Bug File Found By Fix
La Niña ONI mask inversion — oni_min < oni_max always true, yielding 0 La Niña observations climate_scenarios.py:210–213 Alpha (reviewing Beta) Corrected to oni_min <= oni <= oni_max with proper negative ranges
per_commodity NameError — undefined variable in stacking loop ensemble_model.py Delta (self-fix) Added proper variable initialization before loop
TimeSeriesSplit incompatible with stacking — CV produced empty folds for small datasets ensemble_model.py Delta (self-fix) Switched to KFold(n_splits=5, shuffle=False)

File Inventory (27 files, 51,238 lines)

File Lines Purpose
lstm_model.py 639 PyTorch LSTM deep learning price forecaster
ensemble_model.py 577 Stacking ensemble (GB + ExtraTrees + RF → Ridge)
exogenous_features.py ~500 NOAA ONI, USD/PHP, FAO FPI integration
climate_scenarios.py ~430 ENSO-price correlation & scenario projection
early_warning.py ~460 4-detector anomaly system + policy recommendations
model_report.py 465 Automated model comparison report generator
api_server.py ~300 REST API server (7 endpoints, stdlib only)
early_warning.html ~600 Interactive Leaflet.js alert dashboard
tests/ (4 files) 174 tests Data quality, model accuracy, API, ensemble, exogenous
README.md 355 Architecture, installation, API reference, 15 sections

What’s Next

The following capabilities are planned for future releases:

  • Satellite imagery (NDVI) integration — Agricultural yield estimation from vegetation indices to predict supply-side shocks before they hit market prices
  • Real-time API with rolling forecasts — FastAPI-powered live forecast endpoint updating daily as new WFP data arrives
  • Philippine ePrice system integration — Direct connection to the Department of Trade and Industry’s automated price monitoring
  • Temporal Fusion Transformers — Multi-horizon forecasting with attention-based architecture for complex seasonal decomposition
  • Automated anomaly alerting — Push notifications when critical-severity alerts are triggered in real-time data

Source code: github.com/Zek21/ph-food-price-dashboard • Dataset: WFP VAM Food Prices • Last verified: March 18, 2026 20:00 PHT

Chat with us
Hi, I'm Exzil's assistant. Want a post recommendation?