rel-hm: YAML manifests + descriptions + schema card
Browse files- rel-hm/README.md +50 -0
- rel-hm/manifest.json +0 -26
- rel-hm/manifest.yaml +20 -0
- rel-hm/tasks/item-sales/manifest.json +0 -17
- rel-hm/tasks/item-sales/manifest.yaml +11 -0
- rel-hm/tasks/transactions-price/manifest.json +0 -9
- rel-hm/tasks/transactions-price/manifest.yaml +7 -0
- rel-hm/tasks/user-churn/manifest.json +0 -18
- rel-hm/tasks/user-churn/manifest.yaml +11 -0
- rel-hm/tasks/user-item-purchase/manifest.json +0 -20
- rel-hm/tasks/user-item-purchase/manifest.yaml +14 -0
rel-hm/README.md
ADDED
|
@@ -0,0 +1,50 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
---
|
| 2 |
+
tags:
|
| 3 |
+
- relbench
|
| 4 |
+
- relational-deep-learning
|
| 5 |
+
pretty_name: rel-hm
|
| 6 |
+
---
|
| 7 |
+
|
| 8 |
+
# rel-hm
|
| 9 |
+
|
| 10 |
+
H&M e-commerce: customers, articles, and time-stamped purchase transactions.
|
| 11 |
+
|
| 12 |
+
## Schema
|
| 13 |
+
|
| 14 |
+
```mermaid
|
| 15 |
+
erDiagram
|
| 16 |
+
transactions {
|
| 17 |
+
key customer_id FK
|
| 18 |
+
key article_id FK
|
| 19 |
+
datetime t_dat
|
| 20 |
+
}
|
| 21 |
+
article {
|
| 22 |
+
key article_id PK
|
| 23 |
+
}
|
| 24 |
+
customer {
|
| 25 |
+
key customer_id PK
|
| 26 |
+
}
|
| 27 |
+
transactions }o--|| customer : customer_id
|
| 28 |
+
transactions }o--|| article : article_id
|
| 29 |
+
```
|
| 30 |
+
|
| 31 |
+
Splits: validation `2020-09-07`, test `2020-09-14` (rows up to a split's timestamp are the inputs for that split).
|
| 32 |
+
|
| 33 |
+
## Tasks
|
| 34 |
+
|
| 35 |
+
| task | kind | type | description |
|
| 36 |
+
|---|---|---|---|
|
| 37 |
+
| `item-sales` | forecast | regression | Predict the total sales for an article (the sum of prices of the associated transactions) in the next week. |
|
| 38 |
+
| `transactions-price` | autocomplete | regression | Predict the `price` column of the `transactions` table. |
|
| 39 |
+
| `user-churn` | forecast | binary_classification | Predict the churn for a customer (no transactions) in the next week. |
|
| 40 |
+
| `user-item-purchase` | forecast | link_prediction | Predict the list of articles each customer will purchase in the next seven days. |
|
| 41 |
+
|
| 42 |
+
## Loading
|
| 43 |
+
|
| 44 |
+
```python
|
| 45 |
+
import relbench
|
| 46 |
+
ds = relbench.load_dataset("rel-hm")
|
| 47 |
+
task = relbench.load_task("rel-hm", "<task>")
|
| 48 |
+
```
|
| 49 |
+
|
| 50 |
+
Manifest layout (`manifest.yaml` + plain parquet); see the RelBench [CONTRIBUTING guide](https://github.com/snap-stanford/relbench/blob/main/CONTRIBUTING.md).
|
rel-hm/manifest.json
DELETED
|
@@ -1,26 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"name": "rel-hm",
|
| 3 |
-
"manifest_version": 1,
|
| 4 |
-
"val_timestamp": "2020-09-07",
|
| 5 |
-
"test_timestamp": "2020-09-14",
|
| 6 |
-
"tables": {
|
| 7 |
-
"transactions": {
|
| 8 |
-
"pkey": null,
|
| 9 |
-
"time_col": "t_dat",
|
| 10 |
-
"fkeys": {
|
| 11 |
-
"customer_id": "customer",
|
| 12 |
-
"article_id": "article"
|
| 13 |
-
}
|
| 14 |
-
},
|
| 15 |
-
"article": {
|
| 16 |
-
"pkey": "article_id",
|
| 17 |
-
"time_col": null,
|
| 18 |
-
"fkeys": {}
|
| 19 |
-
},
|
| 20 |
-
"customer": {
|
| 21 |
-
"pkey": "customer_id",
|
| 22 |
-
"time_col": null,
|
| 23 |
-
"fkeys": {}
|
| 24 |
-
}
|
| 25 |
-
}
|
| 26 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rel-hm/manifest.yaml
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: rel-hm
|
| 2 |
+
manifest_version: 1
|
| 3 |
+
description: 'H&M e-commerce: customers, articles, and time-stamped purchase transactions.'
|
| 4 |
+
val_timestamp: '2020-09-07'
|
| 5 |
+
test_timestamp: '2020-09-14'
|
| 6 |
+
tables:
|
| 7 |
+
transactions:
|
| 8 |
+
pkey: null
|
| 9 |
+
time_col: t_dat
|
| 10 |
+
fkeys:
|
| 11 |
+
customer_id: customer
|
| 12 |
+
article_id: article
|
| 13 |
+
article:
|
| 14 |
+
pkey: article_id
|
| 15 |
+
time_col: null
|
| 16 |
+
fkeys: {}
|
| 17 |
+
customer:
|
| 18 |
+
pkey: customer_id
|
| 19 |
+
time_col: null
|
| 20 |
+
fkeys: {}
|
rel-hm/tasks/item-sales/manifest.json
DELETED
|
@@ -1,17 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"name": "item-sales",
|
| 3 |
-
"kind": "forecast",
|
| 4 |
-
"task_type": "regression",
|
| 5 |
-
"entity_table": "article",
|
| 6 |
-
"entity_col": "article_id",
|
| 7 |
-
"target_col": "sales",
|
| 8 |
-
"time_col": "timestamp",
|
| 9 |
-
"timedelta": "7 days",
|
| 10 |
-
"metrics": [
|
| 11 |
-
"r2",
|
| 12 |
-
"mae",
|
| 13 |
-
"rmse"
|
| 14 |
-
],
|
| 15 |
-
"sql": "\n SELECT\n timestamp,\n article_id,\n sales\n FROM\n timestamps,\n article,\n (\n SELECT\n COALESCE(SUM(price), 0) as sales\n FROM\n transactions,\n WHERE\n transactions.article_id = article.article_id AND\n t_dat > timestamp AND\n t_dat <= timestamp + INTERVAL '{timedelta}'\n )\n ",
|
| 16 |
-
"manifest_version": 1
|
| 17 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rel-hm/tasks/item-sales/manifest.yaml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: item-sales
|
| 2 |
+
kind: forecast
|
| 3 |
+
task_type: regression
|
| 4 |
+
description: Predict the total sales for an article (the sum of prices of the associated transactions) in the next week.
|
| 5 |
+
entity_table: article
|
| 6 |
+
entity_col: article_id
|
| 7 |
+
target_col: sales
|
| 8 |
+
time_col: timestamp
|
| 9 |
+
timedelta: 7 days
|
| 10 |
+
sql: "\n SELECT\n timestamp,\n article_id,\n sales\n FROM\n timestamps,\n article,\n (\n SELECT\n COALESCE(SUM(price), 0) as sales\n FROM\n transactions,\n WHERE\n transactions.article_id = article.article_id AND\n t_dat > timestamp AND\n t_dat <= timestamp + INTERVAL '{timedelta}'\n )\n "
|
| 11 |
+
manifest_version: 1
|
rel-hm/tasks/transactions-price/manifest.json
DELETED
|
@@ -1,9 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"name": "transactions-price",
|
| 3 |
-
"kind": "autocomplete",
|
| 4 |
-
"task_type": "regression",
|
| 5 |
-
"entity_table": "transactions",
|
| 6 |
-
"target_col": "price",
|
| 7 |
-
"metrics": [],
|
| 8 |
-
"manifest_version": 1
|
| 9 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rel-hm/tasks/transactions-price/manifest.yaml
ADDED
|
@@ -0,0 +1,7 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: transactions-price
|
| 2 |
+
kind: autocomplete
|
| 3 |
+
task_type: regression
|
| 4 |
+
description: Predict the `price` column of the `transactions` table.
|
| 5 |
+
entity_table: transactions
|
| 6 |
+
target_col: price
|
| 7 |
+
manifest_version: 1
|
rel-hm/tasks/user-churn/manifest.json
DELETED
|
@@ -1,18 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"name": "user-churn",
|
| 3 |
-
"kind": "forecast",
|
| 4 |
-
"task_type": "binary_classification",
|
| 5 |
-
"entity_table": "customer",
|
| 6 |
-
"entity_col": "customer_id",
|
| 7 |
-
"target_col": "churn",
|
| 8 |
-
"time_col": "timestamp",
|
| 9 |
-
"timedelta": "7 days",
|
| 10 |
-
"metrics": [
|
| 11 |
-
"average_precision",
|
| 12 |
-
"accuracy",
|
| 13 |
-
"f1",
|
| 14 |
-
"roc_auc"
|
| 15 |
-
],
|
| 16 |
-
"sql": "\n SELECT\n timestamp,\n customer_id,\n CAST(\n NOT EXISTS (\n SELECT 1\n FROM transactions\n WHERE\n transactions.customer_id = customer.customer_id AND\n t_dat > timestamp AND\n t_dat <= timestamp + INTERVAL '{timedelta}'\n ) AS INTEGER\n ) AS churn\n FROM\n timestamps,\n customer,\n WHERE\n EXISTS (\n SELECT 1\n FROM transactions\n WHERE\n transactions.customer_id = customer.customer_id AND\n t_dat > timestamp - INTERVAL '{timedelta}' AND\n t_dat <= timestamp\n )\n ",
|
| 17 |
-
"manifest_version": 1
|
| 18 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rel-hm/tasks/user-churn/manifest.yaml
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: user-churn
|
| 2 |
+
kind: forecast
|
| 3 |
+
task_type: binary_classification
|
| 4 |
+
description: Predict the churn for a customer (no transactions) in the next week.
|
| 5 |
+
entity_table: customer
|
| 6 |
+
entity_col: customer_id
|
| 7 |
+
target_col: churn
|
| 8 |
+
time_col: timestamp
|
| 9 |
+
timedelta: 7 days
|
| 10 |
+
sql: "\n SELECT\n timestamp,\n customer_id,\n CAST(\n NOT EXISTS (\n SELECT 1\n FROM transactions\n WHERE\n transactions.customer_id = customer.customer_id AND\n t_dat > timestamp AND\n t_dat <= timestamp + INTERVAL '{timedelta}'\n ) AS INTEGER\n ) AS churn\n FROM\n timestamps,\n customer,\n WHERE\n EXISTS (\n SELECT 1\n FROM transactions\n WHERE\n transactions.customer_id = customer.customer_id AND\n t_dat > timestamp - INTERVAL '{timedelta}' AND\n t_dat <= timestamp\n )\n "
|
| 11 |
+
manifest_version: 1
|
rel-hm/tasks/user-item-purchase/manifest.json
DELETED
|
@@ -1,20 +0,0 @@
|
|
| 1 |
-
{
|
| 2 |
-
"name": "user-item-purchase",
|
| 3 |
-
"kind": "forecast",
|
| 4 |
-
"task_type": "link_prediction",
|
| 5 |
-
"target_col": "article_id",
|
| 6 |
-
"time_col": "timestamp",
|
| 7 |
-
"src_entity_table": "customer",
|
| 8 |
-
"src_entity_col": "customer_id",
|
| 9 |
-
"dst_entity_table": "article",
|
| 10 |
-
"dst_entity_col": "article_id",
|
| 11 |
-
"eval_k": 12,
|
| 12 |
-
"timedelta": "7 days",
|
| 13 |
-
"metrics": [
|
| 14 |
-
"link_prediction_precision",
|
| 15 |
-
"link_prediction_recall",
|
| 16 |
-
"link_prediction_map"
|
| 17 |
-
],
|
| 18 |
-
"sql": "\n SELECT\n t.timestamp,\n transactions.customer_id,\n LIST(DISTINCT transactions.article_id) AS article_id\n FROM\n timestamps t\n LEFT JOIN\n transactions\n ON\n transactions.t_dat > t.timestamp AND\n transactions.t_dat <= t.timestamp + INTERVAL '{timedelta}'\n GROUP BY\n t.timestamp,\n transactions.customer_id\n ",
|
| 19 |
-
"manifest_version": 1
|
| 20 |
-
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
rel-hm/tasks/user-item-purchase/manifest.yaml
ADDED
|
@@ -0,0 +1,14 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
name: user-item-purchase
|
| 2 |
+
kind: forecast
|
| 3 |
+
task_type: link_prediction
|
| 4 |
+
description: Predict the list of articles each customer will purchase in the next seven days.
|
| 5 |
+
target_col: article_id
|
| 6 |
+
time_col: timestamp
|
| 7 |
+
src_entity_table: customer
|
| 8 |
+
src_entity_col: customer_id
|
| 9 |
+
dst_entity_table: article
|
| 10 |
+
dst_entity_col: article_id
|
| 11 |
+
eval_k: 12
|
| 12 |
+
timedelta: 7 days
|
| 13 |
+
sql: "\n SELECT\n t.timestamp,\n transactions.customer_id,\n LIST(DISTINCT transactions.article_id) AS article_id\n FROM\n timestamps t\n LEFT JOIN\n transactions\n ON\n transactions.t_dat > t.timestamp AND\n transactions.t_dat <= t.timestamp + INTERVAL '{timedelta}'\n GROUP BY\n t.timestamp,\n transactions.customer_id\n "
|
| 14 |
+
manifest_version: 1
|