Skip to content

Repository files navigation

PredictaX-9 — AI World Cup 2026 Prediction Engine & Arena Trading Agent ⚽🔮

PredictaX-9 is an explainable AI football prediction engine and autonomous trading agent built for the 2026 FIFA World Cup. It combines a Poisson goal-expectancy model with a multiclass outcome classifier to generate a mathematically consistent Home / Draw / Away prediction — then automatically submits that reasoning to a public ledger and places a live order on Polymarket through the Stair AI World Cup Agent Arena.

Built from scratch by a solo developer in Nigeria. Trained on 49,000+ international matches. Competed live in a global AI agent competition with real stakes.

Python LightGBM License Status Stair AI


What Is This?

PredictaX-9 is a deterministic machine learning pipeline — not a prompt-engineered guesser. It was built as a competing agent in the Stair AI World Cup Agent Arena, a live competition where autonomous AI agents place real prediction-market bets on World Cup matches and are scored on both profit and reasoning quality.

Most football prediction systems make a fundamental mistake: they train separate binary classifiers for every betting market independently. This produces probabilities that contradict each other and can sum to over 100%. PredictaX-9 solves this from first principles — every probability it outputs is mathematically consistent and internally derived from the same two source numbers.

The agent competed across 8 fixtures during the 2026 World Cup, submitting every decision to a public reasoning ledger where each step — from raw data ingestion to final bet placement — was logged, auditable, and scored.


Key Features

  • 🎯 Single-market output — one clean Home/Draw/Away pick per match, matching Polymarket's required format
  • 🔍 Full reasoning transparency — every intermediate calculation is logged in an auditable step-by-step trail
  • 📊 85% confidence gate — the agent only makes a "strict pick" when genuinely confident; always provides a best-available pick with an explicit caveat when confidence is low
  • 🧮 Mathematically consistent probabilities — Home Win + Draw + Away Win always sums to exactly 100%, no contradictions possible
  • 🔌 Live data sourcing — pulls real recent-form and head-to-head stats via Gemini grounded search, not hardcoded or hallucinated numbers
  • 🏆 Knockout-stage aware — tags fixtures as Final / Semifinal / Third Place etc., since knockout dynamics differ from group-stage form
  • 🤖 Direct Stair AI Arena integration — submits reasoning to the Ledger API and places live limit orders on Polymarket via the Orders API

How It Works

┌─────────────────────────────────────────────────────────┐
│                     INPUT LAYER                          │
│   Recent form, H2H history, venue & knockout context     │
└────────────────────┬─────────────────────────────────────┘
                     │
          ┌──────────┴──────────┐
          │                     │
          ▼                     ▼
┌─────────────────┐   ┌─────────────────────┐
│  POISSON MODEL  │   │  MULTICLASS MODEL   │
│                 │   │                     │
│  λ home goals   │   │  Home Win / Draw /  │
│  λ away goals   │   │  Away Win           │
│                 │   │  (softmax — always  │
│  (LightGBM +   │   │   sums to 100%)     │
│  Poisson obj.) │   │                     │
└────────┬────────┘   └──────────┬──────────┘
         │                       │
         ▼                       ▼
┌─────────────────┐   ┌─────────────────────┐
│ INTERNAL-ONLY   │   │   DECISION LAYER    │
│ DIAGNOSTICS     │   │                     │
│                 │   │  85% gate           │
│  BTTS, clean   │   │  → strict pick      │
│  sheets (audit  │   │    or NO PICK       │
│  trail only,    │   │                     ���
│  not traded)    │   │  + best-available   │
│                 │   │    pick w/ caveat   │
└─────────────────┘   └──────────┬──────────┘
                                 │
                       ┌─────────┴─────────┐
                       ▼                   ▼
             ┌──────────────────┐ ┌──────────────────┐
             │  Stair AI Ledger │ │  Polymarket Order │
             │  (reasoning)     │ │  (live bet)       │
             └──────────────────┘ └──────────────────┘

Why two models and not one?

The Poisson model predicts expected goals (lambda) for each team separately using a Poisson regression objective. From two lambdas, every goal-related diagnostic — BTTS probability, clean sheet probability, expected total goals — follows from pure probability theory. These are kept in the audit trail but not traded.

The multiclass model predicts Home Win / Draw / Away Win simultaneously using a softmax output, which mathematically forces the three probabilities to sum to 100%. Double chance markets (1X, X2, 12) are derived from these three numbers by simple addition — no additional modelling, no contradictions possible.


Why a Single Pick, Not Over/Under

Earlier iterations of this engine output a full spread of markets — Over/Under 2.5, BTTS, clean sheets, double chance. PredictaX-9 strips that down to a single Home/Draw/Away call because that is the exact market shape Polymarket and the Stair AI Arena's reasoning submission require.

BTTS and clean-sheet numbers are still computed internally and kept in the audit trail. They inform the agent's confidence reading but are not exposed as tradeable picks.


The Confidence Gate

The reasoning submission to the Arena Ledger is gated at 85% confidence. If no outcome clears that threshold, the strict pick is NO PICK — an honest signal rather than a forced low-conviction bet.

A separate best-available pick is always generated for Polymarket, which requires an actual side regardless. This pick is clearly labelled with a confidence caveat when it falls below the 85% bar so the reasoning trace accurately reflects the agent's uncertainty.

This design choice produced some of the most honest records in the Arena — including the France vs England and Spain vs Argentina fixtures where the agent explicitly logged that it was submitting below threshold rather than pretending confidence it did not have.


Sample Output

============================================================
  ⚽ PredictaX-9: France vs England  |  Stage: Third Place Playoff
============================================================

📥 STEP 1 — Live input (Gemini grounded fetch)
   home_goals_scored_last5: 2.0
   home_goals_conceded_last5: 0.6
   away_goals_scored_last5: 1.8
   away_goals_conceded_last5: 0.9
   ...

🧮 STEP 2 — Validated engine input
   HomeGoalsScoredLast5: 2.0 | IsKnockout: 1 | NeutralVenue: 1 ...

🎯 STEP 3 — Feature vector fed to models
   [2.0, 0.6, 0.6, 1.8, 0.9, 0.6, 2.4, 0.6, 1, 0, 1]

🔵 STEP 4 — Expected Goals (Poisson lambdas)
   Home λ : 1.526
   Away λ : 1.129
   Total  : 2.655

🟢 STEP 5 — Match Outcome probabilities (softmax)
   Home Win :  46.6%
   Draw     :  23.7%
   Away Win :  29.6%
   Sum      : 100.0% ✅

📊 STEP 6 — Internal diagnostics (audit trail only — not traded)
   BTTS: 53.0%  |  Home Clean Sheet: 32.3%  |  Away Clean Sheet: 21.7%

⭐ STRICT PICK (threshold ≥ 85.0%)
   🚫 NO PICK — top candidate HomeWin at 46.6% fell short of 85.0%

🎯 BEST-AVAILABLE PICK (always populated for Polymarket)
   → HomeWin at 46.6%
   ⚠️  Low-confidence pick — 46.6% is below the 85.0% reasoning bar.
        Treat as low-conviction. Submitted to Arena with caveat noted.
============================================================

Live Data Sourcing

Match stats are pulled live rather than hardcoded or hallucinated:

Primary — Gemini (grounded search) A single Gemini API call combines Google Search grounding with structured JSON output, returning real-data-backed stats for both teams in the exact schema the engine needs.

Manual override A MANUAL_RESULT_JSON slot accepts a verified AI Studio output directly, bypassing the live call when testing or working around rate limits.

Sports-data API (optional) Swappable to a dedicated football stats API (e.g. football-data.org, API-Football) for deterministic, non-LLM data when preferred.


Arena Performance

The agent competed in the Stair AI World Cup Agent Arena across 8 fixture submissions during the 2026 FIFA World Cup.

Date Fixture Prediction Confidence Outcome
Jun 11 MEX vs RSA Home @ 82.5% High ✅ Mexico won 2-0
Jun 13 BRA vs MAR Home @ 93.4% High ❌ Drew 1-1
Jun 15 BEL vs EGY 1X synthetic High ✅ Drew 1-1 (draw leg hit)
Jun 16 FRA vs SEN 1X synthetic High ✅ France won 3-1 (home leg hit)
Jun 18 CZE vs RSA CZE + DRAW Moderate ❌ Drew 1-1 (partial)
Jun 23 PAN vs CRO ENG @ 82.5% High ❌ Team code mapping bug
Jul 18 FRA vs ENG FRA @ 46.6% Below threshold Logged with caveat
Jul 19 ESP vs ARG ARG @ 39.7% Below threshold Logged with caveat

Final record: 3 wins / 5 losses across 8 submissions

The two below-threshold submissions (July 18 and July 19) demonstrate the confidence gate working correctly — the agent logged its uncertainty explicitly rather than forcing a conviction it did not have.

Arena Model Card

PredictaX-9 in Stair AI Arena

View the full Arena leaderboard and live competition data: 🔗 Stair AI World Cup Agent Arena


Model Performance

Trained on 49,016 international football matches from 1872 to 2026, filtered for competitive fixtures (World Cup, qualifiers, continental championships).

Model Metric Score
Home Goals (Poisson) MAE ~0.55
Away Goals (Poisson) MAE ~0.55
Match Outcome (Multiclass) Accuracy ~52%
Match Outcome (Multiclass) Log Loss ~1.00

Match outcome accuracy of ~52% beats the random baseline of 33% for a 3-class problem by a significant margin.


Project Structure

predictax9/
├── PredictaX9.py            ← Core prediction engine (single pick + audit trail)
├── data_fetcher.py          ← Gemini-based live stats fetcher (grounded search)
├── stratir_client.py        ← Stair AI Arena ledger + order submission client
├── run_pipeline.py          ← End-to-end orchestrator (fetch → predict → submit)
├── README.md                ← You are here
├── requirements.txt         ← Dependencies
└── supatx_models/           ← Trained model files (not included in repo)
    ├── feature_cols.pkl
    ├── model_home_goals.pkl
    ├── model_away_goals.pkl
    └── model_outcome.pkl

The supatx_models/ folder is not included in this repository. You must train the models yourself using the training pipeline. This protects the integrity of the trained weights.


Installation

git clone https://github.com/Supatx/predictaX9.git
cd predictax9
pip install -r requirements.txt

Usage

  1. Train the models (see training pipeline)
  2. Place the supatx_models/ folder in the project root
  3. Set your environment variables (see below)
  4. Edit run_pipeline.py with the fixture and stage you want to predict
  5. Run:
python run_pipeline.py

Required Input Data

Ten values drive each prediction. All available from FIFA.com, Sofascore, or FBref — or fetched automatically via data_fetcher.py:

Input Description Example
home_goals_scored_last5 Avg goals HOME scored in last 5 games 2.2
home_goals_conceded_last5 Avg goals HOME conceded in last 5 games 0.8
home_win_rate_last5 HOME win rate last 5 games (0.0–1.0) 0.8
away_goals_scored_last5 Avg goals AWAY scored in last 5 games 1.4
away_goals_conceded_last5 Avg goals AWAY conceded in last 5 games 1.2
away_win_rate_last5 AWAY win rate last 5 games (0.0–1.0) 0.6
h2h_avg_goals Avg total goals in last 5 H2H meetings 2.5
h2h_avg_btts Fraction of H2H where both teams scored 0.7
neutral_venue Neutral ground? World Cup = always 1 1
went_to_shootout Recent H2H decided on penalties? 0
is_knockout Is this a knockout-stage fixture? 1

Environment Variables

Store in a .env file — never commit to version control:

GEMINI_API_KEY=your_gemini_key_here
GEMINI_MODEL=models/gemini-2.5-flash
STAIR_AI_API_KEY=your_arena_key_here

FAQ

Does this predict Over/Under or BTTS markets? No. Those are computed internally for the audit trail but not exposed as tradeable picks. The engine outputs a single Home/Draw/Away market to match Polymarket and the Arena's required format.

Why does it sometimes output NO PICK? The reasoning submission is gated at 85% confidence. If no outcome clears that bar, the strict pick is NO PICK — a deliberate, honest signal. A best-available pick with a confidence caveat is always generated for markets that require an actual side.

Can I use this for other competitions? Yes. The engine is competition-agnostic. The knockout tagging and neutral-venue defaults are tuned for World Cup fixtures, but the core Poisson + multiclass architecture works for any international competition given the same 10 input stats.

Is this financial advice? No. This is a research and competition project. Order size and limit price are explicit, human-set parameters for exactly that reason.


Built For

This agent was built for and competed in the Stair AI World Cup Agent Arena — a live competition during the 2026 FIFA World Cup where AI agents placed real prediction-market bets and were scored on both profit and reasoning quality.


Author

Elijah Olalere@Supatx

Building AI agents that think clearly and predict intelligently. Nigeria 🇳🇬


License

MIT License — free to use, learn from, and build on.

About

⚽ AI-powered football prediction engine for the 2026 FIFA World Cup Poisson regression + multiclass outcome modeling. Built for the Stair AI Agent Arena.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages