Introduction
Time-Series-Library (TSLib) is an open-source Python library from Tsinghua University that provides a unified codebase for advanced deep learning models applied to time series tasks. It enables researchers and practitioners to benchmark and deploy models for forecasting, classification, imputation, and anomaly detection using a consistent interface.
What Time-Series-Library Does
- Implements 15+ state-of-the-art deep time series models (TimesNet, PatchTST, iTransformer, DLinear, and more)
- Supports four core tasks: long-term forecasting, short-term forecasting, imputation, and anomaly detection
- Provides standardized experiment scripts for reproducible benchmarking
- Includes popular time series datasets with unified data loading pipelines
- Offers configurable training with GPU acceleration via PyTorch
Architecture Overview
TSLib follows a modular design with separate layers for data loading, model definition, training, and evaluation. Each model implements a common interface, allowing users to switch between architectures by changing a single configuration parameter. The training loop handles multi-GPU setups and supports early stopping, learning rate scheduling, and checkpoint saving.
Self-Hosting & Configuration
- Clone the repo and install dependencies via
pip install -r requirements.txt - Configure experiments through command-line arguments or shell scripts in the
scripts/directory - Set
--modelto choose from available architectures (TimesNet, PatchTST, DLinear, FEDformer, etc.) - Adjust
--seq_len,--pred_len, and--label_lento control input/output horizons - Place custom datasets in the
dataset/folder following the provided CSV format
Key Features
- Unified codebase covering multiple time series tasks under one framework
- Reproducible baselines with pre-configured experiment scripts
- Supports Transformer-based, MLP-based, and CNN-based model families
- Active maintenance with new models added as they are published
- Clean PyTorch implementation suitable for extension and research
Comparison with Similar Tools
- Darts — Higher-level API with statistical and ML models; TSLib focuses on deep learning research
- sktime — Scikit-learn-compatible framework for classical ML; TSLib targets neural architectures
- GluonTS — AWS probabilistic forecasting library; TSLib provides a broader model zoo
- NeuralForecast — Nixtla's neural forecasting; TSLib emphasizes multi-task support beyond forecasting
FAQ
Q: What Python and PyTorch versions are required? A: Python 3.8+ and PyTorch 1.8+ are recommended. Check requirements.txt for exact dependencies.
Q: Can I add my own model to TSLib?
A: Yes. Implement the Model class interface in the models/ directory and register it in the experiment runner.
Q: Does it support multivariate time series?
A: Yes. Most models support both univariate and multivariate settings via the --features flag (S, M, or MS).
Q: Is GPU training supported?
A: Yes. Use --use_gpu and --gpu flags to select devices, with multi-GPU support available.