FelixCS3's picture
Duplicate from ClementeH/statsbomb-open-data-shots
16ce2fe
|
Raw
History Blame Contribute Delete
7.15 kB
---
license: cc-by-sa-4.0
task_categories:
- tabular-classification
- tabular-regression
language:
- en
tags:
- football
- soccer
- xG
- expected-goals
- sports-analytics
- statsbomb
- messi
- analytics
pretty_name: StatsBomb Open Data Football Shots (xG)
size_categories:
- 10K<n<100K
dataset_info:
features:
- name: match_id
dtype: int64
- name: competition_name
dtype: string
- name: season_name
dtype: string
- name: match_date
dtype: string
- name: team
dtype: string
- name: player
dtype: string
- name: x
dtype: float64
- name: y
dtype: float64
- name: distance_to_goal
dtype: float64
- name: angle_to_goal
dtype: float64
- name: under_pressure
dtype: bool
- name: shot_outcome_name
dtype: string
- name: shot_body_part_name
dtype: string
- name: shot_technique_name
dtype: string
- name: shot_type_name
dtype: string
- name: play_pattern_name
dtype: string
- name: xg_statsbomb
dtype: float64
- name: is_goal
dtype: int64
splits:
- name: train
num_examples: 70418
- name: validation
num_examples: 8802
- name: test
num_examples: 8803
---
# StatsBomb Open Data — Football Shots (xG)
**88,023 shot-level football records** extracted from [StatsBomb Open Data](https://github.com/statsbomb/open-data),
spanning **67 years of football** (1958–2025) across **21 competitions**, **48 seasons**, **308 teams**, and **6,147 players**.
Includes StatsBomb's own xG values as labels, making this the most complete open football shot dataset
available on HuggingFace for training Expected Goals models.
## Highlights
- 🏆 **Lionel Messi** — 2,670 shots, the most of any player in the dataset (18 La Liga seasons at Barcelona)
- 🌍 **Historical depth** — FIFA World Cup data from 1958 to 2022
-**Both genders** — FA Women's Super League, Women's World Cup, UEFA Women's Euro included
- 📊 **StatsBomb xG labels** — use as regression target or benchmark for your own model
- 🎯 **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
## Dataset Statistics
| Metric | Value |
|--------|-------|
| Total shots | 88,023 |
| Goals | 9,790 (11.1%) |
| Unique players | 6,147 |
| Unique teams | 308 |
| Competitions | 21 |
| Seasons | 48 |
| Date range | 1958-06-24 → 2025-07-27 |
| Mean xG per shot | 0.107 |
## Coverage by Competition
| Competition | Shots | Goals | Players | Seasons |
|-------------|-------|-------|---------|---------|
| La Liga | 21,210 | 2,658 | 1,312 | 18 |
| Premier League | 10,837 | 1,082 | 641 | 2 |
| Ligue 1 | 10,346 | 1,105 | 739 | 3 |
| Serie A | 10,033 | 955 | 475 | 2 |
| 1. Bundesliga | 8,747 | 947 | 560 | 2 |
| FA Women's Super League | 8,321 | 962 | 330 | 3 |
| FIFA World Cup | 3,904 | 443 | 890 | 8 |
| Women's World Cup | 2,994 | 327 | 576 | 2 |
| UEFA Euro | 2,629 | 281 | 547 | 2 |
| Champions League | 594 | 74 | 193 | 18 |
| *+ 11 more competitions* | | | | |
## Splits
| Split | Shots | Goals |
|-------|-------|-------|
| train | 70,418 | 7,825 (11.1%) |
| validation | 8,802 | 979 (11.1%) |
| test | 8,803 | 986 (11.2%) |
Stratified by `is_goal` to preserve goal rate across splits.
## Features
| Column | Type | Description |
|--------|------|-------------|
| `x` | float | Shot x-coordinate (StatsBomb pitch: 0–120, attacking direction) |
| `y` | float | Shot y-coordinate (StatsBomb pitch: 0–80) |
| `distance_to_goal` | float | Euclidean distance to goal center (120, 40) |
| `angle_to_goal` | float | Angle to goal in degrees |
| `under_pressure` | bool | Shooter was under defensive pressure |
| `shot_body_part_name` | string | `Right Foot` / `Left Foot` / `Head` / `Other` |
| `shot_technique_name` | string | `Normal` / `Volley` / `Half Volley` / `Lob` / `Overhead Kick` / `Backheel` |
| `shot_type_name` | string | `Open Play` / `Free Kick` / `Corner` / `Penalty` |
| `play_pattern_name` | string | `Regular Play` / `From Corner` / `From Free Kick` / etc. |
| `shot_outcome_name` | string | `Goal` / `Saved` / `Blocked` / `Off T` / `Wayward` / `Post` |
| `xg_statsbomb` | float | StatsBomb's official xG value — use as regression label or benchmark |
| `is_goal` | int | 1 if goal, 0 otherwise — binary classification label |
| `player` | string | Player full name |
| `team` | string | Team name |
| `competition_name` | string | Competition name |
| `season_name` | string | Season (e.g. `2019/2020`) |
| `match_date` | string | Match date (YYYY-MM-DD) |
| `match_id` | int | StatsBomb match identifier |
## Pitch Coordinates
StatsBomb uses a 120×80 coordinate system:
- `x=0` is the defensive goal line, `x=120` is the attacking goal line
- `y=0` is the left touchline, `y=80` is the right touchline
- Goal center is at `(120, 40)`
## Quick Start
```python
from datasets import load_dataset
ds = load_dataset("ClementeH/statsbomb-open-data-shots")
df = ds["train"].to_pandas()
# All Messi shots
messi = df[df["player"] == "Lionel Andrés Messi Cuccittini"]
print(f"Messi: {len(messi)} shots, {messi['is_goal'].sum()} goals, mean xG {messi['xg_statsbomb'].mean():.3f}")
# Train a simple xG model
from sklearn.ensemble import GradientBoostingClassifier
from sklearn.preprocessing import LabelEncoder
features = ["x", "y", "distance_to_goal", "angle_to_goal", "under_pressure"]
X = df[features].astype(float)
y = df["is_goal"]
model = GradientBoostingClassifier(n_estimators=200, max_depth=4)
model.fit(X, y)
```
## Benchmark: xG Model Performance
A GradientBoosting model trained on this dataset (9 features) vs StatsBomb's professional xG:
| Model | Brier Score ↓ | ROC-AUC ↑ |
|-------|-------------|----------|
| Logistic Regression (baseline) | 0.0858 | 0.7706 |
| GradientBoosting (this dataset) | 0.0803 | **0.8047** |
| StatsBomb xG (professional) | 0.0770 | 0.8198 |
The open model reaches **98% of professional xG performance** using only position, body part, technique, shot type, and pressure.
See [`ClementeH/football-xg`](https://huggingface.co/ClementeH/football-xg) for the trained model *(coming soon)*.
## Attribution
> **Data provided by StatsBomb via [StatsBomb Open Data](https://github.com/statsbomb/open-data).**
> Licensed under [CC BY-SA 4.0](https://creativecommons.org/licenses/by-sa/4.0/).
>
> You are free to share and adapt this data for any purpose, provided you give appropriate credit
> to StatsBomb and distribute your contributions under the same license.
>
> This dataset was processed and packaged for HuggingFace by [ClementeH](https://huggingface.co/ClementeH).
## Related Resources
- [statsbomb/open-data](https://github.com/statsbomb/open-data) — original raw JSON data
- [statsbombpy](https://github.com/statsbomb/statsbombpy) — official Python library
- [`ClementeH/football-xg`](https://huggingface.co/ClementeH/football-xg) — xG model trained on this dataset *(coming soon)*
- [`ClementeH/football-xg-analyzer`](https://huggingface.co/spaces/ClementeH/football-xg-analyzer) — interactive Space *(coming soon)*