FelixCS3 ClementeH commited on
Commit
16ce2fe
·
0 Parent(s):

Duplicate from ClementeH/statsbomb-open-data-shots

Browse files

Co-authored-by: Clemente Henriquez <ClementeH@users.noreply.huggingface.co>

.gitattributes ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ *.7z filter=lfs diff=lfs merge=lfs -text
2
+ *.arrow filter=lfs diff=lfs merge=lfs -text
3
+ *.avro filter=lfs diff=lfs merge=lfs -text
4
+ *.bin filter=lfs diff=lfs merge=lfs -text
5
+ *.bz2 filter=lfs diff=lfs merge=lfs -text
6
+ *.ckpt filter=lfs diff=lfs merge=lfs -text
7
+ *.ftz filter=lfs diff=lfs merge=lfs -text
8
+ *.gz filter=lfs diff=lfs merge=lfs -text
9
+ *.h5 filter=lfs diff=lfs merge=lfs -text
10
+ *.joblib filter=lfs diff=lfs merge=lfs -text
11
+ *.lfs.* filter=lfs diff=lfs merge=lfs -text
12
+ *.lz4 filter=lfs diff=lfs merge=lfs -text
13
+ *.mds filter=lfs diff=lfs merge=lfs -text
14
+ *.mlmodel filter=lfs diff=lfs merge=lfs -text
15
+ *.model filter=lfs diff=lfs merge=lfs -text
16
+ *.msgpack filter=lfs diff=lfs merge=lfs -text
17
+ *.npy filter=lfs diff=lfs merge=lfs -text
18
+ *.npz filter=lfs diff=lfs merge=lfs -text
19
+ *.onnx filter=lfs diff=lfs merge=lfs -text
20
+ *.ot filter=lfs diff=lfs merge=lfs -text
21
+ *.parquet filter=lfs diff=lfs merge=lfs -text
22
+ *.pb filter=lfs diff=lfs merge=lfs -text
23
+ *.pickle filter=lfs diff=lfs merge=lfs -text
24
+ *.pkl filter=lfs diff=lfs merge=lfs -text
25
+ *.pt filter=lfs diff=lfs merge=lfs -text
26
+ *.pth filter=lfs diff=lfs merge=lfs -text
27
+ *.rar filter=lfs diff=lfs merge=lfs -text
28
+ *.safetensors filter=lfs diff=lfs merge=lfs -text
29
+ saved_model/**/* filter=lfs diff=lfs merge=lfs -text
30
+ *.tar.* filter=lfs diff=lfs merge=lfs -text
31
+ *.tar filter=lfs diff=lfs merge=lfs -text
32
+ *.tflite filter=lfs diff=lfs merge=lfs -text
33
+ *.tgz filter=lfs diff=lfs merge=lfs -text
34
+ *.wasm filter=lfs diff=lfs merge=lfs -text
35
+ *.xz filter=lfs diff=lfs merge=lfs -text
36
+ *.zip filter=lfs diff=lfs merge=lfs -text
37
+ *.zst filter=lfs diff=lfs merge=lfs -text
38
+ *tfevents* filter=lfs diff=lfs merge=lfs -text
39
+ # Audio files - uncompressed
40
+ *.pcm filter=lfs diff=lfs merge=lfs -text
41
+ *.sam filter=lfs diff=lfs merge=lfs -text
42
+ *.raw filter=lfs diff=lfs merge=lfs -text
43
+ # Audio files - compressed
44
+ *.aac filter=lfs diff=lfs merge=lfs -text
45
+ *.flac filter=lfs diff=lfs merge=lfs -text
46
+ *.mp3 filter=lfs diff=lfs merge=lfs -text
47
+ *.ogg filter=lfs diff=lfs merge=lfs -text
48
+ *.wav filter=lfs diff=lfs merge=lfs -text
49
+ # Image files - uncompressed
50
+ *.bmp filter=lfs diff=lfs merge=lfs -text
51
+ *.gif filter=lfs diff=lfs merge=lfs -text
52
+ *.png filter=lfs diff=lfs merge=lfs -text
53
+ *.tiff filter=lfs diff=lfs merge=lfs -text
54
+ # Image files - compressed
55
+ *.jpg filter=lfs diff=lfs merge=lfs -text
56
+ *.jpeg filter=lfs diff=lfs merge=lfs -text
57
+ *.webp filter=lfs diff=lfs merge=lfs -text
58
+ # Video files - compressed
59
+ *.mp4 filter=lfs diff=lfs merge=lfs -text
60
+ *.webm filter=lfs diff=lfs merge=lfs -text
README.md ADDED
@@ -0,0 +1,205 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ ---
2
+ license: cc-by-sa-4.0
3
+ task_categories:
4
+ - tabular-classification
5
+ - tabular-regression
6
+ language:
7
+ - en
8
+ tags:
9
+ - football
10
+ - soccer
11
+ - xG
12
+ - expected-goals
13
+ - sports-analytics
14
+ - statsbomb
15
+ - messi
16
+ - analytics
17
+ pretty_name: StatsBomb Open Data — Football Shots (xG)
18
+ size_categories:
19
+ - 10K<n<100K
20
+ dataset_info:
21
+ features:
22
+ - name: match_id
23
+ dtype: int64
24
+ - name: competition_name
25
+ dtype: string
26
+ - name: season_name
27
+ dtype: string
28
+ - name: match_date
29
+ dtype: string
30
+ - name: team
31
+ dtype: string
32
+ - name: player
33
+ dtype: string
34
+ - name: x
35
+ dtype: float64
36
+ - name: y
37
+ dtype: float64
38
+ - name: distance_to_goal
39
+ dtype: float64
40
+ - name: angle_to_goal
41
+ dtype: float64
42
+ - name: under_pressure
43
+ dtype: bool
44
+ - name: shot_outcome_name
45
+ dtype: string
46
+ - name: shot_body_part_name
47
+ dtype: string
48
+ - name: shot_technique_name
49
+ dtype: string
50
+ - name: shot_type_name
51
+ dtype: string
52
+ - name: play_pattern_name
53
+ dtype: string
54
+ - name: xg_statsbomb
55
+ dtype: float64
56
+ - name: is_goal
57
+ dtype: int64
58
+ splits:
59
+ - name: train
60
+ num_examples: 70418
61
+ - name: validation
62
+ num_examples: 8802
63
+ - name: test
64
+ num_examples: 8803
65
+ ---
66
+
67
+ # StatsBomb Open Data — Football Shots (xG)
68
+
69
+ **88,023 shot-level football records** extracted from [StatsBomb Open Data](https://github.com/statsbomb/open-data),
70
+ spanning **67 years of football** (1958–2025) across **21 competitions**, **48 seasons**, **308 teams**, and **6,147 players**.
71
+
72
+ Includes StatsBomb's own xG values as labels, making this the most complete open football shot dataset
73
+ available on HuggingFace for training Expected Goals models.
74
+
75
+ ## Highlights
76
+
77
+ - 🏆 **Lionel Messi** — 2,670 shots, the most of any player in the dataset (18 La Liga seasons at Barcelona)
78
+ - 🌍 **Historical depth** — FIFA World Cup data from 1958 to 2022
79
+ - ⚽ **Both genders** — FA Women's Super League, Women's World Cup, UEFA Women's Euro included
80
+ - 📊 **StatsBomb xG labels** — use as regression target or benchmark for your own model
81
+ - 🎯 **Benchmark** — A GradientBoosting model trained on this dataset achieves ROC-AUC 0.8047, reaching 98% of StatsBomb's professional xG model performance (ROC-AUC 0.8198) using only 9 features
82
+
83
+ ## Dataset Statistics
84
+
85
+ | Metric | Value |
86
+ |--------|-------|
87
+ | Total shots | 88,023 |
88
+ | Goals | 9,790 (11.1%) |
89
+ | Unique players | 6,147 |
90
+ | Unique teams | 308 |
91
+ | Competitions | 21 |
92
+ | Seasons | 48 |
93
+ | Date range | 1958-06-24 → 2025-07-27 |
94
+ | Mean xG per shot | 0.107 |
95
+
96
+ ## Coverage by Competition
97
+
98
+ | Competition | Shots | Goals | Players | Seasons |
99
+ |-------------|-------|-------|---------|---------|
100
+ | La Liga | 21,210 | 2,658 | 1,312 | 18 |
101
+ | Premier League | 10,837 | 1,082 | 641 | 2 |
102
+ | Ligue 1 | 10,346 | 1,105 | 739 | 3 |
103
+ | Serie A | 10,033 | 955 | 475 | 2 |
104
+ | 1. Bundesliga | 8,747 | 947 | 560 | 2 |
105
+ | FA Women's Super League | 8,321 | 962 | 330 | 3 |
106
+ | FIFA World Cup | 3,904 | 443 | 890 | 8 |
107
+ | Women's World Cup | 2,994 | 327 | 576 | 2 |
108
+ | UEFA Euro | 2,629 | 281 | 547 | 2 |
109
+ | Champions League | 594 | 74 | 193 | 18 |
110
+ | *+ 11 more competitions* | | | | |
111
+
112
+ ## Splits
113
+
114
+ | Split | Shots | Goals |
115
+ |-------|-------|-------|
116
+ | train | 70,418 | 7,825 (11.1%) |
117
+ | validation | 8,802 | 979 (11.1%) |
118
+ | test | 8,803 | 986 (11.2%) |
119
+
120
+ Stratified by `is_goal` to preserve goal rate across splits.
121
+
122
+ ## Features
123
+
124
+ | Column | Type | Description |
125
+ |--------|------|-------------|
126
+ | `x` | float | Shot x-coordinate (StatsBomb pitch: 0–120, attacking direction) |
127
+ | `y` | float | Shot y-coordinate (StatsBomb pitch: 0–80) |
128
+ | `distance_to_goal` | float | Euclidean distance to goal center (120, 40) |
129
+ | `angle_to_goal` | float | Angle to goal in degrees |
130
+ | `under_pressure` | bool | Shooter was under defensive pressure |
131
+ | `shot_body_part_name` | string | `Right Foot` / `Left Foot` / `Head` / `Other` |
132
+ | `shot_technique_name` | string | `Normal` / `Volley` / `Half Volley` / `Lob` / `Overhead Kick` / `Backheel` |
133
+ | `shot_type_name` | string | `Open Play` / `Free Kick` / `Corner` / `Penalty` |
134
+ | `play_pattern_name` | string | `Regular Play` / `From Corner` / `From Free Kick` / etc. |
135
+ | `shot_outcome_name` | string | `Goal` / `Saved` / `Blocked` / `Off T` / `Wayward` / `Post` |
136
+ | `xg_statsbomb` | float | StatsBomb's official xG value — use as regression label or benchmark |
137
+ | `is_goal` | int | 1 if goal, 0 otherwise — binary classification label |
138
+ | `player` | string | Player full name |
139
+ | `team` | string | Team name |
140
+ | `competition_name` | string | Competition name |
141
+ | `season_name` | string | Season (e.g. `2019/2020`) |
142
+ | `match_date` | string | Match date (YYYY-MM-DD) |
143
+ | `match_id` | int | StatsBomb match identifier |
144
+
145
+ ## Pitch Coordinates
146
+
147
+ StatsBomb uses a 120×80 coordinate system:
148
+ - `x=0` is the defensive goal line, `x=120` is the attacking goal line
149
+ - `y=0` is the left touchline, `y=80` is the right touchline
150
+ - Goal center is at `(120, 40)`
151
+
152
+ ## Quick Start
153
+
154
+ ```python
155
+ from datasets import load_dataset
156
+
157
+ ds = load_dataset("ClementeH/statsbomb-open-data-shots")
158
+ df = ds["train"].to_pandas()
159
+
160
+ # All Messi shots
161
+ messi = df[df["player"] == "Lionel Andrés Messi Cuccittini"]
162
+ print(f"Messi: {len(messi)} shots, {messi['is_goal'].sum()} goals, mean xG {messi['xg_statsbomb'].mean():.3f}")
163
+
164
+ # Train a simple xG model
165
+ from sklearn.ensemble import GradientBoostingClassifier
166
+ from sklearn.preprocessing import LabelEncoder
167
+
168
+ features = ["x", "y", "distance_to_goal", "angle_to_goal", "under_pressure"]
169
+ X = df[features].astype(float)
170
+ y = df["is_goal"]
171
+
172
+ model = GradientBoostingClassifier(n_estimators=200, max_depth=4)
173
+ model.fit(X, y)
174
+ ```
175
+
176
+ ## Benchmark: xG Model Performance
177
+
178
+ A GradientBoosting model trained on this dataset (9 features) vs StatsBomb's professional xG:
179
+
180
+ | Model | Brier Score ↓ | ROC-AUC ↑ |
181
+ |-------|-------------|----------|
182
+ | Logistic Regression (baseline) | 0.0858 | 0.7706 |
183
+ | GradientBoosting (this dataset) | 0.0803 | **0.8047** |
184
+ | StatsBomb xG (professional) | 0.0770 | 0.8198 |
185
+
186
+ The open model reaches **98% of professional xG performance** using only position, body part, technique, shot type, and pressure.
187
+
188
+ See [`ClementeH/football-xg`](https://huggingface.co/ClementeH/football-xg) for the trained model *(coming soon)*.
189
+
190
+ ## Attribution
191
+
192
+ > **Data provided by StatsBomb via [StatsBomb Open Data](https://github.com/statsbomb/open-data).**
193
+ > Licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).
194
+ >
195
+ > You are free to share and adapt this data for any purpose, provided you give appropriate credit
196
+ > to StatsBomb and distribute your contributions under the same license.
197
+ >
198
+ > This dataset was processed and packaged for HuggingFace by [ClementeH](https://huggingface.co/ClementeH).
199
+
200
+ ## Related Resources
201
+
202
+ - [statsbomb/open-data](https://github.com/statsbomb/open-data) — original raw JSON data
203
+ - [statsbombpy](https://github.com/statsbomb/statsbombpy) — official Python library
204
+ - [`ClementeH/football-xg`](https://huggingface.co/ClementeH/football-xg) — xG model trained on this dataset *(coming soon)*
205
+ - [`ClementeH/football-xg-analyzer`](https://huggingface.co/spaces/ClementeH/football-xg-analyzer) — interactive Space *(coming soon)*
data/test-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:23cc083a1ec3d4fd2ab1040c40d7d69c3ae3fd4a062d3ec547bad09d78827e26
3
+ size 413229
data/train-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2856fe7c37519f9d30d5db00d85c144ab81ca69f419240d5d3d9df7174d02355
3
+ size 2452405
data/validation-00000-of-00001.parquet ADDED
@@ -0,0 +1,3 @@
 
 
 
 
1
+ version https://git-lfs.github.com/spec/v1
2
+ oid sha256:2f635b7d28405034ca1a0f924e357a6527c5adde8e8a732455afec2e0d076bbf
3
+ size 413276