rishabh-ranjan commited on
Commit
d500f4d
·
verified ·
1 Parent(s): 1358998

rel-f1: YAML manifests + descriptions + schema card

Browse files
rel-f1/README.md CHANGED
@@ -1,19 +1,91 @@
1
- ---
2
- license: cc-by-sa-4.0
3
- tags:
4
- - relbench
5
- - relational-deep-learning
6
- ---
7
 
8
- # rel-f1 (RelBench)
9
 
10
- Formula 1 relational database for [RelBench](https://relbench.stanford.edu), in the
11
- self-describing manifest layout: plain parquet + `manifest.json`.
12
 
13
- - `manifest.json` — tables, primary keys, the foreign-key graph, and val/test timestamps.
14
- - `db/*.parquet` — the relational tables (plain parquet, native dtypes only).
15
- - `tasks/<task>/manifest.json` — task spec; `forecast` tasks include the duckdb SQL that
16
- regenerates their labels. `tasks/<task>/{train,val,test}.parquet` — cached labels.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
17
 
18
- Load with `relbench.load_dataset("rel-f1")` / `relbench.load_task("rel-f1", "<task>")`,
19
- or read the parquet directly with pandas/duckdb.
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # rel-f1
 
 
 
 
 
2
 
3
+ Formula 1 motorsport database: races, drivers, constructors, circuits, race results, qualifying, and championship standings.
4
 
5
+ ## Schema
 
6
 
7
+ ```mermaid
8
+ erDiagram
9
+ races {
10
+ key raceId PK
11
+ key circuitId FK
12
+ datetime date
13
+ }
14
+ qualifying {
15
+ key qualifyId PK
16
+ key raceId FK
17
+ key driverId FK
18
+ key constructorId FK
19
+ datetime date
20
+ }
21
+ constructor_standings {
22
+ key constructorStandingsId PK
23
+ key raceId FK
24
+ key constructorId FK
25
+ datetime date
26
+ }
27
+ standings {
28
+ key driverStandingsId PK
29
+ key raceId FK
30
+ key driverId FK
31
+ datetime date
32
+ }
33
+ constructors {
34
+ key constructorId PK
35
+ }
36
+ drivers {
37
+ key driverId PK
38
+ }
39
+ constructor_results {
40
+ key constructorResultsId PK
41
+ key raceId FK
42
+ key constructorId FK
43
+ datetime date
44
+ }
45
+ circuits {
46
+ key circuitId PK
47
+ }
48
+ results {
49
+ key resultId PK
50
+ key raceId FK
51
+ key driverId FK
52
+ key constructorId FK
53
+ datetime date
54
+ }
55
+ races }o--|| circuits : circuitId
56
+ qualifying }o--|| races : raceId
57
+ qualifying }o--|| drivers : driverId
58
+ qualifying }o--|| constructors : constructorId
59
+ constructor_standings }o--|| races : raceId
60
+ constructor_standings }o--|| constructors : constructorId
61
+ standings }o--|| races : raceId
62
+ standings }o--|| drivers : driverId
63
+ constructor_results }o--|| races : raceId
64
+ constructor_results }o--|| constructors : constructorId
65
+ results }o--|| races : raceId
66
+ results }o--|| drivers : driverId
67
+ results }o--|| constructors : constructorId
68
+ ```
69
 
70
+ Splits: validation `2005-01-01`, test `2010-01-01` (rows up to a split's timestamp are the inputs for that split).
71
+
72
+ ## Tasks
73
+
74
+ | task | kind | type | description |
75
+ |---|---|---|---|
76
+ | `driver-circuit-compete` | forecast | link_prediction | Predict on which circuits a driver will compete in the next 1 year. |
77
+ | `driver-dnf` | forecast | binary_classification | Predict the if each driver will DNF (not finish) a race in the next 1 month. |
78
+ | `driver-position` | forecast | regression | Predict the average finishing position of each driver all races in the next 2 months. |
79
+ | `driver-top3` | forecast | binary_classification | Predict if each driver will qualify in the top-3 for a race within the next 1 month. |
80
+ | `qualifying-position` | autocomplete | regression | Predict the `position` column of the `qualifying` table. |
81
+ | `results-position` | autocomplete | regression | Predict the `position` column of the `results` table. |
82
+
83
+ ## Loading
84
+
85
+ ```python
86
+ import relbench
87
+ ds = relbench.load_dataset("rel-f1")
88
+ task = relbench.load_task("rel-f1", "<task>")
89
+ ```
90
+
91
+ Manifest layout (`manifest.yaml` + plain parquet); see the RelBench [CONTRIBUTING guide](https://github.com/snap-stanford/relbench/blob/main/CONTRIBUTING.md).
rel-f1/manifest.json DELETED
@@ -1,72 +0,0 @@
1
- {
2
- "name": "rel-f1",
3
- "manifest_version": 1,
4
- "val_timestamp": "2005-01-01",
5
- "test_timestamp": "2010-01-01",
6
- "tables": {
7
- "races": {
8
- "pkey": "raceId",
9
- "time_col": "date",
10
- "fkeys": {
11
- "circuitId": "circuits"
12
- }
13
- },
14
- "qualifying": {
15
- "pkey": "qualifyId",
16
- "time_col": "date",
17
- "fkeys": {
18
- "raceId": "races",
19
- "driverId": "drivers",
20
- "constructorId": "constructors"
21
- }
22
- },
23
- "constructor_standings": {
24
- "pkey": "constructorStandingsId",
25
- "time_col": "date",
26
- "fkeys": {
27
- "raceId": "races",
28
- "constructorId": "constructors"
29
- }
30
- },
31
- "standings": {
32
- "pkey": "driverStandingsId",
33
- "time_col": "date",
34
- "fkeys": {
35
- "raceId": "races",
36
- "driverId": "drivers"
37
- }
38
- },
39
- "constructors": {
40
- "pkey": "constructorId",
41
- "time_col": null,
42
- "fkeys": {}
43
- },
44
- "drivers": {
45
- "pkey": "driverId",
46
- "time_col": null,
47
- "fkeys": {}
48
- },
49
- "constructor_results": {
50
- "pkey": "constructorResultsId",
51
- "time_col": "date",
52
- "fkeys": {
53
- "raceId": "races",
54
- "constructorId": "constructors"
55
- }
56
- },
57
- "circuits": {
58
- "pkey": "circuitId",
59
- "time_col": null,
60
- "fkeys": {}
61
- },
62
- "results": {
63
- "pkey": "resultId",
64
- "time_col": "date",
65
- "fkeys": {
66
- "raceId": "races",
67
- "driverId": "drivers",
68
- "constructorId": "constructors"
69
- }
70
- }
71
- }
72
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rel-f1/manifest.yaml ADDED
@@ -0,0 +1,55 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: rel-f1
2
+ manifest_version: 1
3
+ description: 'Formula 1 motorsport database: races, drivers, constructors, circuits, race results, qualifying, and championship standings.'
4
+ val_timestamp: '2005-01-01'
5
+ test_timestamp: '2010-01-01'
6
+ tables:
7
+ races:
8
+ pkey: raceId
9
+ time_col: date
10
+ fkeys:
11
+ circuitId: circuits
12
+ qualifying:
13
+ pkey: qualifyId
14
+ time_col: date
15
+ fkeys:
16
+ raceId: races
17
+ driverId: drivers
18
+ constructorId: constructors
19
+ constructor_standings:
20
+ pkey: constructorStandingsId
21
+ time_col: date
22
+ fkeys:
23
+ raceId: races
24
+ constructorId: constructors
25
+ standings:
26
+ pkey: driverStandingsId
27
+ time_col: date
28
+ fkeys:
29
+ raceId: races
30
+ driverId: drivers
31
+ constructors:
32
+ pkey: constructorId
33
+ time_col: null
34
+ fkeys: {}
35
+ drivers:
36
+ pkey: driverId
37
+ time_col: null
38
+ fkeys: {}
39
+ constructor_results:
40
+ pkey: constructorResultsId
41
+ time_col: date
42
+ fkeys:
43
+ raceId: races
44
+ constructorId: constructors
45
+ circuits:
46
+ pkey: circuitId
47
+ time_col: null
48
+ fkeys: {}
49
+ results:
50
+ pkey: resultId
51
+ time_col: date
52
+ fkeys:
53
+ raceId: races
54
+ driverId: drivers
55
+ constructorId: constructors
rel-f1/tasks/driver-circuit-compete/manifest.json DELETED
@@ -1,20 +0,0 @@
1
- {
2
- "name": "driver-circuit-compete",
3
- "kind": "forecast",
4
- "task_type": "link_prediction",
5
- "target_col": "circuitId",
6
- "time_col": "date",
7
- "src_entity_table": "drivers",
8
- "src_entity_col": "driverId",
9
- "dst_entity_table": "circuits",
10
- "dst_entity_col": "circuitId",
11
- "eval_k": 10,
12
- "timedelta": "365 days",
13
- "metrics": [
14
- "link_prediction_precision",
15
- "link_prediction_recall",
16
- "link_prediction_map"
17
- ],
18
- "sql": "SELECT\n t.timestamp as date,\n re.driverId as driverId,\n LIST(DISTINCT race.circuitId) as circuitId\nFROM\n timestamps t\nLEFT JOIN\n races race\nON\n race.date <= t.timestamp + INTERVAL '{timedelta}'\n and race.date > t.timestamp\nLEFT JOIN\n results re\nON\n re.raceId = race.raceId\nGROUP BY t.timestamp, re.driverId",
19
- "manifest_version": 1
20
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rel-f1/tasks/driver-circuit-compete/manifest.yaml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: driver-circuit-compete
2
+ kind: forecast
3
+ task_type: link_prediction
4
+ description: Predict on which circuits a driver will compete in the next 1 year.
5
+ target_col: circuitId
6
+ time_col: date
7
+ src_entity_table: drivers
8
+ src_entity_col: driverId
9
+ dst_entity_table: circuits
10
+ dst_entity_col: circuitId
11
+ eval_k: 10
12
+ timedelta: 365 days
13
+ sql: |-
14
+ SELECT
15
+ t.timestamp as date,
16
+ re.driverId as driverId,
17
+ LIST(DISTINCT race.circuitId) as circuitId
18
+ FROM
19
+ timestamps t
20
+ LEFT JOIN
21
+ races race
22
+ ON
23
+ race.date <= t.timestamp + INTERVAL '{timedelta}'
24
+ and race.date > t.timestamp
25
+ LEFT JOIN
26
+ results re
27
+ ON
28
+ re.raceId = race.raceId
29
+ GROUP BY t.timestamp, re.driverId
30
+ manifest_version: 1
rel-f1/tasks/driver-dnf/manifest.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "name": "driver-dnf",
3
- "kind": "forecast",
4
- "task_type": "binary_classification",
5
- "entity_table": "drivers",
6
- "entity_col": "driverId",
7
- "target_col": "did_not_finish",
8
- "time_col": "date",
9
- "timedelta": "30 days",
10
- "metrics": [
11
- "average_precision",
12
- "accuracy",
13
- "f1",
14
- "roc_auc"
15
- ],
16
- "sql": "SELECT\n t.timestamp as date,\n re.driverId as driverId,\n MAX(CASE WHEN re.statusId != 1 THEN 1 ELSE 0 END) AS did_not_finish\nFROM\n timestamps t\nLEFT JOIN\n results re\nON\n re.date <= t.timestamp + INTERVAL '{timedelta}'\n and re.date > t.timestamp\nWHERE\n re.driverId IN (\n SELECT DISTINCT driverId\n FROM results\n WHERE date > t.timestamp - INTERVAL '1 year'\n )\nGROUP BY t.timestamp, re.driverId",
17
- "num_eval_timestamps": 40,
18
- "manifest_version": 1
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rel-f1/tasks/driver-dnf/manifest.yaml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: driver-dnf
2
+ kind: forecast
3
+ task_type: binary_classification
4
+ description: Predict the if each driver will DNF (not finish) a race in the next 1 month.
5
+ entity_table: drivers
6
+ entity_col: driverId
7
+ target_col: did_not_finish
8
+ time_col: date
9
+ timedelta: 30 days
10
+ num_eval_timestamps: 40
11
+ sql: |-
12
+ SELECT
13
+ t.timestamp as date,
14
+ re.driverId as driverId,
15
+ MAX(CASE WHEN re.statusId != 1 THEN 1 ELSE 0 END) AS did_not_finish
16
+ FROM
17
+ timestamps t
18
+ LEFT JOIN
19
+ results re
20
+ ON
21
+ re.date <= t.timestamp + INTERVAL '{timedelta}'
22
+ and re.date > t.timestamp
23
+ WHERE
24
+ re.driverId IN (
25
+ SELECT DISTINCT driverId
26
+ FROM results
27
+ WHERE date > t.timestamp - INTERVAL '1 year'
28
+ )
29
+ GROUP BY t.timestamp, re.driverId
30
+ manifest_version: 1
rel-f1/tasks/driver-position/manifest.json DELETED
@@ -1,18 +0,0 @@
1
- {
2
- "name": "driver-position",
3
- "kind": "forecast",
4
- "task_type": "regression",
5
- "entity_table": "drivers",
6
- "entity_col": "driverId",
7
- "target_col": "position",
8
- "time_col": "date",
9
- "timedelta": "60 days",
10
- "metrics": [
11
- "r2",
12
- "mae",
13
- "rmse"
14
- ],
15
- "sql": "SELECT\n t.timestamp as date,\n re.driverId as driverId,\n mean(re.positionOrder) as position,\nFROM\n timestamps t\nLEFT JOIN\n results re\nON\n re.date <= t.timestamp + INTERVAL '{timedelta}'\n and re.date > t.timestamp\nWHERE\n re.driverId IN (\n SELECT DISTINCT driverId\n FROM results\n WHERE date > t.timestamp - INTERVAL '1 year'\n )\nGROUP BY t.timestamp, re.driverId",
16
- "num_eval_timestamps": 40,
17
- "manifest_version": 1
18
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rel-f1/tasks/driver-position/manifest.yaml ADDED
@@ -0,0 +1,30 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: driver-position
2
+ kind: forecast
3
+ task_type: regression
4
+ description: Predict the average finishing position of each driver all races in the next 2 months.
5
+ entity_table: drivers
6
+ entity_col: driverId
7
+ target_col: position
8
+ time_col: date
9
+ timedelta: 60 days
10
+ num_eval_timestamps: 40
11
+ sql: |-
12
+ SELECT
13
+ t.timestamp as date,
14
+ re.driverId as driverId,
15
+ mean(re.positionOrder) as position,
16
+ FROM
17
+ timestamps t
18
+ LEFT JOIN
19
+ results re
20
+ ON
21
+ re.date <= t.timestamp + INTERVAL '{timedelta}'
22
+ and re.date > t.timestamp
23
+ WHERE
24
+ re.driverId IN (
25
+ SELECT DISTINCT driverId
26
+ FROM results
27
+ WHERE date > t.timestamp - INTERVAL '1 year'
28
+ )
29
+ GROUP BY t.timestamp, re.driverId
30
+ manifest_version: 1
rel-f1/tasks/driver-top3/manifest.json DELETED
@@ -1,19 +0,0 @@
1
- {
2
- "name": "driver-top3",
3
- "kind": "forecast",
4
- "task_type": "binary_classification",
5
- "entity_table": "drivers",
6
- "entity_col": "driverId",
7
- "target_col": "qualifying",
8
- "time_col": "date",
9
- "timedelta": "30 days",
10
- "metrics": [
11
- "average_precision",
12
- "accuracy",
13
- "f1",
14
- "roc_auc"
15
- ],
16
- "sql": "SELECT\n t.timestamp as date,\n qu.driverId as driverId,\n CAST(\n CASE WHEN MIN(qu.position) <= 3 THEN 1 ELSE 0 END AS BIGINT\n ) AS qualifying\nFROM\n timestamps t\nLEFT JOIN\n qualifying qu\nON\n qu.date <= t.timestamp + INTERVAL '{timedelta}'\n and qu.date > t.timestamp\nWHERE\n qu.driverId IN (\n SELECT DISTINCT driverId\n FROM qualifying\n WHERE date > t.timestamp - INTERVAL '1 year'\n )\nGROUP BY t.timestamp, qu.driverId",
17
- "num_eval_timestamps": 40,
18
- "manifest_version": 1
19
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rel-f1/tasks/driver-top3/manifest.yaml ADDED
@@ -0,0 +1,32 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: driver-top3
2
+ kind: forecast
3
+ task_type: binary_classification
4
+ description: Predict if each driver will qualify in the top-3 for a race within the next 1 month.
5
+ entity_table: drivers
6
+ entity_col: driverId
7
+ target_col: qualifying
8
+ time_col: date
9
+ timedelta: 30 days
10
+ num_eval_timestamps: 40
11
+ sql: |-
12
+ SELECT
13
+ t.timestamp as date,
14
+ qu.driverId as driverId,
15
+ CAST(
16
+ CASE WHEN MIN(qu.position) <= 3 THEN 1 ELSE 0 END AS BIGINT
17
+ ) AS qualifying
18
+ FROM
19
+ timestamps t
20
+ LEFT JOIN
21
+ qualifying qu
22
+ ON
23
+ qu.date <= t.timestamp + INTERVAL '{timedelta}'
24
+ and qu.date > t.timestamp
25
+ WHERE
26
+ qu.driverId IN (
27
+ SELECT DISTINCT driverId
28
+ FROM qualifying
29
+ WHERE date > t.timestamp - INTERVAL '1 year'
30
+ )
31
+ GROUP BY t.timestamp, qu.driverId
32
+ manifest_version: 1
rel-f1/tasks/qualifying-position/manifest.json DELETED
@@ -1,8 +0,0 @@
1
- {
2
- "name": "qualifying-position",
3
- "kind": "autocomplete",
4
- "task_type": "regression",
5
- "entity_table": "qualifying",
6
- "target_col": "position",
7
- "manifest_version": 1
8
- }
 
 
 
 
 
 
 
 
 
rel-f1/tasks/qualifying-position/manifest.yaml ADDED
@@ -0,0 +1,7 @@
 
 
 
 
 
 
 
 
1
+ name: qualifying-position
2
+ kind: autocomplete
3
+ task_type: regression
4
+ description: Predict the `position` column of the `qualifying` table.
5
+ entity_table: qualifying
6
+ target_col: position
7
+ manifest_version: 1
rel-f1/tasks/results-position/manifest.json DELETED
@@ -1,38 +0,0 @@
1
- {
2
- "name": "results-position",
3
- "kind": "autocomplete",
4
- "task_type": "regression",
5
- "entity_table": "results",
6
- "target_col": "position",
7
- "remove_columns": [
8
- [
9
- "results",
10
- "statusId"
11
- ],
12
- [
13
- "results",
14
- "positionOrder"
15
- ],
16
- [
17
- "results",
18
- "points"
19
- ],
20
- [
21
- "results",
22
- "laps"
23
- ],
24
- [
25
- "results",
26
- "milliseconds"
27
- ],
28
- [
29
- "results",
30
- "fastestLap"
31
- ],
32
- [
33
- "results",
34
- "rank"
35
- ]
36
- ],
37
- "manifest_version": 1
38
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
rel-f1/tasks/results-position/manifest.yaml ADDED
@@ -0,0 +1,22 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ name: results-position
2
+ kind: autocomplete
3
+ task_type: regression
4
+ description: Predict the `position` column of the `results` table.
5
+ entity_table: results
6
+ target_col: position
7
+ remove_columns:
8
+ - - results
9
+ - statusId
10
+ - - results
11
+ - positionOrder
12
+ - - results
13
+ - points
14
+ - - results
15
+ - laps
16
+ - - results
17
+ - milliseconds
18
+ - - results
19
+ - fastestLap
20
+ - - results
21
+ - rank
22
+ manifest_version: 1