Skip to content
kymanirjarrettPublic

About

Premier League match forecasts for iOS.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

6 Commits

Folders and files

Repository files navigation

Subspot

Premier League match forecasts that grade themselves against the market.

Subspot is an iOS app that forecasts every Premier League match. A machine learning model estimates each side's scoring rate, a multithreaded C++ engine simulates the match thousands of times, and the app shows full probability distributions: win/draw/loss, scorelines, and season outcomes. Every forecast is scored against the bookmaker closing line, the sharpest public estimate there is, and the results are published in-app.

Engine ML iOS

🚧 Status: early development. The C++ simulation engine and the Poisson baseline are working and tested; the PyTorch model and the iOS app are next. See the roadmap.

How it works

flowchart LR
    A[football-data.co.uk<br/>Understat] -->|Lambda, weekly| B[(S3 raw)]
    B --> C[Glue + Athena<br/>point-in-time features]
    C --> D[PyTorch model<br/>expected goals per side]
    D --> E[C++ Monte Carlo engine]
    E --> F[Backtests vs<br/>Pinnacle closing odds]
    D -->|coremltools| G[iOS app<br/>Core ML]
    E -->|Swift C++ interop| G
Loading

One C++ engine runs in two places: in Python through pybind11 for backtesting, and inside the iOS app for instant on-device "what if" simulation. The numbers you see in the app come from the same code that was evaluated.

Repository layout

Path What lives there Stack
engine/ Match and season simulation engine, tests and benchmarks C++20, CMake, GoogleTest, Google Benchmark, pybind11
ml/ Data loading, team canonicalization, models, evaluation Python, pandas, SciPy, PyTorch (soon)
ios/ SubspotKit domain package, then the SwiftUI app Swift, SwiftUI, Core ML
infra/ AWS resources as code CloudFormation
docs/ Architecture and design decisions

Getting started

# C++ engine
cmake -S engine -B engine/build -DCMAKE_BUILD_TYPE=Release
cmake --build engine/build -j
ctest --test-dir engine/build --output-on-failure

# Python
python -m venv .venv && source .venv/bin/activate
pip install -e "ml[dev]"
pytest ml

# Swift (macOS)
cd ios/SubspotKit && swift test

# Git hooks (formatting, linting, secret detection)
pip install pre-commit && pre-commit install

Engine benchmarks

Seasons simulated per second for a full 20-team, 380-fixture Premier League season, from engine/bench/bench_season.cpp. Each call simulates 10,000 seasons; the figures are the median of three repetitions, timed on the wall clock.

Threads Time per 10,000 seasons Seasons per second
1 158 ms 63,400
2 81 ms 122,800
4 43 ms 233,500
8 31 ms 327,600

Machine: Apple M4 (4 performance and 6 efficiency cores), Apple clang 21, Release build. Scaling is close to linear up to 4 threads. Past that, the extra threads land on the slower efficiency cores, so 8 threads gives about 1.4x the throughput of 4 rather than 2x.

cmake -S engine -B engine/build-bench -DCMAKE_BUILD_TYPE=Release \
  -DSUBSPOT_BUILD_TESTS=OFF -DSUBSPOT_BUILD_BENCHMARKS=ON
cmake --build engine/build-bench -j
engine/build-bench/subspot_bench --benchmark_repetitions=3 --benchmark_report_aggregates_only=true

Roadmap

  • C++ Monte Carlo engine, tested against closed-form Poisson
  • Team name canonicalization across data sources
  • Poisson attack/defence baseline with log loss and Brier score
  • Phase 1: Dixon-Coles baseline and walk-forward backtest vs Pinnacle closing odds
  • Phase 2: Game-state effects in the engine (trailing teams push, leading teams sit deeper)
  • Phase 3: PyTorch model with learned team embeddings that beats the baseline
  • Phase 4: iOS app with Core ML, on-device simulation, season simulator, TestFlight
  • AWS pipeline: Lambda ingestion, Glue/Athena features, Step Functions weekly retrain

Data

Disclaimer

Subspot is a forecasting and analytics project. It does not offer betting advice or facilitate wagering.

License

MIT

About

Premier League match forecasts for iOS.

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages