Case study

Fire Forecasting System

End-to-end ML pipeline predicting wildfire risk across Southern California WUI sites using NASA FIRMS data.

  • Python
  • TensorFlow
  • FastAPI
  • Next.js
  • Pandas
The core problem

What needed solving

Emergency planning teams and fire risk analysts needed a data-driven, reproducible system that combines satellite fire detection, historical weather patterns, and geographic perimeter data to forecast where fire risk would escalate — without relying on manual signal interpretation.

The solution

What I built

The pipeline automates data ingestion, feature engineering (7-day lags, rolling stats, seasonality, neighbor features), chronological train/val/test splitting, class-imbalance weighting, and ANN/LSTM training — then serves predictions and PR/ROC curves through a full-stack dashboard operators can query interactively.

A complete Python machine-learning system that predicts next-day fire occurrence for 20+ Wildland-Urban Interface sites in Ventura, Santa Barbara, and LA counties. Ingests real NASA FIRMS VIIRS satellite data (75K+ records), RAWS daily weather features, and CAL FIRE FRAP historical perimeters. Trains ANN/LSTM models and surfaces predictions through a Next.js + FastAPI dashboard with interactive Leaflet maps and ApexCharts.

Integration

How it fits together

Makefile targets ingest NASA FIRMS VIIRS detections (75K+ records, 2019–2024), RAWS weather, and CAL FIRE FRAP perimeters. A feature step builds 7-day lags, rolling stats, seasonality, and neighbour features. Models (baselines, an ANN, and a 14-day LSTM) train behind a FastAPI service with 9 endpoints, and a Next.js dashboard shows metrics, PR/ROC curves, and per-site predictions on a Leaflet map.

The flow, step by step

  1. Download FIRMS VIIRS satellite data and FRAP perimeter files from Google Drive, then run 'make fetch-firms' and 'make fetch-frap' to generate processed CSVs.
  2. Run the FastAPI backend to train the ANN model (~1-2 min on CPU) or LSTM (~5-8 min). The 9 REST endpoints expose metrics, model artifacts, and geospatial data.
  3. Open the Next.js dashboard to inspect KPI cards, PR/ROC curves, confusion matrix, and threshold tuning controls.
  4. Switch to the Leaflet map view to review per-site predictions, FRAP historical overlays, and WUI boundary markers.
Problems along the way

What got hard, and what I did about it

Fire days are rare

The problem

With heavily imbalanced labels, a model can look accurate by always predicting "no fire".

What I did

Computed class weights automatically and used PR-AUC as the primary metric instead of accuracy.

Time-series leakage

The problem

Random splits and scalers fit on all data quietly leak the future into training.

What I did

Predicted t+1, fit the scaler on the training set only, and used a chronological 70/15/15 split.

Three datasets, three shapes

The problem

Satellite points, station weather, and polygon perimeters do not line up on their own.

What I did

Automated the joins in a reproducible pipeline so every run rebuilds the same dataset.

Takeaways

What I learned

  • Choosing the evaluation metric is a modelling decision, especially with imbalanced classes.
  • Leakage hygiene matters more than model size; the split strategy is part of the model.
  • Baselines (logistic regression, random forest) first make it clear whether a neural network is earning its complexity.
Outcome

Where it stands today

75K+ NASA FIRMS VIIRS records across 2019–2024 processed into a chronological ML dataset.
ANN (256→128→ 64→1 with Dropout) and LSTM (14-day lookback) trained with automatic class-weight computation for imbalanced fire labels.
Interactive Leaflet map with 20+ WUI site markers, FRAP perimeter overlays, and per-site performance breakdowns.
Strict data pipeline hygiene: target is t+1, scaler fit on train only, no data leakage across 70/15/15 chronological split.

Milestones

  • Data pipeline (FIRMS + RAWS + FRAP)

    NASA VIIRS ingestion, RAWS weather features, and FRAP perimeter joins are automated via Makefile.

    Shipped
  • ANN & baseline models

    Logistic Regression, Random Forest, and ANN all trained and evaluated with PR-AUC as the primary metric.

    Shipped
  • LSTM with 14-day lookback

    LSTM model implemented as an optional extension to the ANN baseline.

    Shipped
  • Real-time weather feed integration

    Live RAWS or NWS data ingestion for continuous daily inference not yet implemented.

    Planned

Next up

  • Add real-time RAWS weather feed ingestion for daily automated inference.
  • Introduce evacuation-route map overlays for emergency planning teams.
  • Expand WUI site coverage beyond the tri-county region.