The Dataset Viewer has been disabled on this dataset.

PEMS-BAY Traffic Dataset TsFile

This repository contains a TsFile conversion of the Hugging Face dataset witgaw/PEMS-BAY.

PEMS-BAY is a traffic forecasting dataset derived from the DCRNN benchmark. The source data uses chronological train/validation/test splits, includes 325 Bay Area traffic sensors, and has 5-minute temporal resolution. Each row contains a sensor id, a reference timestamp, 12 historical input steps, and 12 future target steps.

Converted Files

Split TsFile path TsFile files Source Parquet Rows Sensors First reference time Last reference time
train pems_bay_train_*.tsfile 48 train.parquet 11,851,125 325 2017-01-01T00:55:00 2017-05-07T16:35:00
validation pems_bay_validation_*.tsfile 7 val.parquet 1,692,925 325 2017-05-07T16:40:00 2017-05-25T18:40:00
test pems_bay_test_*.tsfile 14 test.parquet 3,386,175 325 2017-05-25T18:45:00 2017-06-30T22:55:00

Total converted rows: 16,930,225. Each split has 48 FIELD columns and one TAG column (node_id). Static graph metadata from the source repository is preserved under sensor_graph/.

TsFile Schema

  • Time: parsed from source t0_timestamp as millisecond epoch time.
  • node_id: sensor identifier, stored as a TsFile TAG.
  • x_t_minus_11_d0 ... x_t_plus_0_d1: historical input features.
  • y_t_plus_1_d0 ... y_t_plus_12_d1: future target features.

Conversion Notes

  • Source t0_timestamp is not kept as a FIELD because it is losslessly encoded into Time.
  • Source node_id is converted from integer to string for TAG storage; values are unchanged.
  • Feature columns are preserved, but + and - in source names are normalized to _plus_ and _minus_ for TsFile schema compatibility. See column_mapping.csv for the full mapping.
  • Static sensor graph files (adj_mx.npy, adj_mx_mapping.json, distances.csv, sensor_locations.csv) are sidecar metadata and are not written into TsFile.
  • The original dataset README is included as SOURCE_DATASET_README.md.

Usage

Install the Apache TsFile Python SDK (pip install tsfile) and read a converted file:

from pathlib import Path
from tsfile import TsFileReader

path = Path("pems_bay_test_1.tsfile")
with TsFileReader(str(path)) as reader:
    schemas = reader.get_all_table_schemas()
    print("tables:", list(schemas))
    table_name = next(iter(schemas))
    table = schemas[table_name]
    columns = [column.get_column_name() for column in table.get_columns()]
    print("columns:", columns)
    field_names = [
        column.get_column_name()
        for column in table.get_columns()
        if column.get_column_name() not in {"Time", "time"}
    ]
    if field_names:
        with reader.query_table(table_name, field_names[:3], batch_size=1024) as result:
            batch = result.read_arrow_batch()
            if batch is not None:
                print(batch.to_pandas().head())

Citation

If you use this dataset, 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}
}
Downloads last month
1,529