Skip to content
varun.rout

Jump to

Search pages, projects and repos

← Back to work

Football analytics · flagship

Live repoOpen data (StatsBomb)

Opponent-Adjusted Football Metrics

Independent research · 8 months of active development

View the repo →

What this is

Contextual expected goals (CxG) and assists (CxA) over 2,143,146 raw StatsBomb events, benchmarked directly against StatsBomb's own xG on the same shots rather than self-reported in isolation.

Metrics

CxG model

0.80920 AUC

vs StatsBomb xG 0.81957

CxG calibration

Brier 0.07325 · log loss 0.26110

CxA baseline

0.85814 AUC · Brier 0.04046

over 1,091,388 rows

Testing

332 tests across 46 files

Stack

scikit-learnFastAPIPostgreSQLSQLAlchemyAlembicCI: lint+type+test

Provenance

Computed outputs are gitignored; the numbers above live in committed docs, not rendered dashboards.

What I would not claim

  • LightGBM as headline tech
  • gradient boosting as headline tech
  • plotly

Explore the shots

A sample of real shots, my CxG beside StatsBomb's own xG on the same shots. Toggle the metric or the diff, filter by team, match or pressure, and watch the calibration recompute.

Larger, brighter dot = higher CxG White ring = goal

440 shots

59 goals in this selection

Mean CxG0.1420
Mean StatsBomb xG0.1538

Brier score on this selection (lower is better calibrated)

CxG0.0776
StatsBomb xG0.0792

Actual goal rate 0.134. Both are shot-quality estimates; the point is that CxG sits next to StatsBomb's own number on the same shots, not in isolation.

Data provenance. 440-shot sample from the CxG diagnostic model, benchmarked against StatsBomb xG. Open StatsBomb data, served from Supabase; full set in the repo.

Explore contextual expected assists

The CxA diagnostic model against its own baseline over 1,091,388 action rows. Precision among the model's most confident actions is the headline; the leaderboard shows volume against efficiency.

Diagnostic v1 against its own baseline

Over 1,091,388 action rows. There is no off-the-shelf expected-assists model to compare against, so this is an internal baseline, not an industry incumbent.

provisionally promoted
Diagnostic v10.5860
Own baseline0.4627

+0.1233 better than the baseline. Higher is better for this metric.

The headline. Among the actions the model is most confident about, the share that actually created a shot rose from 0.463 to 0.58612.3 percentage points.

scikit-learn GradientBoostingClassifier, sigmoid-calibrated · 37 selected features · promotion gate passed

Volume and efficiency tell different stories: sort by total and by mean to see it. Özil leads on total CxA, but Sánchez creates more per action, and Fàbregas has the most actions of the leaders with the lowest mean.

Mesut Özil

Arsenal

#1

416.09

Total CxA

Total 416.09Mean 0.08914,672 actions417 shot-creating

Alexis Alejandro Sánchez Sánchez

Arsenal

#2

351.93

Total CxA

Total 351.93Mean 0.10703,288 actions324 shot-creating

Willian Borges da Silva

Chelsea

#3

325.34

Total CxA

Total 325.34Mean 0.09763,333 actions277 shot-creating

Francesc Fàbregas i Soler

Chelsea

#4

324.86

Total CxA

Total 324.86Mean 0.06315,150 actions283 shot-creating

Ross Barkley

Everton

#5

316.04

Total CxA

Total 316.04Mean 0.08053,924 actions322 shot-creating

Christian Dannemann Eriksen

Tottenham Hotspur

#6

311.67

Total CxA

Total 311.67Mean 0.08423,703 actions402 shot-creating

Dimitri Payet

West Ham United

#7

311.06

Total CxA

Total 311.06Mean 0.10133,071 actions364 shot-creating

Eden Hazard

Chelsea

#8

296.40

Total CxA

Total 296.40Mean 0.09703,055 actions262 shot-creating

Riyad Mahrez

Leicester City

#9

273.62

Total CxA

Total 273.62Mean 0.10232,674 actions341 shot-creating

Juan Manuel Mata García

Manchester United

#10

268.31

Total CxA

Total 268.31Mean 0.07413,621 actions199 shot-creating

Aaron Ramsey

Arsenal

#11

266.26

Total CxA

Total 266.26Mean 0.06304,223 actions233 shot-creating

Anthony Martial

Manchester United

#12

258.48

Total CxA

Total 258.48Mean 0.11402,267 actions220 shot-creating
Players by diagnostic CxA
RankNameTotal CxAMean CxAActionsShot-creating
1Mesut Özil416.090.08914,672417
2Alexis Alejandro Sánchez Sánchez351.930.10703,288324
3Willian Borges da Silva325.340.09763,333277
4Francesc Fàbregas i Soler324.860.06315,150283
5Ross Barkley316.040.08053,924322
6Christian Dannemann Eriksen311.670.08423,703402
7Dimitri Payet311.060.10133,071364
8Eden Hazard296.400.09703,055262
9Riyad Mahrez273.620.10232,674341
10Juan Manuel Mata García268.310.07413,621199
11Aaron Ramsey266.260.06304,223233
12Anthony Martial258.480.11402,267220
13Sergio Leonel Agüero del Castillo257.140.14281,801215
14Kevin De Bruyne256.320.10282,494283
15David Josué Jiménez Silva255.460.09002,839231
16Dušan Tadić251.420.11682,153286
17Romelu Lukaku Menama249.280.11092,247226
18Philippe Coutinho Correia247.980.10752,306288
19Sadio Mané245.730.10252,397251
20Jesús Navas González243.400.08572,840217
21Harry Kane234.900.11052,125312
22Gylfi Þór Sigurðsson231.150.09492,436279
23Raheem Sterling226.480.11272,010194
24Erik Lamela221.960.10022,215231
25Marko Arnautović218.770.08762,497221
26Matt Ritchie214.770.06993,072226
27Bamidele Alli211.710.09112,325227
28Gnégnéri Yaya Touré209.480.06023,477222
29James Philip Milner209.120.07452,808238
30Odion Jude Ighalo208.700.12991,606232
31Moussa Sissoko208.130.06623,142278
32Jason Puncheon207.570.07642,717202
33Kylian Mbappé Lottin206.520.12261,684214
34Diego da Silva Costa203.750.11251,811157
35Nathan Redmond203.690.09152,226227
36Robert Brady199.070.07072,816196
37Troy Deeney196.490.09032,176225
38Wayne Mark Rooney194.750.08392,322188
39Pedro Eliezer Rodríguez Ledesma192.790.08552,254209
40Marc Albrighton191.340.08182,338246
41Wes Hoolahan190.040.08042,364181
42Steven Davis188.190.06662,827190
43Jamie Vardy184.490.13551,362221
44Wilfried Zaha182.910.09551,916185
45Oscar dos Santos Emboaba Júnior179.040.08312,155169
46Roberto Firmino Barbosa de Oliveira177.240.08682,043209
47Héctor Bellerín Moruno175.060.04673,747142
48Adam David Lallana173.320.08711,990216
49Memphis Depay167.530.10481,599119
50Charlie Daniels162.560.04203,871178
51Ignacio Monreal Eraso162.550.04353,738136
52Jordan Ayew162.550.08241,972136
53Santiago Cazorla González161.960.06652,435167
54Manuel Lanzini161.710.06952,327202
55Georginio Wijnaldum161.440.06262,578202
56Aleksandar Kolarov159.260.05243,041128
57Nathaniel Edwin Clyne158.760.04793,316177
58Xherdan Shaqiri157.440.08891,771186
59Alberto Moreno Pérez154.560.05452,835192
60Gerard Deulofeu Lázaro153.700.10311,491161
61Idrissa Gana Gueye152.020.04183,635145
62Danny Drinkwater151.710.04303,527177
63Luka Modrić150.760.05132,941149
64Lionel Andrés Messi Cuccittini150.590.11771,279149
65Fernando Luiz Roza149.550.04313,472151
66Kevin De Bruyne147.730.08641,710193
67Graziano Pellè145.180.09501,528133
68André Ayew Pelé144.540.06492,228134
69Yannick Bolasie Yala143.800.09421,527172
70Jonathan Howson143.030.05902,426161
71Junior Stanislas142.710.09321,532145
72Darren Fletcher142.600.05092,801116
73Antoine Griezmann141.900.08491,672148
74Daryl Janmaat140.930.04952,845167
75Ashley Westwood140.330.04872,880121
76Emre Can139.970.04543,084181
77Yohan Cabaye139.580.05702,448166
78Jermain Defoe139.430.13831,008154
79Yann Gérard M'Vila138.910.04393,167210
80Olivier Giroud138.080.09641,433129
81José Manuel Jurado Marín137.540.07051,950146
82Aaron Cresswell136.190.04263,200184
83Mark Noble134.450.03893,460189
84Bojan Krkíc Pérez133.810.08051,663149
85Ayoze Pérez Gutiérrez132.480.08581,544149
86Patrick van Aanholt131.730.05362,458150
87Ryan Bertrand131.610.05062,601112
88César Azpilicueta Tanco131.220.03723,52599
89Séamus Coleman130.350.04982,619106
90Joshua King129.740.11181,160137
91Andrew Surman128.960.03323,879149
92Joshua Kimmich128.460.05902,177147
93Simon Francis128.330.03134,098134
94Toni Kroos128.170.05592,292129
95James McClean128.130.08271,550123
96Dan Gosling127.830.05532,312131
97Mousa Sidi Yaya Dembélé127.700.04572,796154
98N'Golo Kanté127.370.04742,688138
99Daniel Olmo Carvajal126.870.10211,243110
100Stéphane Sessègnon125.990.08731,444148

What drives the model

end_x0.0896
end_y0.0050
end_zone0.0045
is_through_ball0.0033
start_x0.0031
is_pass0.0031
length0.0017
x_progression0.0014
pass_height0.0010
seconds_since_possession_start0.0010

Progression and location dominate, led by end_x. That is an honest description of what the model leans on, not a claim of subtle contextual insight.

Data provenance. Generated into data/cxa.json from the committed CxA portfolio export (headline metrics, top players and teams, feature drivers). Open StatsBomb data. The comparison is against this project's own baseline, not an industry expected-assists incumbent, and the model is provisionally promoted.