Update README.md (generated from football2vec-360-model-card.md)
Browse files
README.md
CHANGED
|
@@ -20,27 +20,27 @@ pipeline_tag: feature-extraction
|
|
| 20 |
|
| 21 |
# Football2Vec 360-Enriched — Transformer + Deep Sets Player Embeddings
|
| 22 |
|
| 23 |
-
|
| 24 |
|
| 25 |
-
This model occupies a **separate embedding space** from [Football2Vec v2](https://huggingface.co/luxury-lakehouse/football2vec-v2) (
|
| 26 |
|
| 27 |
Part of the (Right! Luxury!) Lakehouse soccer analytics platform.
|
| 28 |
|
| 29 |
## Model Description
|
| 30 |
|
| 31 |
-
Football2Vec 360-Enriched extends the v2 transformer architecture with a Deep Sets encoder that processes the spatial positions of all visible opponents and teammates at the moment of each action. The
|
| 32 |
|
| 33 |
### Architecture
|
| 34 |
|
| 35 |
| Component | Detail |
|
| 36 |
|-----------|--------|
|
| 37 |
-
| **Token embedding** | 23 SPADL action types →
|
| 38 |
-
| **Spatial encoding** | MLP(x) + MLP(y) →
|
| 39 |
| **Positional embedding** | Learnable, max 512 tokens |
|
| 40 |
| **Encoder** | 4-layer TransformerEncoder, 4 attention heads, GELU activation, 4x FFN |
|
| 41 |
-
| **Pooling** | Mean pooling over valid (non-padding) tokens →
|
| 42 |
| **Deep Sets encoder** | Per-player MLP on freeze-frame (x, y, team) → sum-pool → 16d |
|
| 43 |
-
| **Output** | Concatenation [
|
| 44 |
| **Adversarial head** | Gradient reversal layer (λ=0.2) + team classifier |
|
| 45 |
|
| 46 |
### Two-Stage Training
|
|
@@ -55,7 +55,7 @@ This model provides the **behavioral** half of a dual-vector player representati
|
|
| 55 |
|
| 56 |
| Vector | Dimensions | Source | Captures |
|
| 57 |
|--------|-----------|--------|----------|
|
| 58 |
-
| **Behavioral** (this model) |
|
| 59 |
| **Statistical** | 13 | Z-score normalized per-90 stats | Goals, assists, xG, passes, VAEP, defensive metrics |
|
| 60 |
|
| 61 |
Both vectors are stored in PostgreSQL with [pgvector](https://github.com/pgvector/pgvector) HNSW indexes for sub-10ms similarity queries.
|
|
@@ -80,16 +80,16 @@ Continuous spatial coordinates (x, y) normalized to [0, 1] on a 105×68m pi
|
|
| 80 |
|
| 81 |
| Parameter | Value |
|
| 82 |
|-----------|-------|
|
| 83 |
-
| Hidden dimension |
|
| 84 |
| Encoder layers | 4 |
|
| 85 |
| Attention heads | 4 |
|
| 86 |
-
| FFN multiplier | 4x (
|
| 87 |
| Dropout | 0.1 |
|
| 88 |
| Max sequence length | 512 |
|
| 89 |
| MLM mask probability | 0.15 |
|
| 90 |
| Spatial MLP intermediate dim | 64 |
|
| 91 |
| Deep Sets MLP dims | [32, 16] |
|
| 92 |
-
| Output dimension |
|
| 93 |
| Batch size | 256 |
|
| 94 |
| Learning rate | 1e-4 |
|
| 95 |
| Weight decay | 0.01 |
|
|
@@ -117,7 +117,7 @@ with open(config_path) as f:
|
|
| 117 |
|
| 118 |
state_dict = load_file(weights_path)
|
| 119 |
print(f"Config: {config['hidden_dim']}-dim transformer + {config['deepsets_dim']}-dim Deep Sets")
|
| 120 |
-
print(f"Output dimension: {config['output_dim']}") #
|
| 121 |
print(f"Parameters: {sum(p.numel() for p in state_dict.values()):,}")
|
| 122 |
```
|
| 123 |
|
|
@@ -133,14 +133,14 @@ ds = load_dataset("luxury-lakehouse/football2vec-360-embeddings")
|
|
| 133 |
df = ds["train"].to_pandas()
|
| 134 |
|
| 135 |
vectors = np.array(df["behavioral_vector"].tolist())
|
| 136 |
-
print(f"{vectors.shape[0]} player-matches, {vectors.shape[1]}-dim embeddings") # (~4K,
|
| 137 |
```
|
| 138 |
|
| 139 |
> **Note:** These embeddings cover only players with StatsBomb 360 match appearances (~4K player-match records vs. ~87K for Football2Vec v2). For broader coverage, use [Football2Vec v2](https://huggingface.co/luxury-lakehouse/football2vec-v2).
|
| 140 |
|
| 141 |
## Intended Use
|
| 142 |
|
| 143 |
-
- **Context-aware player similarity**: Cosine distance on
|
| 144 |
- **Spatial pattern analysis**: The 16-dim Deep Sets component captures how players behave relative to nearby opponents and teammates
|
| 145 |
- **Scouting in high-press contexts**: Embeddings encode how players handle actions under spatial pressure from surrounding defenders
|
| 146 |
- **Research**: Reproducible 360-enriched player representations with adversarial debiasing; pairs with Football2Vec v2 for ablation studies
|
|
@@ -158,7 +158,7 @@ See the [`AI_GOVERNANCE.md`](https://github.com/karsten-s-nielsen/luxury-lakehou
|
|
| 158 |
|
| 159 |
- **360-data only**: Covers 323 StatsBomb 360 matches. Players with appearances only in non-360 matches have no embeddings from this model.
|
| 160 |
- **Smaller training corpus**: 323 matches vs. ~3,000 for Football2Vec v2. Embeddings for players with few 360 appearances may be noisier.
|
| 161 |
-
- **Separate embedding space**:
|
| 162 |
- **Event-based actions + freeze-frames**: Off-ball runs and pressing without a nearby action event are not captured.
|
| 163 |
- **Team debiasing, not competition debiasing**: The adversarial head targets team ID (stronger confounder in the smaller 360 corpus). Cross-league confounds are attenuated but not fully removed.
|
| 164 |
- **Open data only**: Derived from publicly available StatsBomb 360 data. Commercial datasets with proprietary 360 annotations may yield different representations.
|
|
@@ -231,8 +231,8 @@ Model weights use the **safetensors** format — a tensor-only serialization
|
|
| 231 |
| Resource | Description |
|
| 232 |
|----------|-------------|
|
| 233 |
| [360 Training Data](https://huggingface.co/datasets/luxury-lakehouse/football2vec-360-training-data) | SPADL sequences with 360 freeze-frames used for training |
|
| 234 |
-
| [360 Player Embeddings](https://huggingface.co/datasets/luxury-lakehouse/football2vec-360-embeddings) | Pre-computed
|
| 235 |
-
| [Football2Vec v2](https://huggingface.co/luxury-lakehouse/football2vec-v2) |
|
| 236 |
| [Football2Vec v1](https://huggingface.co/luxury-lakehouse/football2vec-statsbomb-wyscout) | 32-dim Doc2Vec baseline |
|
| 237 |
| [SPADL/VAEP Action Values](https://huggingface.co/datasets/luxury-lakehouse/spadl-vaep-action-values) | Per-action offensive/defensive VAEP valuations |
|
| 238 |
|
|
@@ -240,7 +240,7 @@ Model weights use the **safetensors** format — a tensor-only serialization
|
|
| 240 |
|
| 241 |
Try the interactive [Soccer Analytics App](https://huggingface.co/spaces/luxury-lakehouse/soccer-analytics-app) — the Player Similarity page supports similarity search on 360-enriched embeddings for players with 360 match coverage.
|
| 242 |
|
| 243 |
-
> **Explore interactively:** [
|
| 244 |
|
| 245 |
## More Information
|
| 246 |
|
|
|
|
| 20 |
|
| 21 |
# Football2Vec 360-Enriched — Transformer + Deep Sets Player Embeddings
|
| 22 |
|
| 23 |
+
208-dimensional player embedding vectors from a 4-layer transformer encoder augmented with a Deep Sets context encoder (Zaheer et al. 2017) trained on **~2M SPADL actions** with StatsBomb 360 freeze-frame data from **323 professional soccer matches**. Adversarial team debiasing via gradient reversal (Ganin et al. 2016) removes team-identity confounds, producing style representations that generalize across teams.
|
| 24 |
|
| 25 |
+
This model occupies a **separate embedding space** from [Football2Vec v2](https://huggingface.co/luxury-lakehouse/football2vec-v2) (192-dim, event-only). The 360-enriched vectors are not directly comparable to v2 vectors and should not be mixed in downstream similarity search without re-indexing.
|
| 26 |
|
| 27 |
Part of the (Right! Luxury!) Lakehouse soccer analytics platform.
|
| 28 |
|
| 29 |
## Model Description
|
| 30 |
|
| 31 |
+
Football2Vec 360-Enriched extends the v2 transformer architecture with a Deep Sets encoder that processes the spatial positions of all visible opponents and teammates at the moment of each action. The 208-dim output captures both individual action sequences and the spatial context in which those actions occur — richer representations than event-only models for players who frequently appear in 360-annotated matches.
|
| 32 |
|
| 33 |
### Architecture
|
| 34 |
|
| 35 |
| Component | Detail |
|
| 36 |
|-----------|--------|
|
| 37 |
+
| **Token embedding** | 23 SPADL action types → 192d lookup table |
|
| 38 |
+
| **Spatial encoding** | MLP(x) + MLP(y) → 192d each, summed with token embedding |
|
| 39 |
| **Positional embedding** | Learnable, max 512 tokens |
|
| 40 |
| **Encoder** | 4-layer TransformerEncoder, 4 attention heads, GELU activation, 4x FFN |
|
| 41 |
+
| **Pooling** | Mean pooling over valid (non-padding) tokens → 192d |
|
| 42 |
| **Deep Sets encoder** | Per-player MLP on freeze-frame (x, y, team) → sum-pool → 16d |
|
| 43 |
+
| **Output** | Concatenation [192d transformer \|\| 16d Deep Sets] → 208d |
|
| 44 |
| **Adversarial head** | Gradient reversal layer (λ=0.2) + team classifier |
|
| 45 |
|
| 46 |
### Two-Stage Training
|
|
|
|
| 55 |
|
| 56 |
| Vector | Dimensions | Source | Captures |
|
| 57 |
|--------|-----------|--------|----------|
|
| 58 |
+
| **Behavioral** (this model) | 208 | Transformer + Deep Sets on SPADL + 360 freeze-frames | Playing style, spatial context, action sequences |
|
| 59 |
| **Statistical** | 13 | Z-score normalized per-90 stats | Goals, assists, xG, passes, VAEP, defensive metrics |
|
| 60 |
|
| 61 |
Both vectors are stored in PostgreSQL with [pgvector](https://github.com/pgvector/pgvector) HNSW indexes for sub-10ms similarity queries.
|
|
|
|
| 80 |
|
| 81 |
| Parameter | Value |
|
| 82 |
|-----------|-------|
|
| 83 |
+
| Hidden dimension | 192 |
|
| 84 |
| Encoder layers | 4 |
|
| 85 |
| Attention heads | 4 |
|
| 86 |
+
| FFN multiplier | 4x (768) |
|
| 87 |
| Dropout | 0.1 |
|
| 88 |
| Max sequence length | 512 |
|
| 89 |
| MLM mask probability | 0.15 |
|
| 90 |
| Spatial MLP intermediate dim | 64 |
|
| 91 |
| Deep Sets MLP dims | [32, 16] |
|
| 92 |
+
| Output dimension | 208 |
|
| 93 |
| Batch size | 256 |
|
| 94 |
| Learning rate | 1e-4 |
|
| 95 |
| Weight decay | 0.01 |
|
|
|
|
| 117 |
|
| 118 |
state_dict = load_file(weights_path)
|
| 119 |
print(f"Config: {config['hidden_dim']}-dim transformer + {config['deepsets_dim']}-dim Deep Sets")
|
| 120 |
+
print(f"Output dimension: {config['output_dim']}") # 208
|
| 121 |
print(f"Parameters: {sum(p.numel() for p in state_dict.values()):,}")
|
| 122 |
```
|
| 123 |
|
|
|
|
| 133 |
df = ds["train"].to_pandas()
|
| 134 |
|
| 135 |
vectors = np.array(df["behavioral_vector"].tolist())
|
| 136 |
+
print(f"{vectors.shape[0]} player-matches, {vectors.shape[1]}-dim embeddings") # (~4K, 208)
|
| 137 |
```
|
| 138 |
|
| 139 |
> **Note:** These embeddings cover only players with StatsBomb 360 match appearances (~4K player-match records vs. ~87K for Football2Vec v2). For broader coverage, use [Football2Vec v2](https://huggingface.co/luxury-lakehouse/football2vec-v2).
|
| 140 |
|
| 141 |
## Intended Use
|
| 142 |
|
| 143 |
+
- **Context-aware player similarity**: Cosine distance on 208-dim vectors finds players with similar style *and* spatial decision-making
|
| 144 |
- **Spatial pattern analysis**: The 16-dim Deep Sets component captures how players behave relative to nearby opponents and teammates
|
| 145 |
- **Scouting in high-press contexts**: Embeddings encode how players handle actions under spatial pressure from surrounding defenders
|
| 146 |
- **Research**: Reproducible 360-enriched player representations with adversarial debiasing; pairs with Football2Vec v2 for ablation studies
|
|
|
|
| 158 |
|
| 159 |
- **360-data only**: Covers 323 StatsBomb 360 matches. Players with appearances only in non-360 matches have no embeddings from this model.
|
| 160 |
- **Smaller training corpus**: 323 matches vs. ~3,000 for Football2Vec v2. Embeddings for players with few 360 appearances may be noisier.
|
| 161 |
+
- **Separate embedding space**: 208-dim vectors are not comparable to Football2Vec v2 192-dim vectors. Cannot mix in the same similarity index without re-embedding all players.
|
| 162 |
- **Event-based actions + freeze-frames**: Off-ball runs and pressing without a nearby action event are not captured.
|
| 163 |
- **Team debiasing, not competition debiasing**: The adversarial head targets team ID (stronger confounder in the smaller 360 corpus). Cross-league confounds are attenuated but not fully removed.
|
| 164 |
- **Open data only**: Derived from publicly available StatsBomb 360 data. Commercial datasets with proprietary 360 annotations may yield different representations.
|
|
|
|
| 231 |
| Resource | Description |
|
| 232 |
|----------|-------------|
|
| 233 |
| [360 Training Data](https://huggingface.co/datasets/luxury-lakehouse/football2vec-360-training-data) | SPADL sequences with 360 freeze-frames used for training |
|
| 234 |
+
| [360 Player Embeddings](https://huggingface.co/datasets/luxury-lakehouse/football2vec-360-embeddings) | Pre-computed 208-dim vectors per player-match |
|
| 235 |
+
| [Football2Vec v2](https://huggingface.co/luxury-lakehouse/football2vec-v2) | 192-dim event-only model (~3,000 matches, broader coverage) |
|
| 236 |
| [Football2Vec v1](https://huggingface.co/luxury-lakehouse/football2vec-statsbomb-wyscout) | 32-dim Doc2Vec baseline |
|
| 237 |
| [SPADL/VAEP Action Values](https://huggingface.co/datasets/luxury-lakehouse/spadl-vaep-action-values) | Per-action offensive/defensive VAEP valuations |
|
| 238 |
|
|
|
|
| 240 |
|
| 241 |
Try the interactive [Soccer Analytics App](https://huggingface.co/spaces/luxury-lakehouse/soccer-analytics-app) — the Player Similarity page supports similarity search on 360-enriched embeddings for players with 360 match coverage.
|
| 242 |
|
| 243 |
+
> **Explore interactively:** [Soccer Analytics App](https://huggingface.co/spaces/luxury-lakehouse/soccer-analytics-app)
|
| 244 |
|
| 245 |
## More Information
|
| 246 |
|