Machine LearningActive

Quantitative Sports Prediction Engine

A production-grade machine learning system that ingests 9+ years of football data, engineers predictive features, and generates match outcome predictions across Europe's top 5 leagues.

Complete system walkthrough: data pipeline, ML architecture, and results

12,000+
Matches Modelled
80
Features per Match
0.198
Walk-Forward Brier Score
5
European Leagues

Overview

What started as a data pipeline evolved into a complete prediction system. The question shifted from "can historical football data reveal patterns?" to "can we actually beat the market?"

Answering that honestly required clean data, rigorous backtesting and true out-of-sample validation. The result: a well-calibrated model that sits within ≈0.009 Brier of the bookmaker's implied probabilities using public data alone. The remaining gap is information rather than method (the market prices in team news and lineups), which is why v2 added player-level data from SofaScore.

System Architecture

01

Data Ingestion

Pull match data from FBref, Understat, and Football-Data.co.uk, plus SofaScore lineups and player stats, with rate limiting and error handling.

02

Feature Engineering

80 features per match: 42 match-level (rolling form, head-to-head, xG, league position, rest days) and 38 player-level from SofaScore.

03

Ensemble Model

Calibrated ensemble of Logistic Regression, Random Forest and XGBoost, producing home/draw/away probabilities.

04

Walk-Forward Validation

Time-ordered walk-forward testing, scored with the Brier score and benchmarked against bookmaker implied probabilities.

05

Prediction Output

Weekend match picks plus a bet-builder CLI pricing 16 player-prop markets with Poisson and Bernoulli models.

Performance vs. the Market

Scored with the Brier score (mean squared error of the home/draw/away probabilities, lower is better) and benchmarked against the sharpest line in football.

BenchmarkBrier score
Uninformed⅓ on every outcome0.222
This modelWalk-forward, out-of-sample0.198
Bookmaker oddsPinnacle implied probabilities0.189

≈0.009 from the market on public data. Both scores are measured on this dataset, though not necessarily on identical matches. Next lever: lineup and team-news data.

Model Risk: The Leakage Audit

01

Flag

The first v2 backtest scored 0.134 on the 2025/26 season, 36% better overnight. Results that good get investigated, not celebrated.

02

Root cause

Two player features used post-match SofaScore ratings: information that isn't available before kick-off.

03

Fix

Features removed and the model retrained. The season score returned to 0.209, in line with the audited v1 baseline.

Live Record · February 2026

23/23high-confidence double-chance picks landed
+244%
Week 1 · 6-fold
+191%
Week 2 · 6-fold
+500%
Week 2 · 14-fold (cashed out)

Picks are 75%+ confidence double-chance selections (win or draw) from the ensemble. Small live sample at recreational stakes: a sanity check on calibration, not a claim of long-run edge.

Multi-League Coverage

Premier League
England
La Liga
Spain
Bundesliga
Germany
Serie A
Italy
Ligue 1
France

Data Sources

FB

FBref

Comprehensive match statistics, team performance data, and historical results.

US

Understat

Advanced metrics including expected goals (xG), shot maps, and match events.

FD

Football-Data

Historical odds from multiple bookmakers for backtesting betting strategies.

SS

SofaScore

Lineups and per-player match stats (via Apify), powering the v2 player features and prop models.

Walk-Forward Validation

True Out-of-Sample Testing

The most important thing I learned: backtesting without temporal discipline is worthless. Every result in this system comes from true out-of-sample testing. Train on data before 2023, test on 2023-2026, data the model never saw during training. And when a result looks too good, audit it: that discipline caught a post-match leak in v2 before it shipped.

Tech Stack

Python 3.12+
Core language
Pandas & NumPy
Data manipulation
scikit-learn
ML framework
XGBoost
Gradient boosting
PostgreSQL
Data storage (Supabase)
Apify
SofaScore player data
Next.js
Dashboard frontend
pytest
Test framework (TDD)
GitHub Actions
CI/CD

Key Achievements

  • Walk-forward validation protocol ensuring all results are truly out-of-sample
  • Calibrated to within ≈0.009 Brier of bookmaker implied probabilities on public data
  • Caught and fixed a post-match data leak in v2 before it reached live predictions
  • v2 player intelligence: SofaScore pipeline adding 38 player-level features
  • Bet-builder CLI pricing 16 player-prop markets with Poisson and Bernoulli models
  • Multi-league expansion from EPL-only to 5 leagues with 614 fixtures added in a single session
  • Incremental refresh system reducing API calls by 95%
  • Full test coverage with TDD methodology throughout