Skip to content

feat(ml): dixon-coles model and walk-forward backtest vs closing odds - #15

Merged
kymanirjarrett merged 5 commits into
mainfrom
feat/1-dixon-coles-backtest
Dec 1, 2026
Merged

kymanirjarrett merged 5 commits into
mainfrom
feat/1-dixon-coles-backtest

Conversation

@kymanirjarrett

Copy link
Copy Markdown
Owner

What

Phase 1 (milestone M2):

  • Dixon-Coles model (models/dixon_coles.py): the Poisson attack/defence model plus the low-score correction (rho, fitted by maximum likelihood with the ratings) and exponential time decay.
  • Walk-forward backtest (python -m subspot_ml.backtest): before each Tuesday-to-Monday matchweek, every model is refitted on the previous two years of matches played strictly before that week. Scores the Poisson baseline, Dixon-Coles, and de-margined Pinnacle closing odds by log loss and Brier score, per season and overall, plus a calibration table. The command downloads the CSVs into the gitignored ml/data/raw/ and rewrites the marked block in the README.
  • Data fixes: aliases for Norwich, Watford and West Brom (needed for 2019-22), and the canonical football-data.co.uk host (the www. host now redirects).

Closes #1
Closes #2

Why

The Phase 1 roadmap item: a stronger classical baseline, and an honest, leak-free comparison against the sharpest public forecast. Later models (the PyTorch model in Phase 3) have to beat these numbers.

Design choices

  • Decay rate xi is chosen out of sample, not by likelihood. A larger xi always fits recent matches better in-sample, so following Dixon and Coles it is picked by walk-forward log loss on 2020-21 only (grid 0 to 0.005 per day; 0.003 won). 2019-20 is training history only. The reported seasons, 2021-22 onward, never influence xi.
  • Same matches for every forecast. A match is scored only if it has Pinnacle closing odds and both teams appear in the training window. 178 test matches are left out: 170 because football-data has no Pinnacle closing odds after 2026-01-08, the rest a promoted side's first game.

Results

Season Matches LL Poisson LL Dixon-Coles LL Closing odds
2021-22 379 0.9664 0.9671 0.9355
2022-23 378 1.0299 1.0126 0.9622
2023-24 378 0.9346 0.9352 0.9015
2024-25 379 0.9911 0.9792 0.9681
2025-26 208 1.0532 1.0505 0.9865
All 1722 0.9893 0.9828 0.9472

Dixon-Coles beats Poisson overall but loses narrowly in 2021-22 and 2023-24. The closing odds beat both models in every season. Brier scores and calibration are in the README.

How it was tested

  • Unit tests added or updated (30 pass)
    • Correction changes only the 0-0, 1-0, 0-1 and 1-1 probabilities (everything else is the Poisson grid times one renormalizing constant)
    • Fit recovers known ratings, home advantage and rho from data sampled from a Dixon-Coles model
    • Time decay rates recent form above old form
    • No fit ever sees a match on or after the date it predicts; unseen teams drop out of scoring
  • ruff check and ruff format --check clean
  • Backtest run locally (26 s)
  • CI passes (ml)
  • For model changes: log loss and Brier score vs the previous model are in the description

@kymanirjarrett
kymanirjarrett merged commit e182d6e into main Dec 1, 2026
1 check passed
@kymanirjarrett
kymanirjarrett deleted the feat/1-dixon-coles-backtest branch December 1, 2026 10:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Walk-forward backtest against Pinnacle closing odds Dixon-Coles baseline with time-decay weighting

1 participant