Skip to content
varun.rout

Jump to

Search pages, projects and repos

← Back to work

Football · live repo

Live repoOpen data (StatsBomb)

Contextual Football Metrics

CxG / CxA / CxT training pipeline

View the repo →

What this is

A single Prefect flow under one MLflow parent run, with a model ladder from baseline through GLM to boosting and neural, and a from-scratch graph-attention encoder in plain PyTorch.

Metrics

Contextual GLM

0.8131 AUC · Brier 0.06669

vs logistic 0.7982

Validation

5-fold CV 0.8083

Honesty

Season-level CxA ranks assist-makers weakly: Spearman 0.39 vs CxG 0.69 for goals

Testing

560 tests · CI with an enforced coverage floor

Stack

PrefectMLflowPyTorchGitHub Actions CI560 tests

What I would not claim

  • catboost
  • captum
  • plotly
  • kaleido
  • pydantic
  • imbalanced-learn
  • DVC-tracked pipeline
  • cloud/GPU training

Does the context earn its place?

Each metric against the baseline it has to beat, over identical held-out rows with a paired bootstrap. One of the three does not beat its benchmark, and the verdict says so in the repo’s own words.

Does not beat its benchmarkContextual expected goals · benchmark: statsbomb xG

NO DEMONSTRABLE LIFT over statsbomb_xg: neither log-loss nor AUC improvement has a CI excluding zero. Honest conclusion - contextual context does not yet beat off-the-shelf xG.

1,340 held-out shots · 126 goals · 2,000-sample paired bootstrap

ModelLog lossBrierROC AUCECEMean prediction
statsbomb xGbenchmark0.23330.06450.82950.01260.1042
baseline logit0.25050.06940.79850.02100.1070
GLM contextualthis model0.24130.06670.81310.01710.1049

Change vs baseline, with 95% bootstrap interval

The dashed cyan line is zero. An interval that straddles it does not support a claim, however good the point estimate looks.

Log loss vs statsbomb xG

CI crosses zero

Δ 0.0080 [-0.0039, 0.0197]lower is better

ROC AUC vs statsbomb xG

CI crosses zero

Δ -0.0164 [-0.0431, 0.0094]higher is better

Log loss vs baseline logit

CI excludes zero

Δ -0.0093 [-0.0172, -0.0018]lower is better

ROC AUC vs baseline logit

CI crosses zero

Δ 0.0149 [-0.0030, 0.0329]higher is better

External validity

player-level, pooled over all ingested matches; metrics scored by the production model, goals/assists from raw events

CxG vs actual goals

0.689 Spearman

n = 300 players

CxG ranks players by goals reliably (Spearman 0.69): usable to shortlist goals on expected rather than realised output.

CxA vs actual assists

0.388 Spearman

n = 1,113 players

CxA does not rank assists well (Spearman 0.39): treat as weak external validity; do not scout on it alone.

Open StatsBomb data. Verdict and decision strings are quoted verbatim from the committed reports, including where the conclusion is negative.

Data provenance. Committed reports from contextual-football-metrics (incremental_lift_cx{g,a,t}.json, external_validity.json), generated into data/contextual-lift.json. Open StatsBomb data.