Personal Work

Projects

Applied machine learning and cloud data engineering, built end-to-end outside of professional engagements.

QGI: Quantitative Geopolitical Intelligence

Active Development

An applied-machine-learning platform that reads six decades of national indicators to find countries tracing the same trajectories that preceded past crises, and surfaces the real historical precedents behind every signal.

Live at qgintelligence.com ↗ Presented a QGI workshop · 8th PPE Conference, University of Witten/Herdecke Solo-built · 7 repos · Multi-account AWS

Status: research-grade and in active validation. QGI reports how strongly a country resembles historical precedents, ranked, evidenced, and honest about uncertainty, rather than issuing probabilistic forecasts.

QGI is a solo-built, seven-repository system running on a multi-account AWS backbone, live at qgintelligence.com. It has grown through two engines. The Classic Cascade, a pure-statistics correlation pipeline, mines billions of cross-country indicator correlations to assemble event “recipes.” The Trajectory Engine, the current standard, wraps each recipe in its own machine-learning model that learns which indicators matter, over what horizon, and how closely a country today resembles the historical cases.

Engine 1

Classic Cascade: the statistical core

A pure-statistics pipeline: for every pair of countries and every indicator it computes time-shifted Pearson correlations (SCDIs), aggregates them into multi-indicator Patterns, and binds those to real historical events to form Recipes, reusable fingerprints of what tends to precede a given kind of crisis. One full run computes on the order of billions of correlations across 180+ countries.

180+Countries
250Indicators
BillionsPearson Correlations
GravitonSpot · Cost-Optimised
ServerlessOrchestration
  1. Start
  2. 0

    Phase 0: Hygiene

    1. Lambda

      Janitor

      Removes stale intermediate data before each run.

  3. 1

    Phase 1: Ingest

    1. Lambda

      Indicator Fetcher

      Pulls macro indicators (World Bank, V-Dem, FAOSTAT) → Parquet → S3.

    2. Lambda

      Dispatcher A

      Fans out one Fargate Spot task per indicator.

    3. Wait

      Workers Download & Hash 21 min · hard

      Pipeline A workers download and hash indicator data from S3.

    4. Lambda

      Reporter

      Tallies which indicators were updated; emits updated_ids.

  4. updated_ids · updated_count
  5. Updates Found?

    yes → Phase 2 none → skip to Phase 5
  6. 2

    Phase 2: Compute · SCDI Engine

    1. Lambda · AWS Batch

      Batch Orchestrator (Trigger B)

      Submits Pearson cross-correlation jobs across all country pairs to Graviton Spot instances.

    2. ↻ every 30 min · until Batch completes

      1. Wait

        Poll Interval 30 min · poll

      2. Lambda

        Batch Checker

        Counts still-running Batch jobs.

      3. Batch Done?

        ↻ jobs_running > 0, repeat all done, proceed
  7. SCDI Parquet → S3
  8. 3

    Phase 3: Discovery · Glue Crawler

    1. AWS Glue SDK

      Start Crawler

      Launches qgi-scdis-partition-finder to auto-discover new Parquet partitions written by Phase 2.

    2. ↻ every 5 min · until crawler is READY

      1. Wait

        Poll Interval 5 min · poll

      2. AWS Glue SDK

        Check Crawler

        Reads crawler state from Glue API.

      3. Crawler Ready?

        ↻ State ≠ READY, repeat READY, proceed
  9. partitions registered
  10. 4

    Phase 4: Synthesis · Patterns & Recipes

    1. Lambda · SQS

      Dispatcher C

      Fans out workers via SQS to aggregate SCDIs into multi-indicator Patterns, then bind them to historical events as Recipes.

    2. Wait

      Workers Build Patterns & Recipes 60 min · hard

      Pipeline C workers compute the Patterns dataset and event-bound Recipes, writing results to S3.

    3. Amazon Athena

      Repair Table

      MSCK REPAIR TABLE patterns, registers new Parquet partitions for querying.

  11. patterns & recipes → queryable
  12. 5

    Phase 5: Ops Report

    1. Lambda

      DLQ Scanner

      Surfaces failed messages and unprocessed items; produces final health report. Also the landing point when Phase 1 finds no updates.

  13. Workflow Complete

⏱ Min runtime ~2h+ (Batch-dependent)  ·  Step Functions polls async, zero idle compute cost during waits

Engine 2

Trajectory Engine: the ML layer

current

Each recipe becomes its own supervised model. A per-recipe “walk” selects the handful of indicators that carry signal, searches for the horizon over which the pattern plays out, and validates everything with leave-one-country-out cross-validation, so a model is never scored on a country it trained on. Surviving models rank today’s countries by SHAP-weighted similarity to the historical precedents.

60+Trends Modeled
250Indicators · WB/V-Dem/FAOSTAT
XGBoostPer Recipe
LOCO-AUCValidated
Low-CostSpot Fleet
  1. Recipe + Labels
  2. 1

    Feature Substrate

    1. Amazon S3 · Parquet

      Feature Substrate

      250 macro indicators (World Bank · V-Dem · FAOSTAT) as a shared columnar feature store, plus curated and verified event labels (positives).

  3. indicators + labels
  4. 2

    Per-Recipe Walk F-ML-1

    1. Python · scikit-learn

      Univariate Pre-filter

      Ranks 250 indicators by leave-one-country-out signal and keeps the top 40, capping the expensive search so the indicator pool can grow without exploding compute.

    2. Greedy Search

      Indicator Selection + Window Search

      Greedy forward selection over indicators, jointly searching the canonical horizon {3 … 25 years}; a candidate joins the recipe only if it lifts validated AUC.

    3. XGBoost / Logistic

      Train + Leave-One-Country-Out AUC

      XGBoost per recipe (logistic fallback for sparse classes), scored by leave-one-country-out cross-validation so no country is ever evaluated on itself.

    4. Clears LOCO-AUC validation floor?

      validated directional / experimental
  5. canonical shape + indicator weights
  6. 3

    Similarity-as-Risk Scoring

    1. SHAP

      Similarity-as-Risk Scoring

      Each country’s recent trajectory is compared to the recipe’s canonical shape via SHAP-weighted cosine similarity, mapped to a 0–100 resemblance score with a confidence band.

  7. 0–100 resemblance + precedents
  8. 4

    Recipe-Fleet · AWS Batch

    1. Step Functions · Batch · Spot

      Parallel Fleet Fan-Out

      A canary-gated Step Functions Map fans every runnable recipe across right-sized 2-vCPU Graviton Spot instances (c7g / m7g), writing per-recipe models back to S3, a full fleet run costs a few dollars.

  9. Trend Tracker · live

Resemblance ranks, not probabilities  ·  leak-guarded (leave-one-country-out)  ·  research-grade & in validation

Platform & Stack

Python XGBoost scikit-learn SHAP LOCO Cross-Validation Pearson Correlation AWS Step Functions AWS Lambda AWS Batch Graviton Spot AWS Glue AWS Athena Amazon S3 DynamoDB Terraform GitHub Actions OIDC GDELT · BigQuery Next.js Parquet Docker