DSOF (ICLR 2025)
March 1, 2025 ยท View on GitHub
This is the official repository for the ICLR 2025 Conference Paper - Fast and Slow Streams for Online Time Series Forecasting without Information Leakage.
Table of Contents
- Introduction
- Requirements / Installation
- Basic Program Structure
- Running the Program
- Acknowledgements / References
- Contact
- Citation
Introduction
Current research in online time series forecasting (OTSF) faces two significant issues:
- Information leakage. Models make predictions and are then evaluated on historical time steps that have already been used in backpropagation for parameter updates.
- Practicality. While forecasting in real-world applications typically emphasizes looking ahead and anticipating future uncertainties, prediction sequences in this setting include only one future step with the remaining being observed time points.
This prompts a redefinition of the OTSF setting:
This new setting gives rise to challenges:
- Leveraging incomplete pairs of ground truth and predictions for backpropagation
- Avoid model overfitting to noise from recent data streams
To address these challenges, we propose a novel dual-stream framework for online forecasting (DSOF):
- Slow stream: updates with complete data using experience replay
- Fast stream: adapts to recent data through temporal difference learning.
Key Experimental results:
Requirements / Installation
This code is written in Python 3.8.0 on Linux (AlmaLinux 9.5). To install the required packages, run the following commands:
# create a virtual environment
python -m venv venv
# activate the virtual environment
source venv/bin/activate
# install the required packages
pip install -r requirements.txt
Basic Program Structure
-
config: YAML files that store the configurations for the programdata: stores the feature dimensions for datasetsmodel: configurations for the models (e.g., hidden layers, dropout rates, activation functions)optimizer: three main categories of optimizersbatch_learning: for batch learning modew_student: for online learning mode with a student model- subfolders named
<teacherModel>_<studentModel>(e.g.,DLinear_MLP)
- subfolders named
wo_student: for online learning mode without a student model
trainer: configurations for training schemesw_student: with a student modelwo_student: without a student model (includes batch learning)
-
datasets: stores datasets in CSV format -
exps: stores experiment results- Example: Using
DLinearas the teacher model,MLPas the student model, andw_student/residual/dsofas the training scheme, running onElectricityandETTh2datasets with prediction lengths1,24, and48, starting on March 1, 2025, at 9:30:45 AM, with two iterations. After runningpython run_main.py, the following files are generated:exps |--DLinear-MLP-w_student |--DLinear--MLP--w_student_residual_dsof |--Electricity_pl1 |--20250301-093045 |--itr0 |--checkpoints |--results |--mae.npy |--metrics.npy |--mse.npy |--preds.npy |--true.npy |--itr1 hparams.yaml |--Electricity_pl24 |--Electricity_pl48 |--ETTh2_pl1 |--ETTh2_pl24 |--ETTh2_pl48 ```
- Example: Using
-
logs: stores experiment logs ifuse_nohup = True, with a similar structure toexps -
images: stores images used in this README file -
misc: includes supporting files forrun_main.pyand file management utilities forexpsandlogs -
src: contains the source codesrc/data: data processingsrc/model: model definitionssrc/trainers: training schemessrc/utils: utility functionssrc/main.py: main program
-
run_main.py: driver program to runmain.pywith different configurations, including a queuing mechanism to avoid GPU overload
Running the Program
-
Download datasets to the
datasetsdirectory: follow the instructions of this repository. Then configure the dataset paths inconfig/data/*.yamlfiles. -
Replace the variable
hex2dec_busmapwith a dictionary in the formathostname: {bus-id: gpu-id}. It is located in the methoddef pid_gpu_cmd_mapping()inmisc/runnerbase.py. The mapping ofbus-idtogpu-idcan be found by running the commandnvidia-smiin the terminal. -
Configure options in
run_main.py. These options override the default configurations inconfig/files.-
nohup: Run experiments in the background. Setuse_nohup = Falseto show logs in the terminal. -
gpus: Allocate GPU resources. For example,"Electricity": 3uses GPU 3 for the Electricity dataset.gpus = { "Electricity": 3, "ETTh2": 3, "ETTm1": 4, "Traffic": 4, "Exchange": 4, "Weather": 4, "others": 4, } -
pred_lens: List of prediction lengths. For example,pred_lens = [1, 24, 48]. -
itr: Number of iterations for each experiment. For example,itr = 2runs each experiment twice. -
datasets: List of datasets to run experiments on. For example,datasets = ["Electricity", ETTh2"]. Available choices:ElectricityETTh2ETTm1ExchangeTrafficWeather
-
main_model: Teacher model for training.student_model: Student model for training. Available choices:DLinearFITSFSNetOneNetiTransformerPatchTSTNSTransformerMLP(only for student model)None(only for student model, indicates no student model used)
-
opt: Optimizer used for training. Available choices:batch_learning: For batch learning modew_student: For online learning mode with a student modelwo_student: For online learning mode without a student model
-
trainer: Training scheme used for training. Available choices match the filenames inconfig/trainer/. The DSOF method proposed in the paper corresponds to the optionw_student/residual/dsof.
-
Acknowledgements / References
This repository is based on code/datasets from the following repositories:
Contact
Authors:
Code issues:
- Submit an issue in the repository
- Email yyalau@connect.ust.hk
Citation
If you find this repo useful in your research, please consider citing our paper:
@inproceedings{
lau2025dsof,
title={Fast and Slow Streams for Online Time Series Forecasting Without Information Leakage},
author={Ying-yee Ava Lau and Zhiwen Shao and Dit-Yan Yeung},
booktitle={The Thirteenth International Conference on Learning Representations},
year={2025},
url={https://openreview.net/forum?id=I0n3EyogMi}
}