Skip to content

SupaTx/PredictaX-9

Repository files navigation

PredictaX9 — AI World Cup 2026 Prediction Engine & Stratir Arena Trading Agent ⚽🔮

PredictaX9 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 single, audited Home / Draw / Away prediction market pick — then automatically submits that reasoning and places a live order on Polymarket through the Stratir AI World Cup Agent Arena.

If you're searching for a World Cup 2026 AI prediction model, a football match outcome predictor in Python, an explainable sports prediction engine, or a Polymarket prediction market trading bot, this repo is a working, end-to-end reference implementation of all four.

Python LightGBM License Status Stratir


Table of Contents


What Is This?

PredictaX9 is an AI-powered football prediction engine purpose-built for the 2026 FIFA World Cup knockout stage. It predicts match outcomes with mathematically consistent probabilities, then converts that prediction into a single actionable Home Win / Draw / Away Win pick — the format required by prediction markets like Polymarket.

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.


Key Features

  • 🎯 Single-market output — one clean Home/Draw/Away pick per match, not a scattershot of markets
  • 🔍 Full reasoning transparency — every intermediate calculation (raw stats in, model vector, Poisson lambdas, softmax probabilities, final decision) is captured in an inspectable audit trail
  • 📊 85% confidence gate — a strict threshold for the reasoning submission, so the agent only "acts" when it's genuinely confident, with an always-populated best-available pick (plus caveat) for markets that require a side regardless
  • 🏆 Knockout-stage aware — tags fixtures as Final / Third Place Playoff / Semifinal etc., since knockout dynamics differ from group-stage form
  • 🔌 Live data sourcing — pulls real recent-form and head-to-head stats via Gemini (grounded search) or a sports-data API, not hallucinated numbers
  • 🤖 Direct Stratir Arena integration — submits reasoning to the Ledger API and places live limit orders on Polymarket through Stratir's Orders API
  • 🧮 Mathematically consistent probabilities — Home Win + Draw + Away Win always sums to exactly 100%, no contradictions between markets

How It Works

Most football prediction models train separate classifiers per market independently, which causes probabilities to contradict each other (e.g. summing to over 100%). PredictaX9 avoids this with a two-model architecture feeding into one gated decision layer:

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

Why a Single Pick, Not Over/Under

Earlier iterations of this engine (and most public football-prediction projects) output a full spread of markets — Over/Under 2.5, BTTS, clean sheets, double chance, etc. PredictaX9 deliberately strips that down to a single Home/Draw/Away call, because that's the exact market shape Polymarket and the Stratir Arena's reasoning submission require. BTTS and clean-sheet numbers are still computed internally and kept in the audit trail for context — they're just not exposed as a tradeable pick.


Full Audit Trail — Explainable AI, Not a Black Box

Every prediction returns a step-by-step trail so the reasoning behind a pick is fully inspectable, not just the final number:

  1. Raw input stats as fetched (Gemini grounded search or sports API)
  2. Validated, schema-checked engine input
  3. The exact feature vector fed into the models
  4. Raw Poisson lambdas (expected goals)
  5. Raw softmax outcome probabilities
  6. Internal diagnostics (BTTS, clean sheets — not traded)
  7. Final decision logic: strict pick (85% gated) + best-available pick (always populated, with a confidence caveat)

This is what makes the agent's bets defensible in a competition scored on reasoning quality, not just profit.


Sample Output

============================================================
  ⚽ SUPATX: France vs England  |  Stage: Third Place Playoff
============================================================

📥 STEP 1 — Gemini raw input
   {'home_goals_scored_last5': 2.0, 'home_goals_conceded_last5': 0.6, ...}

🧮 STEP 2 — Validated engine input
   {'HomeGoalsScoredLast5': 2.0, ..., 'IsKnockout': 1}

🎯 STEP 3 — Vector actually fed to the models
   {'HomeGoalsScoredLast5': 2.0, ...}

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

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

📊 STEP 6 — Internal diagnostics (not a tradeable market)
   BTTS: 53.0%  |  Home CS: 32.3%  |  Away CS: 21.7%

⭐ STRICT PICK — for reasoning/Stratir submission  (threshold ≥85.0%)
   🚫 NO PICK — top candidate (HomeWin: 46.6%) fell short of 85.0%

🎯 BEST-AVAILABLE PICK — for Polymarket submission (always populated)
   → HomeWin  →  46.6%  █████████
   ⚠️  Low-confidence pick — 46.6% is below the 85.0% bar used for the
      reasoning submission. Treat as low-conviction.
============================================================

Live Data Sourcing

Match stats (recent form, head-to-head history) are pulled live rather than hardcoded or hallucinated:

  • Gemini (grounded) — a single call combining Google Search grounding with structured JSON output (Gemini 3-series models via the Interactions API), so figures are backed by real search results
  • Sports-data API fallback — swappable to a dedicated football stats API (e.g. API-Football) for deterministic, non-LLM data when preferred
  • Manual override — a MANUAL_RESULT_JSON slot to paste a verified AI Studio output directly, skipping the live call entirely when testing or working around rate limits

Stratir Arena Integration (Reasoning + Polymarket Orders)

PredictaX9 submits directly to the Stair AI World Cup Agent Arena:

  • POST /v1/arena/ledger/records — submits the prediction reasoning (outcome, probability, notes) to the Arena's Reasoning Ledger
  • POST /v1/arena/orders — places a live limit order buying YES on the chosen outcome against Polymarket, with configurable USD size, limit price, and time-in-force

Order sizing and limit price are deliberately not auto-decided from model confidence alone — they're explicit, human-set values, since they're real financial risk parameters.


Model Performance

Trained on 49,000+ 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% significantly beats the random baseline of 33% for a 3-class Home/Draw/Away problem.


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       ← Stratir 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)
    ├── feature_cols.pkl
    ├── model_home_goals.pkl
    ├── model_away_goals.pkl
    └── model_outcome.pkl

Note: 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

# Clone the repo
git clone https://github.com/Supatx/predictaX9.git
cd predictax9

# Install dependencies
pip install -r requirements.txt

Usage

  1. Train the models using the 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 run
  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 Knockout-stage fixture flag 1

Environment Variables

Set these in a .env file (never commit this file or its values):

GEMINI_API_KEY=...
GEMINI_MODEL=models/gemini-3-flash-preview
STRATIR_API_KEY=...

FAQ

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

Why does it sometimes output "NO PICK"? The reasoning submission is gated at an 85% confidence threshold. If no outcome clears that bar, the strict pick is NO PICK — a deliberate, honest signal rather than forcing a low-conviction bet. A separate "best-available pick" with a confidence caveat is still generated for markets (like Polymarket) that require an actual side regardless.

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

Is this financial advice? No. This is a research/competition project. Prediction markets involve real financial risk — order size and limit price are left as explicit, human-set parameters for exactly that reason.


Built For

This agent is entered into the Stair AI World Cup Agent Arena — a live competition during the 2026 FIFA World Cup where AI agents make real prediction-market bets and are scored on both profit and reasoning quality.


Author

Elijah Olalere@SupaTX

Building AI agents that think clearly and predict intelligently.


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

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages