Introducing tsai: A Cutting-Edge Solution for Time Series Analysis
Overview of tsai
tsai
is an open-source deep learning library dedicated to time series and sequence data, built on top of PyTorch and fastai. Designed for a variety of tasks such as classification, regression, forecasting, and imputation, tsai
embodies state-of-the-art techniques to provide powerful solutions for time series analysis.
This library is actively developed by the timeseriesAI community, ensuring continuous improvements and cutting-edge advancements in time series analytics.
Recent Developments
The tsai
library is in constant evolution. Recent updates include:
- Introduction of New Models: Including PatchTST (accepted by ICLR 2023), RNN with different forms of attention, and TabFusionTransformer.
- Expansion of Datasets: Users now have access to a widened range of datasets, featuring 128 univariate classification datasets, 62 forecasting datasets, and several others.
- New Tutorials and Functionality: Tutorials for models like PatchTST and enhanced functionalities such as sklearn-type pipeline transforms for better accuracy and performance.
- Improved Support: Including Pytorch 2.0 support and reduced RAM requirements, making it more accessible and efficient.
Installation Methods
tsai
can be easily installed through different methods:
Using Pip
For a stable version, run:
pip install tsai
For developmental purposes or to stay updated with the latest changes:
git clone https://github.com/timeseriesAI/tsai
pip install -e "tsai[dev]"
To install with all dependencies:
pip install tsai[extras]
Using Conda
This can simplify the process:
conda install -c timeseriesai tsai
Comprehensive Documentation
Find detailed guidance and resources in the documentation.
Models Offered
tsai
includes a variety of state-of-the-art models:
- LSTM, GRU, and MLP networks
- Convolutional models like ResNet and FCN
- Transformer-based models, including TST and TabTransformer
- Advanced models like gMLP and InceptionTime
These models cater to a range of analytical needs and come with extensive documentation and research backing.
Getting Started with tsai
To begin exploring tsai
, users can start with initial guide notebooks like the Introduction to Time Series Classification, available on Google Colab. These resources offer a practical introduction to real-world applications.
Practical Examples
Binary Univariate Classification
To train:
from tsai.basics import *
X, y, splits = get_classification_data('ECG200', split_data=False)
...
clf.fit_one_cycle(100, 3e-4)
For inference:
from tsai.inference import load_learner
clf = load_learner("models/clf.pkl")
...
Multivariate Regression
To train:
from tsai.basics import *
X, y, splits = get_regression_data('AppliancesEnergy', split_data=False)
...
reg.fit_one_cycle(100, 3e-4)
For inference:
from tsai.inference import load_learner
reg = load_learner("models/reg.pkl")
...
Forecasting
For single-step or multi-step forecasting, prepare your datasets and choose an appropriate model, like TSTPlus, ensuring your inputs and outputs are well formatted.
Data Input Format
Inputs for time series and image models in tsai
should be a three-dimensional np.ndarray of the format [# samples x # variables x sequence length]. Tabular models use a pandas dataframe.
Contributing to tsai
The project welcomes contributions in various forms, from code improvements to documentation and tutorial notebooks. Those interested can refer to the contribution guide.
Professional Support
For professional use and consultation, timeseriesAI offers enterprise support services. Enquiries can be directed to [email protected].
Citation
Researchers using tsai
in their work can cite the library using the provided BibTeX entry to acknowledge its contribution.
With its robust framework and diverse capabilities, tsai
stands as a pivotal tool for anyone dealing with time series data, from novice practitioners to seasoned researchers.