File size: 10,166 Bytes
23c65e5
bca8bde
 
b572eec
bca8bde
 
 
 
 
 
 
 
 
 
 
 
607eafa
 
 
 
 
 
 
 
 
 
 
23c65e5
bca8bde
 
 
b486024
 
4907dab
 
607eafa
4907dab
060b14a
 
 
 
 
 
4907dab
060b14a
 
 
bca8bde
 
 
 
 
 
 
 
4907dab
bca8bde
 
 
 
 
 
 
 
 
 
 
 
 
 
4907dab
 
bca8bde
 
 
 
 
 
 
4907dab
 
 
 
 
 
 
 
 
 
 
bca8bde
 
 
 
 
4907dab
bca8bde
4907dab
b486024
4907dab
 
 
 
 
 
 
 
bca8bde
 
 
 
b486024
 
607eafa
4907dab
 
b486024
607eafa
4907dab
 
b486024
607eafa
4907dab
b486024
 
607eafa
4907dab
 
b486024
607eafa
4907dab
b486024
 
607eafa
4907dab
 
b486024
607eafa
4907dab
 
b486024
607eafa
4907dab
b486024
607eafa
 
bca8bde
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
4907dab
 
bca8bde
 
 
4907dab
607eafa
 
 
4907dab
 
bca8bde
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
b572eec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
---
language:
- en
license: mit
task_categories:
- time-series-forecasting
tags:
- temporal-point-process
- event-sequences
- nba
- sports
- play-by-play
- marked-temporal-point-process
size_categories:
- 1K<n<10K
pretty_name: NBA Quarter Events
dataset_description: >-
  Curated per-quarter NBA play-by-play sequences from the 2024-25 regular season,
  designed for temporal point process (TPP) and marked temporal point process (MTPP)
  modeling. Each sequence represents one quarter (Q1-Q4) of a single game, with the
  prediction target being the play type of the next event. Sequences are filtered to
  keep only quarters with 90-110 events, ensuring consistent sequence lengths. Rich
  narrative type_text descriptions provide fully descriptive context — shot style and
  distance, make/miss results, offensive/defensive rebound classification, full team
  names on every event, and timeout types — enabling an LLM to predict the next event
  type from the sequence alone. Quarter and time information are captured in metadata
  and time_since_start fields rather than repeated in type_text, reducing token waste.
---

# NBA Quarter Events

## Dataset Description

Curated per-quarter NBA play-by-play sequences from the 2024-25 regular season, designed for temporal point process (TPP) and marked temporal point process (MTPP) modeling. Each sequence represents one quarter (Q1–Q4) of a single game, with the prediction target being the **play type** of the next event. Sequences are filtered to keep only quarters with 90–110 events, ensuring consistent sequence lengths.

Rich narrative `type_text` descriptions provide fully descriptive context for each event — shot style and distance, free throw make/miss with sequence position, offensive/defensive rebound classification, team identification on every play, and timeout types — enabling an LLM to predict the next event type from the sequence alone. Quarter and time-remaining information is not repeated in `type_text` since it is already captured in `metadata.quarter` and `time_since_start`.

- **Source:** [NBA Stats API](https://www.nba.com/stats/)
- **Season:** 2024–25 Regular Season
- **Grouping:** Events grouped by quarter (Q1–Q4) within each game
- **Sequences:** 2,868
- **Train / Validation / Test:** 2,296 / 286 / 286
- **Sequence length:** 90–110 events per quarter (mean: 101.5)
- **Total events:** 291,091
- **Event types:** 9 play categories
- **Time unit:** minutes (from quarter start)
- **Source games:** 1,225

## Dataset Summary

| Property | Value |
|---|---|
| Total sequences | 2,868 |
| Train / Validation / Test | 2,296 / 286 / 286 |
| Event types | 9 |
| Total events | 291,091 |
| Events per quarter | 90–110 (mean 101.5) |
| Time unit | minutes (from quarter start) |
| Duration per quarter | 11.2–12.0 minutes |
| Season | 2024-25 Regular Season |
| Source games | 1,225 |

## Schema

Each record follows the canonical 8-field TPP schema:

| Field | Type | Description |
|---|---|---|
| `seq_idx` | int | Sequence index (per split) |
| `seq_len` | int | Number of events in the sequence |
| `description` | str | Game summary (teams, date, quarter, player rosters) |
| `metadata` | str (JSON) | `game_id`, `home_team`, `away_team`, `home_players`, `away_players`, `game_date`, `season`, `season_type`, `time_unit`, `quarter` |
| `time_since_start` | list[float] | Elapsed minutes from the first event in the quarter |
| `time_since_last_event` | list[float] | Minutes since the previous event (first is 0.0) |
| `type_event` | list[str] | Play type label — the prediction target |
| `type_text` | list[str] | Rich narrative description of each event |

## Event Types (9 categories)

| type_event | Description | Share |
|---|---|---|
| `rebound` | Offensive and defensive rebounds | 24.3% |
| `missed_fg` | Missed field goals (2pt or 3pt) | 22.4% |
| `made_2pt` | Made 2-point field goals | 13.8% |
| `free_throw` | Free throw attempts (make/miss) | 8.9% |
| `foul` | Personal, shooting, and offensive fouls | 8.3% |
| `made_3pt` | Made 3-point field goals | 7.0% |
| `turnover` | Turnovers (bad pass, travel, shot clock, etc.) | 6.7% |
| `steal_or_block` | Steals and blocked shots | 5.9% |
| `timeout` | Team timeouts (regular, mandatory) | 2.6% |

Administrative events (substitution, jump ball, period start/end, violation, ejection, instant replay) are excluded.

## type_text (Rich Narrative)

Each event's `type_text` is a natural language sentence combining multiple context signals. The description is designed to be **fully informative** so an LLM reading a sequence of events can predict the next event type:

- **Player identity**: Name, team full name, position (guard / forward / center)
- **Team identification**: Full team name on every event (e.g., "for the Orlando Magic") for unambiguous possession tracking
- **Shot style**: Specific shot type from API subType (driving layup, fadeaway jump, pullup jump, cutting dunk, etc.)
- **Shot distance & zone**: Distance in feet from the API `shotDistance` field, plus court zone (paint, left wing, corner three, top of arc, mid-range, etc.)
- **Free throw detail**: Make/miss result parsed from description, plus sequence position (e.g., "1 of 2", "2 of 3")
- **Rebound classification**: Offensive or defensive, classified via subType and description parsing (covers ~95%+ of rebounds)
- **Timeout team & type**: Team identified via `location` field (home/visitor), with timeout subtype (regular, mandatory)
- **Foul subtype**: Lowercased foul type (shooting, personal, offensive, loose ball, etc.)
- **Score context**: Leading team, margin, game state (tight game, comfortable margin, blowout)
- **Momentum**: Scoring runs with full team name (e.g., "Orlando Magic currently on a 6-0 scoring run"), pattern signals (e.g., "shooting 3 for 5 recently")

**Examples:**

```
# Made 2pt — includes shot style, distance, zone, team name
"J. Robinson-Earl. makes a 2-point putback layup from 3 feet near the basket
 for the New Orleans Pelicans. Orlando Magic lead 12-6. early in the game."

# Made 3pt
"K. Ware, Heat center. makes a 3-point jump from 28 feet from the right wing
 for the Miami Heat. Milwaukee Bucks lead 81-65 with a comfortable margin."

# Missed field goal — includes 2pt/3pt distinction and shot style
"J. Robinson-Earl. misses a 2-point layup from 6 feet in the paint for the
 New Orleans Pelicans. The game is tied. early in the game."

# Free throw miss — includes make/miss and sequence position (1 of 2)
"J. Alvarado, Knicks guard. misses free throw 1 of 2 for the New Orleans
 Pelicans. The game is tied."

# Rebound — classified as offensive/defensive
"G. Bitadze, Magic center-forward. grabs an offensive rebound for the Orlando
 Magic. The game is tied. early in the game."

# Turnover — subtype integrated naturally into description
"B. Ingram, Raptors forward. commits a bad pass turnover for the New Orleans
 Pelicans. The game is tied. early in the game."

# Foul — lowercased subtype
"F. Wagner, Magic forward. commits a personal foul for the Orlando Magic.
 The game is tied. early in the game."

# Steal
"K. Caldwell-Pope, Grizzlies guard. records a steal for the Orlando Magic.
 The game is tied. early in the game."

# Timeout — team identified with full name, includes timeout type
"the New Orleans Pelicans call a regular timeout. The game is tied. early in
 the game. Orlando Magic currently on a 6-0 scoring run."
```

## Curation Filters

Quarters are selected from complete games (all 4 regulation quarters present) with diverse, non-trivial event distributions:

| Filter | Value | Description |
|---|---|---|
| `min-events` | 90 | Min events per quarter |
| `max-events` | 110 | Max events per quarter |
| `min-types` | 4 | At least 4 distinct event types of 9 |
| `max-dominant-ratio` | 0.40 | No single event type exceeds 40% of events |
| `max-repeat-ratio` | 0.30 | Consecutive same-type rate below 30% |
| Completeness | — | All 4 quarters (Q1–Q4) must be present; overtime excluded |

## Example

```json
{
  "seq_idx": 0,
  "seq_len": 96,
  "description": "NBA Regular Season game between the New York Knicks and the Brooklyn Nets on 2025-04-13. Q1 play-by-play events. New York Knicks: C. Payne, L. Shamet, M. Bridges, ...; Brooklyn Nets: D. Timme, K. Johnson, T. Etienne, ...",
  "metadata": "{\"game_id\": \"0022401188\", \"home_team\": \"BKN\", \"away_team\": \"NYK\", \"home_players\": [\"D. Timme\", ...], \"away_players\": [\"C. Payne\", ...], \"game_date\": \"2025-04-13\", \"season\": \"2024-25\", \"season_type\": \"Regular Season\", \"time_unit\": \"minutes\", \"quarter\": \"Q1\"}",
  "time_since_start": [0.0, 0.3167, 0.5333, ...],
  "time_since_last_event": [0.0, 0.3167, 0.2167, ...],
  "type_event": ["foul", "turnover", "made_2pt", ...],
  "type_text": [
    "M. Bridges, Knicks guard-forward. commits a personal take foul for the New York Knicks. The game is tied. early in the game.",
    "commits a shot clock turnover. The game is tied. early in the game.",
    "C. Payne, 76ers guard. makes a 2-point driving finger roll layup from 5 feet in the paint for the New York Knicks. New York Knicks lead 2-0 in a tight game. early in the game.",
    ...
  ]
}
```

## Data Source

Play-by-play data sourced from the NBA Stats API via the [`nba_api`](https://github.com/swar/nba_api) Python package using the `PlayByPlayV3` endpoint. Player metadata (name, position, team) fetched via `CommonPlayerInfo`.

## Usage

```python
from datasets import load_dataset

ds = load_dataset("DescribeEvents/nba_quarter_events")

# Access splits
train = ds["train"]       # 2,296 sequences
val = ds["validation"]    # 286 sequences
test = ds["test"]         # 286 sequences

print(train[0]["type_event"][:5])   # First 5 play types
print(train[0]["type_text"][:5])    # First 5 narrative descriptions
```

## Citation

If you use this dataset, please cite:

```bibtex
@dataset{nba_quarter_events_2025,
  title={NBA Quarter Events: A Temporal Point Process Dataset},
  author={DescribeEvents},
  year={2025},
  publisher={Hugging Face},
  url={https://huggingface.co/datasets/DescribeEvents/nba_quarter_events}
}
```