[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-9696":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":10,"language":11,"languages":10,"totalLinesOfCode":10,"stars":12,"forks":13,"watchers":14,"openIssues":15,"contributorsCount":16,"subscribersCount":16,"size":16,"stars1d":17,"stars7d":18,"stars30d":19,"stars90d":16,"forks30d":16,"starsTrendScore":20,"compositeScore":21,"rankGlobal":10,"rankLanguage":10,"license":22,"archived":23,"fork":23,"defaultBranch":24,"hasWiki":25,"hasPages":23,"topics":26,"createdAt":10,"pushedAt":10,"updatedAt":30,"readmeContent":31,"aiSummary":32,"trendingCount":16,"starSnapshotCount":16,"syncStatus":33,"lastSyncTime":34,"discoverSource":35},9696,"Time-Series-Library","thuml\u002FTime-Series-Library","thuml","A Library for Advanced Deep Time Series Models for General Time Series Analysis.","",null,"Python",12426,1954,101,26,0,7,44,196,40,44.87,"MIT License",false,"main",true,[27,28,29],"deep-learning","time-series","time-series-analysis","2026-06-12 02:02:11","# Time Series Library (TSLib)\nTSLib is an open-source library for deep learning researchers, especially for deep time series analysis.\n\n> **中文文档**：[README_zh.md](.\u002FREADME_zh.md)\n\nWe 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.**\n\n:triangular_flag_on_post:**News** (2026.04) Due to the limited bandwidth of the current maintainers, we will not be actively adding new features to this library. Since the library was originally released three years ago, many of its benchmarks may no longer be meaningful for evaluating the effectiveness or progress of current research. However, the baseline implementations remain correct. We therefore recommend seeking out newer benchmarks.\n\n:triangular_flag_on_post:**News** (2025.12) Many thanks to the great work from [ailuntz](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fpull\u002F805), which provides an updated requirements and docker deployment, as well as a well-organized document. This is quite meaningful to this project and beginners.\n\n:triangular_flag_on_post:**News** (2025.11) Considering the rapid development of Large Time Series Models (LTSMs), we have newly added a [[zero-shot forecasting]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fexp\u002Fexp_zero_shot_forecasting.py) feature in TSLib. You can try [this script](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fscripts\u002Flong_term_forecast\u002FETT_script\u002FLTSM.sh) to evaluate LTSMs.\n\n:triangular_flag_on_post:**News** (2025.10) Given the recent confusion among researchers regarding minor improvements on standard benchmarks, we propose the [[Accuracy Law]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2510.02729) to characterize the objectives of deep time series forecasting tasks, which can be used to identify saturated datasets.\n\n:triangular_flag_on_post:**News** (2024.10) We have included [[TimeXer]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.19072), which defined a practical forecasting paradigm: Forecasting with Exogenous Variables. Considering both practicability and computation efficiency, we believe the new forecasting paradigm defined in TimeXer can be the \"right\" task for future research.\n\n:triangular_flag_on_post:**News** (2024.10) Our lab has open-sourced [[OpenLTM]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FOpenLTM), which provides a distinct pretrain-finetuning paradigm compared to TSLib. If you are interested in Large Time Series Models, you may find this repository helpful.\n\n:triangular_flag_on_post:**News** (2024.07) We wrote a comprehensive survey of [[Deep Time Series Models]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2407.13278) with a rigorous benchmark based on TSLib. In this paper, we summarized the design principles of current time series models supported by insightful experiments, hoping to be helpful to future research.\n\n:triangular_flag_on_post:**News** (2024.04) Many thanks for the great work from [frecklebars](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fpull\u002F378). The famous sequential model [Mamba](https:\u002F\u002Farxiv.org\u002Fabs\u002F2312.00752) has been included in our library. See [this file](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FMamba.py), where you need to install `mamba_ssm` with pip at first.\n\n:triangular_flag_on_post:**News** (2024.03) Given the inconsistent look-back length of various papers, we split the long-term forecasting in the leaderboard into two categories: Look-Back-96 and Look-Back-Searching. We recommend researchers read [TimeMixer](https:\u002F\u002Fopenreview.net\u002Fpdf?id=7oLshfEIC2), which includes both look-back length settings in experiments for scientific rigor.\n\n:triangular_flag_on_post:**News** (2023.10) We add an implementation to [iTransformer](https:\u002F\u002Farxiv.org\u002Fabs\u002F2310.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:\u002F\u002Fgithub.com\u002Fthuml\u002FiTransformer).\n\n:triangular_flag_on_post:**News** (2023.09) We added a detailed [tutorial](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Ftutorial\u002FTimesNet_tutorial.ipynb) for [TimesNet](https:\u002F\u002Fopenreview.net\u002Fpdf?id=ju_Uqw384Oq) and this library, which is quite friendly to beginners of deep time series analysis.\n\n:triangular_flag_on_post:**News** (2023.02) We release the TSlib as a comprehensive benchmark and code base for time series models, which is extended from our previous GitHub repository [Autoformer](https:\u002F\u002Fgithub.com\u002Fthuml\u002FAutoformer).\n\n## Leaderboard for Time Series Analysis\n\nTill March 2024, the top three models for five different tasks are:\n\n| Model\u003Cbr>Ranking | Long-term\u003Cbr>Forecasting\u003Cbr>Look-Back-96              | Long-term\u003Cbr\u002F>Forecasting\u003Cbr\u002F>Look-Back-Searching     | Short-term\u003Cbr>Forecasting                                    | Imputation                                                   | Classification                                               | Anomaly\u003Cbr>Detection                               |\n| ---------------- | ----------------------------------------------------- | ----------------------------------------------------- | ------------------------------------------------------------ | ------------------------------------------------------------ | ------------------------------------------------------------ | -------------------------------------------------- |\n| 🥇 1st            | [TimeXer](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.19072)      | [TimeMixer](https:\u002F\u002Fopenreview.net\u002Fpdf?id=7oLshfEIC2) | [TimesNet](https:\u002F\u002Farxiv.org\u002Fabs\u002F2210.02186)                 | [TimesNet](https:\u002F\u002Farxiv.org\u002Fabs\u002F2210.02186)                 | [TimesNet](https:\u002F\u002Farxiv.org\u002Fabs\u002F2210.02186)                 | [TimesNet](https:\u002F\u002Farxiv.org\u002Fabs\u002F2210.02186)       |\n| 🥈 2nd            | [iTransformer](https:\u002F\u002Farxiv.org\u002Fabs\u002F2310.06625) | [PatchTST](https:\u002F\u002Fgithub.com\u002Fyuqinie98\u002FPatchTST)     | [Non-stationary\u003Cbr\u002F>Transformer](https:\u002F\u002Fgithub.com\u002Fthuml\u002FNonstationary_Transformers) | [Non-stationary\u003Cbr\u002F>Transformer](https:\u002F\u002Fgithub.com\u002Fthuml\u002FNonstationary_Transformers) | [Non-stationary\u003Cbr\u002F>Transformer](https:\u002F\u002Fgithub.com\u002Fthuml\u002FNonstationary_Transformers) | [FEDformer](https:\u002F\u002Fgithub.com\u002FMAZiqing\u002FFEDformer) |\n| 🥉 3rd            | [TimeMixer](https:\u002F\u002Fopenreview.net\u002Fpdf?id=7oLshfEIC2)          | [DLinear](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2205.13504.pdf)       | [FEDformer](https:\u002F\u002Fgithub.com\u002FMAZiqing\u002FFEDformer)           | [Autoformer](https:\u002F\u002Fgithub.com\u002Fthuml\u002FAutoformer)            | [Informer](https:\u002F\u002Fgithub.com\u002Fzhouhaoyi\u002FInformer2020)        | [Autoformer](https:\u002F\u002Fgithub.com\u002Fthuml\u002FAutoformer)  |\n\n\n**Note: We will keep updating this leaderboard.** If you have proposed advanced and awesome models, you can send us your paper\u002Fcode link or raise a pull request. We will add them to this repo and update the leaderboard as soon as possible.\n\n**Compared models of this leaderboard.** ☑ means that their codes have already been included in this repo.\n  - [x] **TimeXer** - TimeXer: Empowering Transformers for Time Series Forecasting with Exogenous Variables [[NeurIPS 2024]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2402.19072) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FTimeXer.py)\n  - [x] **TimeMixer** - TimeMixer: Decomposable Multiscale Mixing for Time Series Forecasting [[ICLR 2024]](https:\u002F\u002Fopenreview.net\u002Fpdf?id=7oLshfEIC2) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FTimeMixer.py).\n  - [x] **TSMixer** - TSMixer: An All-MLP Architecture for Time Series Forecasting [[arXiv 2023]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2303.06053.pdf) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FTSMixer.py)\n  - [x] **iTransformer** - iTransformer: Inverted Transformers Are Effective for Time Series Forecasting [[ICLR 2024]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2310.06625) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FiTransformer.py).\n  - [x] **PatchTST** - A Time Series is Worth 64 Words: Long-term Forecasting with Transformers [[ICLR 2023]](https:\u002F\u002Fopenreview.net\u002Fpdf?id=Jbdc0vTOcol) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FPatchTST.py).\n  - [x] **TimesNet** - TimesNet: Temporal 2D-Variation Modeling for General Time Series Analysis [[ICLR 2023]](https:\u002F\u002Fopenreview.net\u002Fpdf?id=ju_Uqw384Oq) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FTimesNet.py).\n  - [x] **DLinear** - Are Transformers Effective for Time Series Forecasting? [[AAAI 2023]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2205.13504.pdf) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FDLinear.py).\n  - [x] **LightTS** - Less Is More: Fast Multivariate Time Series Forecasting with Light Sampling-oriented MLP Structures [[arXiv 2022]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2207.01186) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FLightTS.py).\n  - [x] **ETSformer** - ETSformer: Exponential Smoothing Transformers for Time-series Forecasting [[arXiv 2022]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2202.01381) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FETSformer.py).\n  - [x] **Non-stationary Transformer** - Non-stationary Transformers: Exploring the Stationarity in Time Series Forecasting [[NeurIPS 2022]](https:\u002F\u002Fopenreview.net\u002Fpdf?id=ucNDIDRNjjv) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FNonstationary_Transformer.py).\n  - [x] **FEDformer** - FEDformer: Frequency Enhanced Decomposed Transformer for Long-term Series Forecasting [[ICML 2022]](https:\u002F\u002Fproceedings.mlr.press\u002Fv162\u002Fzhou22g.html) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FFEDformer.py).\n  - [x] **Pyraformer** - Pyraformer: Low-complexity Pyramidal Attention for Long-range Time Series Modeling and Forecasting [[ICLR 2022]](https:\u002F\u002Fopenreview.net\u002Fpdf?id=0EXmFzUn5I) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FPyraformer.py).\n  - [x] **Autoformer** - Autoformer: Decomposition Transformers with Auto-Correlation for Long-Term Series Forecasting [[NeurIPS 2021]](https:\u002F\u002Fopenreview.net\u002Fpdf?id=I55UqU-M11y) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FAutoformer.py).\n  - [x] **Informer** - Informer: Beyond Efficient Transformer for Long Sequence Time-Series Forecasting [[AAAI 2021]](https:\u002F\u002Fojs.aaai.org\u002Findex.php\u002FAAAI\u002Farticle\u002Fview\u002F17325\u002F17132) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FInformer.py).\n  - [x] **Reformer** - Reformer: The Efficient Transformer [[ICLR 2020]](https:\u002F\u002Fopenreview.net\u002Fforum?id=rkgNKkHtvB) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FReformer.py).\n  - [x] **Transformer** - Attention is All You Need [[NeurIPS 2017]](https:\u002F\u002Fproceedings.neurips.cc\u002Fpaper\u002F2017\u002Ffile\u002F3f5ee243547dee91fbd053c1c4a845aa-Paper.pdf) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FTransformer.py).\n\nSee our latest paper [[TimesNet]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2210.02186) for the comprehensive benchmark. We will release a real-time updated online version soon.\n\n**Newly added baselines.** We will add them to the leaderboard after a comprehensive evaluation.\n  - [x] **MambaSL** - MambaSL: Exploring Single-Layer Mamba for Time Series Classification [[ICLR 2026]](https:\u002F\u002Fopenreview.net\u002Fforum?id=YDl4vqQqGP) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FMambaSingleLayer.py)\n  - [x] **TimeFilter** - TimeFilter: Patch-Specific Spatial-Temporal Graph Filtration for Time Series Forecasting [[ICML 2025]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2501.13041) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FTimeFilter.py)\n  - [x] **KAN-AD** - KAN-AD: Time Series Anomaly Detection with Kolmogorov-Arnold Networks [[ICML 2025]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2411.00278) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FKANAD.py)\n  - [x] **MultiPatchFormer** - A multiscale model for multivariate time series forecasting [[Scientific Reports 2025]](https:\u002F\u002Fwww.nature.com\u002Farticles\u002Fs41598-024-82417-4) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FMultiPatchFormer.py)\n  - [x] **WPMixer** - WPMixer: Efficient Multi-Resolution Mixing for Long-Term Time Series Forecasting [[AAAI 2025]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2412.17176) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FWPMixer.py)\n  - [x] **MSGNet** - MSGNet: Learning Multi-Scale Inter-Series Correlations for Multivariate Time Series Forecasting [[AAAI 2024]](https:\u002F\u002Fdl.acm.org\u002Fdoi\u002F10.1609\u002Faaai.v38i10.28991) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FMSGNet.py)\n  - [x] **PAttn** - Are Language Models Actually Useful for Time Series Forecasting? [[NeurIPS 2024]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2406.16964) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FPAttn.py)\n  - [x] **Mamba** - Mamba: Linear-Time Sequence Modeling with Selective State Spaces [[arXiv 2023]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2312.00752) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FMamba.py)\n  - [x] **SegRNN** - SegRNN: Segment Recurrent Neural Network for Long-Term Time Series Forecasting [[arXiv 2023]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2308.11200.pdf) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FSegRNN.py).\n  - [x] **Koopa** - Koopa: Learning Non-stationary Time Series Dynamics with Koopman Predictors [[NeurIPS 2023]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2305.18803.pdf) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FKoopa.py).\n  - [x] **FreTS** - Frequency-domain MLPs are More Effective Learners in Time Series Forecasting [[NeurIPS 2023]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2311.06184.pdf) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FFreTS.py).\n  - [x] **MICN** - MICN: Multi-scale Local and Global Context Modeling for Long-term Series Forecasting [[ICLR 2023]](https:\u002F\u002Fopenreview.net\u002Fpdf?id=zt53IDUR1U)[[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FMICN.py).\n  - [x] **Crossformer** - Crossformer: Transformer Utilizing Cross-Dimension Dependency for Multivariate Time Series Forecasting [[ICLR 2023]](https:\u002F\u002Fopenreview.net\u002Fpdf?id=vSVLM2j9eie)[[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FCrossformer.py).\n  - [x] **TiDE** - Long-term Forecasting with TiDE: Time-series Dense Encoder [[arXiv 2023]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2304.08424.pdf) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FTiDE.py).\n  - [x] **SCINet** - SCINet: Time Series Modeling and Forecasting with Sample Convolution and Interaction [[NeurIPS 2022]](https:\u002F\u002Fopenreview.net\u002Fpdf?id=AyajSjTAzmg)[[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FSCINet.py).\n  - [x] **FiLM** - FiLM: Frequency improved Legendre Memory Model for Long-term Time Series Forecasting [[NeurIPS 2022]](https:\u002F\u002Fopenreview.net\u002Fforum?id=zTQdHSQUQWc)[[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FFiLM.py).\n  - [x] **TFT** - Temporal Fusion Transformers for Interpretable Multi-horizon Time Series Forecasting [[arXiv 2019]](https:\u002F\u002Farxiv.org\u002Fabs\u002F1912.09363)[[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FTemporalFusionTransformer.py).\n\n**Newly added Large Time Series Models.** This library also supports the zero-shot evaluation of the following LTSMs.\n\n- [x] **Chronos2** - Chronos-2: From Univariate to Universal Forecasting [[arXiv 2025]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2510.15821) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FChronos2.py)\n- [x] **TiRex** - TiRex: Zero-Shot Forecasting Across Long and Short Horizons with Enhanced In-Context Learning [[NeurIPS 2025]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2505.23719) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FTiRex.py)\n- [x] **Sundial** - Sundial: A Family of Highly Capable Time Series Foundation Models [[ICML 2025]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2502.00816) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FSundial.py)\n- [x] **Time-MoE** - Time-MoE: Billion-Scale Time Series Foundation Models with Mixture of Experts [[ICLR 2025]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2409.16040) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FTimeMoE.py)\n- [x] **Toto** - Toto: Time Series Optimized Transformer for Observability [arXiv 2024](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2407.07874)\n- [x] **Chronos** - Chronos: Learning the Language of Time Series [[TMLR 2024]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2403.07815) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FChronos.py)\n- [x] **Moirai** - Unified Training of Universal Time Series Forecasting Transformers [[ICML 2024]](https:\u002F\u002Farxiv.org\u002Fpdf\u002F2402.02592)\n- [x] **TimesFM** - A decoder-only foundation model for time-series forecasting [[ICML 2024]](https:\u002F\u002Farxiv.org\u002Fabs\u002F2310.10688) [[Code]](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fblob\u002Fmain\u002Fmodels\u002FTimesFM.py)\n\n\n \n## Getting Started\n\n### Prepare Data\nYou can obtain the well-preprocessed datasets from [[Google Drive]](https:\u002F\u002Fdrive.google.com\u002Fdrive\u002Ffolders\u002F13Cg1KYOlzM5C7K8gK8NfC-F3EYxkM3D2?usp=sharing), [[Baidu Drive]](https:\u002F\u002Fpan.baidu.com\u002Fs\u002F1r3KhGd0Q9PJIUZdfEYoymg?pwd=i9iy) or [[Hugging Face]](https:\u002F\u002Fhuggingface.co\u002Fdatasets\u002Fthuml\u002FTime-Series-Library). Then place the downloaded data in the folder `.\u002Fdataset`.\n\n### Installation\n1. Clone this repository.\n   ```bash\n   git clone https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library.git\n   cd Time-Series-Library\n   ```\n\n2. Create a new Conda environment.\n   ```bash\n   conda create -n tslib python=3.11\n   conda activate tslib\n   ```\n\n3. Install Core Dependencies\n   > ⚠️ **CUDA Compatibility Notice**\n   > The torch prebuilt package is **CUDA-version specific**. (See https:\u002F\u002Fpytorch.org\u002Fget-started\u002Fprevious-versions\u002F)\n   > Please make sure to install the package that matches your local CUDA version (e.g., `cu118` or `cu121`).\n   > Recommended: torch==2.5.1\n\n   ```bash\n   pip install torch==2.5.1 --index-url https:\u002F\u002Fdownload.pytorch.org\u002Fwhl\u002Fcu121\n\n   pip install -r requirements.txt\n   ```\n\n4. Install Dependencies for Mamba Model (Required for Time-Series-Library\u002Fmodels\u002FMamba.py)\n   > ⚠️ **Linux only**\n   > ⚠️ **CUDA Compatibility Notice**\n   > The prebuilt Mamba wheel is **CUDA-version specific**.\n   > Please make sure to install the wheel that matches your local CUDA version\n   > (e.g., `cu11` or `cu12`). Installing a mismatched version may result in\n   > runtime errors or import failures.\n\n   Example for **CUDA 12**:\n\n   ```bash\n   pip install https:\u002F\u002Fgithub.com\u002Fstate-spaces\u002Fmamba\u002Freleases\u002Fdownload\u002Fv2.2.6.post3\u002Fmamba_ssm-2.2.6.post3+cu12torch2.5cxx11abiFALSE-cp311-cp311-linux_x86_64.whl\n   ```\n\n5. Install Dependencies for Moirai Model (Required for Time-Series-Library\u002Fmodels\u002FMoirai.py)\n   ```bash\n   pip install uni2ts --no-deps\n   ```\n\n### Docker Deployment\n```bash\n# Build and start the Docker container in detached mode\ndocker compose -f 'Time-Series-Library\u002Fdocker-compose.yml' up -d --build\n\n# Download \u002F place the dataset into a newly created folder .\u002Fdataset at the repository root\nmkdir -p dataset  # create the dataset directory\n\n# Copy the local dataset into the container at \u002Fworkspace\u002Fdataset\ndocker cp .\u002Fdataset tslib:\u002Fworkspace\u002Fdataset\n\n# Enter the running container to continue training \u002F evaluation\ndocker exec -it tslib bash\n\n# Switch to the workspace directory inside the container\ncd \u002Fworkspace\n\n# Run zero-shot forecasting with the pre-trained Moirai model\npython -u run.py \\\n  --task_name zero_shot_forecast \\   # task type: zero-shot forecasting\n  --is_training 0 \\                  # 0 = inference only (no training)\n  --root_path .\u002Fdataset\u002FETT-small\u002F \\ # root directory of the dataset\n  --data_path ETTh1.csv \\            # dataset file name\n  --model_id ETTh1_512_96 \\          # experiment\u002Fmodel identifier\n  --model Moirai \\                   # model name (TimesFM \u002F Moirai)\n  --data ETTh1 \\                     # dataset name\n  --features M \\                     # multivariate forecasting\n  --seq_len 512 \\                    # input sequence length\n  --pred_len 96 \\                    # prediction horizon\n  --enc_in 7 \\                       # number of input variables\n  --des 'Exp' \\                      # experiment description\n  --itr 1                             # number of runs\n```\n\n\n### Quick Test\n\nQuick test for all 5 tasks (1 epoch each):\n\n```bash\n# Run quick tests for all 5 tasks\nexport CUDA_VISIBLE_DEVICES=0\n\n# 1. Long-term forecasting\npython -u run.py --task_name long_term_forecast --is_training 1 --root_path .\u002Fdataset\u002FETT-small\u002F --data_path ETTh1.csv --model_id test_long --model DLinear --data ETTh1 --features M --seq_len 96 --pred_len 96 --enc_in 7 --dec_in 7 --c_out 7 --train_epochs 1 --num_workers 2\n\n# 2. Short-term forecasting (using ETT dataset with shorter prediction length)\npython -u run.py --task_name long_term_forecast --is_training 1 --root_path .\u002Fdataset\u002FETT-small\u002F --data_path ETTh1.csv --model_id test_short --model TimesNet --data ETTh1 --features M --seq_len 24 --label_len 12 --pred_len 24 --e_layers 2 --d_layers 1 --d_model 16 --d_ff 32 --enc_in 7 --dec_in 7 --c_out 7 --top_k 5 --train_epochs 1 --num_workers 2\n\n# 3. Imputation\npython -u run.py --task_name imputation --is_training 1 --root_path .\u002Fdataset\u002FETT-small\u002F --data_path ETTh1.csv --model_id test_imp --model TimesNet --data ETTh1 --features M --seq_len 96 --e_layers 2 --d_layers 1 --d_model 16 --d_ff 32 --enc_in 7 --dec_in 7 --c_out 7 --top_k 3 --train_epochs 1 --num_workers 2 --label_len 0 --pred_len 0 --mask_rate 0.125 --learning_rate 0.001\n\n# 4. Anomaly detection\npython -u run.py --task_name anomaly_detection --is_training 1 --root_path .\u002Fdataset\u002FPSM --model_id test_ad --model TimesNet --data PSM --features M --seq_len 100 --pred_len 0 --d_model 64 --d_ff 64 --e_layers 2 --enc_in 25 --c_out 25 --anomaly_ratio 1.0 --top_k 3 --train_epochs 1 --batch_size 128 --num_workers 2\n\n# 5. Classification\npython -u run.py --task_name classification --is_training 1 --root_path .\u002Fdataset\u002FHeartbeat\u002F --model_id Heartbeat --model TimesNet --data UEA --e_layers 2 --d_layers 1 --factor 3 --d_model 64 --d_ff 128 --top_k 3 --train_epochs 1 --batch_size 16 --learning_rate 0.001 --num_workers 0\n```\n\n\n### Train and Evaluate\n\nWe provide the experiment scripts for all benchmarks under the folder `.\u002Fscripts\u002F`. You can reproduce the experiment results as the following examples:\n\n> ⚠️ Some scripts have `CUDA_VISIBLE_DEVICES` set by default. Please modify or remove this setting according to your actual GPU configuration, otherwise it may prevent GPU usage.\n\n```bash\n# long-term forecast\nbash .\u002Fscripts\u002Flong_term_forecast\u002FETT_script\u002FTimesNet_ETTh1.sh\n# short-term forecast\nbash .\u002Fscripts\u002Fshort_term_forecast\u002FTimesNet_M4.sh\n# imputation\nbash .\u002Fscripts\u002Fimputation\u002FETT_script\u002FTimesNet_ETTh1.sh\n# anomaly detection\nbash .\u002Fscripts\u002Fanomaly_detection\u002FPSM\u002FTimesNet.sh\n# classification\nbash .\u002Fscripts\u002Fclassification\u002FTimesNet.sh\n```\n\n### Develop Your Own Model\n- Add the model file to the folder `.\u002Fmodels`. You can follow the `.\u002Fmodels\u002FTransformer.py`.\n- Create the corresponding scripts under the folder `.\u002Fscripts`.\n\n### Note: \n\n(1) About classification: Since we include all five tasks in a unified code base, the accuracy of each subtask may fluctuate but the average performance can be reproduced (even a bit better). We have provided the reproduced checkpoints [here](https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fissues\u002F494).\n\n(2) About anomaly detection: Some discussion about the adjustment strategy in anomaly detection can be found [here](https:\u002F\u002Fgithub.com\u002Fthuml\u002FAnomaly-Transformer\u002Fissues\u002F14). The key point is that the adjustment strategy corresponds to an event-level metric.\n\n### Inspect the project structure:\n\n```\nTime-Series-Library\u002F\n├── README.md                     # Official README with tasks, leaderboard, usage\n├── requirements.txt              # pip dependency list for quick environment setup\n├── LICENSE \u002F CONTRIBUTING.md     # Upstream license and contribution guide\n├── run.py                        # Unified entry that parses args and dispatches tasks\n├── exp\u002F                          # Task pipelines wrapping train\u002Fval\u002Ftest\n│   ├── exp_basic.py              # Experiment base class, registers models, builds flows\n│   ├── exp_long_term_forecasting.py    # Long-term forecasting logic\n│   ├── exp_short_term_forecasting.py   # Short-term forecasting logic\n│   ├── exp_imputation.py               # Missing-value imputation\n│   ├── exp_anomaly_detection.py        # Anomaly detection\n│   ├── exp_classification.py           # Classification\n│   └── exp_zero_shot_forecasting.py    # LTSM zero-shot evaluation\n├── data_provider\u002F                # Dataset loaders and splits\n│   ├── data_factory.py           # Chooses the proper DataLoader per task\n│   ├── data_loader.py            # Generic TS reader with sliding-window logic\n│   ├── uea.py \u002F m4.py            # Parsers for UEA, M4 and other formats\n│   └── __init__.py               # Exposes factory interfaces upward\n├── models\u002F                       # All model implementations\n│   ├── TimesNet.py, TimeMixer.py # Main forecasting models\n│   ├── Chronos2.py, TiRex.py     # LTSM zero-shot models\n│   └── __init__.py               # Enables name-based instantiation inside exp\n├── layers\u002F                       # Reusable attention \u002F conv \u002F embedding blocks\n│   ├── Transformer_EncDec.py     # Transformer stacks\n│   ├── AutoCorrelation.py        # Auto-correlation operator\n│   ├── MultiWaveletCorrelation.py# Frequency-domain unit\n│   └── Embed.py etc.             # Shared primitives\n├── utils\u002F                        # Utility toolbox\n│   ├── metrics.py                # MSE \u002F MAE \u002F DTW and other metrics\n│   ├── tools.py                  # General helpers such as EarlyStopping\n│   ├── augmentation.py           # Augmentations for classification \u002F detection\n│   ├── print_args.py             # Unified argument printer\n│   └── masking.py \u002F losses.py    # Task-specific helpers\n├── scripts\u002F                      # Bash recipes for reproducible experiments\n│   ├── long_term_forecast\u002F       # Long-term forecasting per dataset\u002Fmodel\n│   ├── short_term_forecast\u002F      # M4 and other short-term scripts\n│   ├── imputation\u002F               # Imputation scripts\n│   ├── anomaly_detection\u002F        # SMD \u002F SMAP \u002F SWAT detection scripts\n│   ├── classification\u002F           # UEA classification scripts\n│   └── exogenous_forecast\u002F       # TimeXer exogenous forecasting flow\n├── tutorial\u002F                     # TimesNet tutorial notebook and figures\n└── pic\u002F                          # README figures (dataset overview, etc.)\n```\n\n### Understand the project architecture:\n\n- **E2E flow**: configure experiments via `scripts\u002F*.sh` → run `python run.py ...` → `run.py` parses arguments and selects the proper `Exp_*` via `task_name` → the experiment builds datasets through `data_provider`, instantiates networks from `models`, and drives train\u002Fval\u002Ftest with utilities in `utils` → metrics and checkpoints are written to `.\u002Fcheckpoints`.\n- **Experiment layer (`exp\u002F`)**: `Exp_Basic` registers models and devices; subclasses implement `_get_data`, `train`, and `test` to encapsulate task-specific differences so the same model can be reused.\n- **Model & layer layer (`models\u002F` + `layers\u002F`)**: model files define architectures, while reusable attention\u002Fconv\u002Ffrequency components live in `layers\u002F` to minimize duplication.\n- **Data layer (`data_provider\u002F`)**: `data_factory` returns the correct `Dataset\u002FDataLoader`; `data_loader` handles windowing, masking, and sampling, with arguments controlling window length, missing ratio, anomaly ratio, etc.\n- **Script layer (`scripts\u002F`)**: bash scripts capture paper configurations (dataset, window, model, GPU) for reproducibility and serve as templates for custom runs.\n- **Utility layer (`utils\u002F`)**: `metrics` centralizes evaluation, `tools` bundles essentials like `EarlyStopping` and `adjust_learning_rate`, while `augmentation`\u002F`masking` cover task-specific preprocessing.\n- **Learning path**: recommended reading order is `scripts -> run.py -> exp\u002Fexp_basic.py -> corresponding Exp subclass -> data_provider -> models`, using `tutorial\u002FTimesNet_tutorial.ipynb` as a guided walkthrough before diving deeper.\n\n## Citation\n\nIf you find this repo useful, please cite our paper.\n\n```\n@inproceedings{wu2023timesnet,\n  title={TimesNet: Temporal 2D-Variation Modeling for General Time Series Analysis},\n  author={Haixu Wu and Tengge Hu and Yong Liu and Hang Zhou and Jianmin Wang and Mingsheng Long},\n  booktitle={International Conference on Learning Representations},\n  year={2023},\n}\n\n@article{wang2024tssurvey,\n  title={Deep Time Series Models: A Comprehensive Survey and Benchmark},\n  author={Yuxuan Wang and Haixu Wu and Jiaxiang Dong and Yong Liu and Mingsheng Long and Jianmin Wang},\n  booktitle={arXiv preprint arXiv:2407.13278},\n  year={2024},\n}\n```\n\n## Contact\nIf you have any questions or suggestions, feel free to contact our maintenance team:\n\nCurrent:\n- Haixu Wu (Ph.D., wuhaixu98@gmail.com)\n- Yuxuan Wang (Ph.D. student, wangyuxu22@mails.tsinghua.edu.cn)\n- Yong Liu (Ph.D. student, liuyong21@mails.tsinghua.edu.cn)\n- Ailuntz (Student from Open-source Community, ailuntz@icloud.com)\n\nPrevious:\n- Huikun Weng (Undergraduate, wenghk22@mails.tsinghua.edu.cn)\n- Tengge Hu (Master student, htg21@mails.tsinghua.edu.cn)\n- Haoran Zhang (Master student, z-hr20@mails.tsinghua.edu.cn)\n- Jiawei Guo (Undergraduate, guo-jw21@mails.tsinghua.edu.cn)\n\nOr describe it in Issues.\n\n## Acknowledgement\n\nThis library is constructed based on the following repos:\n\n- Forecasting: https:\u002F\u002Fgithub.com\u002Fthuml\u002FAutoformer.\n\n- Anomaly Detection: https:\u002F\u002Fgithub.com\u002Fthuml\u002FAnomaly-Transformer.\n\n- Classification: https:\u002F\u002Fgithub.com\u002Fthuml\u002FFlowformer.\n\nAll the experiment datasets are public, and we obtain them from the following links:\n\n- Long-term Forecasting and Imputation: https:\u002F\u002Fgithub.com\u002Fthuml\u002FAutoformer.\n\n- Short-term Forecasting: https:\u002F\u002Fgithub.com\u002FServiceNow\u002FN-BEATS.\n\n- Anomaly Detection: https:\u002F\u002Fgithub.com\u002Fthuml\u002FAnomaly-Transformer.\n\n- Classification: https:\u002F\u002Fwww.timeseriesclassification.com\u002F.\n\n## All Thanks To Our Contributors\n\n\u003Ca href=\"https:\u002F\u002Fgithub.com\u002Fthuml\u002FTime-Series-Library\u002Fgraphs\u002Fcontributors\">\n  \u003Cimg src=\"https:\u002F\u002Fcontrib.rocks\u002Fimage?repo=thuml\u002FTime-Series-Library\" \u002F>\n\u003C\u002Fa>\n","TSLib 是一个用于深度时间序列分析的开源库，特别适用于研究者进行高级时间序列模型的评估与开发。它支持五种主流任务：长短期预测、插补、异常检测和分类。项目采用Python编写，提供了清晰的代码基，便于用户理解和扩展。此外，TSLib 还引入了零样本预测功能，并提出了精度法则来帮助识别饱和数据集。尽管目前维护者不再积极添加新特性，但其基准实现依然正确有效。此库适合于需要处理时间序列数据的研究场景或工业应用，如金融市场的预测、服务器监控等。",2,"2026-06-11 03:24:14","top_topic"]