Welcome to the official repository of: TimeMachine: A Time Series is Worth 4 Mambas for Long-term Forecasting.
🚩 TimeMachine is accepted to ECAI
-
Install requirements.
pip install -r requirements.txt
-
Navigate through our example scripts located at
./scripts/TimeMachine
. You'll find the core of TimeMachine inmodels/TimeMachine.py
. For example, to get the multivariate forecasting results for weather dataset, just run the following command, and you can open./result.txt
to see the results once the training is completed. Moreover, the results will also be available atcsv_results
, which can be utilized to make queries in the dataframe:
sh ./scripts/TimeMachine/weather.sh
Hyper-paramters can be tuned based upon needs (e.g. different look-back windows and prediction lengths). TimeMachine is built on the popular PatchTST framework.
We are deeply grateful for the valuable code and efforts contributed by the following GitHub repositories. Their contributions have been immensely beneficial to our work.
- Mamba (https://github.com/state-spaces/mamba)
- PatchTST (https://github.com/yuqinie98/PatchTST)
- iTransformer (https://github.com/thuml/iTransformer)
- RevIN (https://github.com/ts-kim/RevIN)
- Reformer (https://github.com/lucidrains/reformer-pytorch)
- Informer (https://github.com/zhouhaoyi/Informer2020)
- FlashAttention (https://github.com/shreyansh26/FlashAttention-PyTorch)
- Autoformer (https://github.com/thuml/Autoformer)
- Stationary (https://github.com/thuml/Nonstationary_Transformers)
- Time-Series-Library (https://github.com/thuml/Time-Series-Library)
If you find this repo useful in your research, please consider citing our paper as follows:
@article{timemachine,
title = {TimeMachine: A Time Series is Worth 4 Mambas for Long-term Forecasting},
author = {Ahamed, Md Atik and Cheng, Qiang},
journal = {arXiv preprint arXiv:2403.09898},
year = {2024}
}