# Time-Series-Library **Repository Path**: smzy455/Time-Series-Library ## Basic Information - **Project Name**: Time-Series-Library - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: main - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2024-01-12 - **Last Updated**: 2024-04-03 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # Time Series Library (TSlib) TSlib is an open-source library for deep learning researchers, especially for deep time series analysis. TSlib是一个面向深度学习研究人员的开源库,特别是深度时间序列分析。 We provide a neat code base to evaluate advanced deep time series models or develop your model, which covers five mainstream tasks: **long- and short-term forecasting, imputation, anomaly detection, and classification.** 我们提供了一个简洁的代码库来评估先进的深度时间序列模型或开发您的模型,它涵盖了五个主流任务:长期和短期预测,imputation(数据填充或处理缺失值),异常检测和分类。 :triangular_flag_on_post:**News** (2023.10) We add an implementation to [iTransformer](https://arxiv.org/abs/2310.06625), which is the state-of-the-art model for long-term forecasting. The official code and complete scripts of iTransformer can be found [here](https://github.com/thuml/iTransformer). 我们向ittransformer添加了一个实现,它是用于长期预测的最先进的模型。ittransformer的官方代码和完整脚本可以在这里找到。 :triangular_flag_on_post:**News** (2023.09) We added a detailed [tutorial](https://github.com/thuml/Time-Series-Library/blob/main/tutorial/TimesNet_tutorial.ipynb) for [TimesNet](https://openreview.net/pdf?id=ju_Uqw384Oq) and this library, which is quite friendly to beginners of deep time series analysis. 我们为TimesNet和这个库添加了详细的教程,这对深度时间序列分析的初学者非常友好。 ## Leaderboard for Time Series Analysis Till October 2023, the top three models for five different tasks are: | Model
Ranking | Long-term
Forecasting | Short-term
Forecasting | Imputation | Classification | Anomaly
Detection | | ---------------- |---------------------------------------------------| ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -------------------------------------------------- | | 🥇 1st | [iTransformer](https://arxiv.org/abs/2310.06625) | [TimesNet](https://arxiv.org/abs/2210.02186) | [TimesNet](https://arxiv.org/abs/2210.02186) | [TimesNet](https://arxiv.org/abs/2210.02186) | [TimesNet](https://arxiv.org/abs/2210.02186) | | 🥈 2nd | [PatchTST](https://github.com/yuqinie98/PatchTST) | [Non-stationary
Transformer](https://github.com/thuml/Nonstationary_Transformers) | [Non-stationary
Transformer](https://github.com/thuml/Nonstationary_Transformers) | [Non-stationary
Transformer](https://github.com/thuml/Nonstationary_Transformers) | [FEDformer](https://github.com/MAZiqing/FEDformer) | | 🥉 3rd | [TimesNet](https://arxiv.org/abs/2210.02186) | [FEDformer](https://github.com/MAZiqing/FEDformer) | [Autoformer](https://github.com/thuml/Autoformer) | [Informer](https://github.com/zhouhaoyi/Informer2020) | [Autoformer](https://github.com/thuml/Autoformer) | **Note: We will keep updating this leaderboard.** If you have proposed advanced and awesome models, you can send us your paper/code link or raise a pull request. We will add them to this repo and update the leaderboard as soon as possible. 注:我们将继续更新这个排行榜。如果你提出了先进的和令人敬畏的模型,你可以给我们发送你的论文/代码链接或提出一个pull请求。我们将把它们添加到这个仓库,并尽快更新排行榜。 **Compared models of this leaderboard.** ☑ means that their codes have already been included in this repo. 比较这个排行榜的模型。☑意味着他们的代码已经包含在这个代码库。 - [x] **iTransformer** - iTransformer: Inverted Transformers Are Effective for Time Series Forecasting [[arXiv 2023]](https://arxiv.org/abs/2310.06625) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/iTransformer.py). - [x] **PatchTST** - A Time Series is Worth 64 Words: Long-term Forecasting with Transformers [[ICLR 2023]](https://openreview.net/pdf?id=Jbdc0vTOcol) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/PatchTST.py). - [x] **TimesNet** - TimesNet: Temporal 2D-Variation Modeling for General Time Series Analysis [[ICLR 2023]](https://openreview.net/pdf?id=ju_Uqw384Oq) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/TimesNet.py). - [x] **DLinear** - Are Transformers Effective for Time Series Forecasting? [[AAAI 2023]](https://arxiv.org/pdf/2205.13504.pdf) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/DLinear.py). - [x] **LightTS** - Less Is More: Fast Multivariate Time Series Forecasting with Light Sampling-oriented MLP Structures [[arXiv 2022]](https://arxiv.org/abs/2207.01186) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/LightTS.py). - [x] **ETSformer** - ETSformer: Exponential Smoothing Transformers for Time-series Forecasting [[arXiv 2022]](https://arxiv.org/abs/2202.01381) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/ETSformer.py). - [x] **Non-stationary Transformer** - Non-stationary Transformers: Exploring the Stationarity in Time Series Forecasting [[NeurIPS 2022]](https://openreview.net/pdf?id=ucNDIDRNjjv) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/Nonstationary_Transformer.py). - [x] **FEDformer** - FEDformer: Frequency Enhanced Decomposed Transformer for Long-term Series Forecasting [[ICML 2022]](https://proceedings.mlr.press/v162/zhou22g.html) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/FEDformer.py). - [x] **Pyraformer** - Pyraformer: Low-complexity Pyramidal Attention for Long-range Time Series Modeling and Forecasting [[ICLR 2022]](https://openreview.net/pdf?id=0EXmFzUn5I) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/Pyraformer.py). - [x] **Autoformer** - Autoformer: Decomposition Transformers with Auto-Correlation for Long-Term Series Forecasting [[NeurIPS 2021]](https://openreview.net/pdf?id=I55UqU-M11y) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/Autoformer.py). - [x] **Informer** - Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting [[AAAI 2021]](https://ojs.aaai.org/index.php/AAAI/article/view/17325/17132) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/Informer.py). - [x] **Reformer** - Reformer: The Efficient Transformer [[ICLR 2020]](https://openreview.net/forum?id=rkgNKkHtvB) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/Reformer.py). - [x] **Transformer** - Attention is All You Need [[NeurIPS 2017]](https://proceedings.neurips.cc/paper/2017/file/3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/Transformer.py). See our latest paper [[TimesNet]](https://arxiv.org/abs/2210.02186) for the comprehensive benchmark. We will release a real-time updated online version soon. **Newly added baselines.** We will add them to the leaderboard after a comprehensive evaluation. - [x] **Koopa** - Koopa: Learning Non-stationary Time Series Dynamics with Koopman Predictors [[NeurIPS 2023]](https://arxiv.org/pdf/2305.18803.pdf) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/Koopa.py). - [x] **FreTS** - Frequency-domain MLPs are More Effective Learners in Time Series Forecasting [[NeurIPS 2023]](https://arxiv.org/pdf/2311.06184.pdf) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/FreTS.py). - [x] **TiDE** - Long-term Forecasting with TiDE: Time-series Dense Encoder [[arXiv 2023]](https://arxiv.org/pdf/2304.08424.pdf) [[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/TiDE.py). - [x] **FiLM** - FiLM: Frequency improved Legendre Memory Model for Long-term Time Series Forecasting [[NeurIPS 2022]](https://openreview.net/forum?id=zTQdHSQUQWc)[[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/FiLM.py). - [x] **MICN** - MICN: Multi-scale Local and Global Context Modeling for Long-term Series Forecasting [[ICLR 2023]](https://openreview.net/pdf?id=zt53IDUR1U)[[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/MICN.py). - [x] **Crossformer** - Crossformer: Transformer Utilizing Cross-Dimension Dependency for Multivariate Time Series Forecasting [[ICLR 2023]](https://openreview.net/pdf?id=vSVLM2j9eie)[[Code]](https://github.com/thuml/Time-Series-Library/blob/main/models/Crossformer.py). ## Usage 1. Install Python 3.8. For convenience, execute the following command. ``` pip install -r requirements.txt ``` 2. Prepare Data. You can obtain the well pre-processed datasets from [[Google Drive]](https://drive.google.com/drive/folders/13Cg1KYOlzM5C7K8gK8NfC-F3EYxkM3D2?usp=sharing) or [[Baidu Drive]](https://pan.baidu.com/s/1r3KhGd0Q9PJIUZdfEYoymg?pwd=i9iy), Then place the downloaded data in the folder`./dataset`. Here is a summary of supported datasets.

3. Train and evaluate model. We provide the experiment scripts for all benchmarks under the folder `./scripts/`. You can reproduce the experiment results as the following examples: ``` # long-term forecast bash ./scripts/long_term_forecast/ETT_script/TimesNet_ETTh1.sh # short-term forecast bash ./scripts/short_term_forecast/TimesNet_M4.sh # imputation bash ./scripts/imputation/ETT_script/TimesNet_ETTh1.sh # anomaly detection bash ./scripts/anomaly_detection/PSM/TimesNet.sh # classification bash ./scripts/classification/TimesNet.sh ``` 4. Develop your own model. - Add the model file to the folder `./models`. You can follow the `./models/Transformer.py`. - Include the newly added model in the `Exp_Basic.model_dict` of `./exp/exp_basic.py`. - Create the corresponding scripts under the folder `./scripts`. ## Citation If you find this repo useful, please cite our paper. ``` @inproceedings{wu2023timesnet, title={TimesNet: Temporal 2D-Variation Modeling for General Time Series Analysis}, author={Haixu Wu and Tengge Hu and Yong Liu and Hang Zhou and Jianmin Wang and Mingsheng Long}, booktitle={International Conference on Learning Representations}, year={2023}, } ``` ## Contact If you have any questions or suggestions, feel free to contact: - Haixu Wu (wuhx23@mails.tsinghua.edu.cn) - Tengge Hu (htg21@mails.tsinghua.edu.cn) - Haoran Zhang (z-hr20@mails.tsinghua.edu.cn) - Jiawei Guo (guo-jw21@mails.tsinghua.edu.cn) Or describe it in Issues. ## Acknowledgement This project is supported by the National Key R&D Program of China (2021YFB1715200). This library is constructed based on the following repos: - Forecasting: https://github.com/thuml/Autoformer. - Anomaly Detection: https://github.com/thuml/Anomaly-Transformer. - Classification: https://github.com/thuml/Flowformer. All the experiment datasets are public, and we obtain them from the following links: - Long-term Forecasting and Imputation: https://github.com/thuml/Autoformer. - Short-term Forecasting: https://github.com/ServiceNow/N-BEATS. - Anomaly Detection: https://github.com/thuml/Anomaly-Transformer. - Classification: https://www.timeseriesclassification.com/. ## All Thanks To Our Contributors