PEMS-BAY Traffic Dataset (TsFile)
This repository contains a TsFile conversion of
witgaw/PEMS-BAY, a
Hugging Face packaging of the PEMS-BAY traffic forecasting dataset derived from
the DCRNN benchmark.
PEMS-BAY is used for traffic time-series forecasting, especially with graph neural networks such as Diffusion Convolutional Recurrent Neural Networks (DCRNN). The source dataset contains traffic flow sequences for 325 Bay Area traffic sensors, sampled at 5-minute intervals. Each sample keeps the chronological reference timestamp, 12 historical input steps, and 12 future target steps for a 1-hour prediction horizon.
Dataset Structure
The original dataset is distributed as Parquet files with chronological train/validation/test splits. This converted repository stores the same split structure as TsFile shards:
| Split | Source split | TsFile pattern | TsFile files | Rows | Sensors | Time range |
|---|---|---|---|---|---|---|
train |
train.parquet |
pems_bay_train_*.tsfile |
48 | 11,851,125 | 325 | 2017-01-01 00:55:00 to 2017-05-07 16:35:00 |
validation |
val.parquet |
pems_bay_validation_*.tsfile |
7 | 1,692,925 | 325 | 2017-05-07 16:40:00 to 2017-05-25 18:40:00 |
test |
test.parquet |
pems_bay_test_*.tsfile |
14 | 3,386,175 | 325 | 2017-05-25 18:45:00 to 2017-06-30 22:55:00 |
Total converted rows: 16,930,225. The temporal split policy follows the source dataset: the earliest 70% of samples are used for training, the next 10% for validation, and the latest 20% for testing, preserving chronological order to avoid data leakage. All splits include all 325 sensors.
Schema
The source columns are mapped to TsFile table columns as follows:
| Source column | TsFile role | Converted column |
|---|---|---|
t0_timestamp |
Time |
Parsed as millisecond epoch time |
node_id |
TAG | node_id, converted to string while preserving values 0-324 |
x_t-11_d0 ... x_t+0_d0 |
FIELD | Historical traffic-flow values |
x_t-11_d1 ... x_t+0_d1 |
FIELD | Historical normalized time-of-day features |
y_t+1_d0 ... y_t+12_d0 |
FIELD | Future traffic-flow targets |
y_t+1_d1 ... y_t+12_d1 |
FIELD | Future normalized time-of-day features |
The TsFile table names follow the shard split: pems_bay_train,
pems_bay_validation, and pems_bay_test.
Conversion Notes
- Only the converted
.tsfileshards are hosted in this repository. - The original Parquet files and the static
sensor_graph/files remain in the source dataset atwitgaw/PEMS-BAY. t0_timestampis encoded into the TsFileTimecolumn and is not duplicated as a FIELD.node_idis stored as a TsFile TAG so each sensor can be queried as a device dimension.- Source feature names containing
+or-are normalized for TsFile schema compatibility, for examplex_t-11_d0becomesx_t_minus_11_d0andy_t+12_d1becomesy_t_plus_12_d1. - The conversion preserves all 48 historical/input and future/target feature columns.
Usage
from tsfile import ColumnCategory, TsFileReader
reader = TsFileReader("pems_bay_train_1.tsfile")
schemas = reader.get_all_table_schemas()
table = "pems_bay_train"
columns = [
column.get_column_name()
for column in schemas[table].get_columns()
if column.get_category() in (ColumnCategory.TAG, ColumnCategory.FIELD)
]
with reader.query_table(table, columns, batch_size=65536) as result:
batch = result.read_arrow_batch()
print(batch.to_pandas().head())
Source Dataset
- Original Hugging Face dataset:
witgaw/PEMS-BAY - Dataset generation code referenced by the source card:
witgaw/DCRNN - Original DCRNN repository/license:
liyaguang/DCRNN
The source sensor graph metadata includes sensor coordinates, pairwise distances, a 325 x 325 precomputed adjacency matrix, and adjacency-generation metadata for graph neural network experiments.
Citation
If you use this dataset, please cite the original DCRNN paper:
@inproceedings{li2018dcrnn_traffic,
title={{Diffusion Convolutional Recurrent Neural Network: Data-Driven Traffic Forecasting}},
author={{Li, Yaguang and Yu, Rose and Shahabi, Cyrus and Liu, Yan}},
booktitle={{International Conference on Learning Representations}},
year={{2018}}
}
License
This converted dataset follows the source dataset license: MIT.
- Downloads last month
- 1,270