cgtsf / README.md
wangdx25's picture
Add TsFile (converted from ChengsenWang/CGTSF)
012b018 verified
|
Raw History Blame Contribute Delete
3.77 kB
---
license: apache-2.0
task_categories:
- time-series-forecasting
size_categories:
- 10K<n<100K
tags:
- tsfile
- timeseries
- modality:timeseries
- format:tsfile
- multimodal-time-series
- context-guided-time-series-forecasting
- energy
- traffic
modality: timeseries
pretty_name: CGTSF Context-Guided Time Series Forecasting (TsFile format)
configs:
- config_name: leu
data_files:
- split: train
path: "cgtsf_leu.tsfile"
- config_name: mspg
data_files:
- split: train
path: "cgtsf_mspg.tsfile"
- config_name: ptf
data_files:
- split: train
path: "cgtsf_ptf.tsfile"
---
# CGTSF: Context-Guided Time Series Forecasting (TsFile format)
Apache TsFile version of [`ChengsenWang/CGTSF`](https://huggingface.co/datasets/ChengsenWang/CGTSF).
Modalities: Time-series.
## Overview
CGTSF addresses context-guided time-series forecasting by aligning numerical
history and prediction windows with textual background, weather, and date
information. The source provides three logically distinct multimodal domains:
London electricity usage (LEU), Melbourne solar power generation (MSPG), and
Paris traffic flow (PTF). The source card reports the following frequencies and
series counts:
| Config | Rows | Series | Frequency | Array widths (Hist / Pred) |
|---|---:|---:|---|---:|
| LEU | 11,616 | 16 | 30 minutes | 240 / 48 |
| MSPG | 10,557 | 27 | 15 minutes | 480 / 96 |
| PTF | 11,520 | 32 | 1 hour | 120 / 24 |
The three source files remain separate because their serialized array widths
are incompatible. The source card describes PTF as a 2012 traffic dataset,
while the observed source dates at this pinned revision are in 2022; the
conversion follows the source date values without changing them.
## Schema (TsFile structure)
Each config contains its own table with the same structural roles:
- **Time** (INT64, milliseconds) - the source target-day `Date` at UTC
midnight.
- **idx** (TAG, STRING) - `Idx`, identifying the source series/device.
- **hist_000 ... hist_N** (FIELD, DOUBLE) - the serialized `Hist` numeric
window expanded to scalar fields; `N` depends on the config.
- **pred_000 ... pred_N** (FIELD, DOUBLE) - the serialized `Pred` window
expanded to scalar fields; `N` depends on the config.
- **text** (FIELD, STRING) - the aligned textual context.
`Hist` and `Pred` are parsed with a safe literal/JSON parser and expanded
without changing their numeric values. The source `Date` is represented
losslessly by `Time`; no source row or semantic column is dropped.
## Usage
Install the Apache TsFile Python SDK (`pip install tsfile`) and read a converted file:
```python
from pathlib import Path
from tsfile import TsFileReader
path = Path("cgtsf_leu.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())
```
## Source & license
- **Original dataset:** https://huggingface.co/datasets/ChengsenWang/CGTSF
- **Source revision:** `f85b3fa3a8b3f1a2adbc6edf49f82b7d9d1758c9`
- **Author / publisher:** Chengsen Wang, Qi Qi, Jingyu Wang, Haifeng Sun, Zirui Zhuang, Jinming Wu, Lei Zhang, Jianxin Liao.
- **Paper:** https://arxiv.org/abs/2412.11376
- **License:** Apache-2.0.