State-of-the-art Deep Learning library for Time Series and Sequences.
tsai
is an open-source deep learning package built on top of Pytorch & fastai focused on state-of-the-art techniques for time series tasks like classification, regression, forecasting, imputation...
tsai
is currently under active development by timeseriesAI.
-
tsai
just got easier to use with the new sklearn-like APIs:TSClassifier
,TSRegressor
, andTSForecaster
!! See this for more info. -
ππ New tutorial notebook on how to train your model with larger-than-memory datasets in less time achieving 100% GPU usage!! ππ
-
tsai
supports now more input formats: np.array, np.memmap, zarr, xarray, dask, list, L, ...
- MINIROCKET a SOTA Time Series Classification model (now available in Pytorch):
You can now check MiniRocket's performance in our new tutorial notebook
"Using this method, it is possible to train and test a classifier on all of 109 datasets from the UCR archive to state-of-the-art accuracy in less than 10 minutes." A. Dempster et al. (Dec 2020)
-
Multi-class and multi-label time series classification notebook: you can also check our new tutorial notebook:
-
Self-supervised learning: Learn how to leverage your unlabeled datasets
-
New visualization: We've also added a new PredictionDynamics callback that will display the predictions during training. This is the type of output you would get in a classification task for example:
You can install the latest stable version from pip using:
pip install tsai
Or you can install the cutting edge version of this library from github by doing:
pip install -Uqq git+https://github.com/timeseriesAI/tsai.git
Once the install is complete, you should restart your runtime and then run:
from tsai.all import *
Here's the link to the documentation.
Here's a list with some of the state-of-the-art models available in tsai
:
- LSTM (Hochreiter, 1997) (paper)
- GRU (Cho, 2014) (paper)
- MLP - Multilayer Perceptron (Wang, 2016) (paper)
- FCN - Fully Convolutional Network (Wang, 2016) (paper)
- ResNet - Residual Network (Wang, 2016) (paper)
- LSTM-FCN (Karim, 2017) (paper)
- GRU-FCN (Elsayed, 2018) (paper)
- mWDN - Multilevel wavelet decomposition network (Wang, 2018) (paper)
- TCN - Temporal Convolutional Network (Bai, 2018) (paper)
- MLSTM-FCN - Multivariate LSTM-FCN (Karim, 2019) (paper)
- InceptionTime (Fawaz, 2019) (paper)
- Rocket (Dempster, 2019) (paper)
- XceptionTime (Rahimian, 2019) (paper)
- TabModel - modified from fastai's TabularModel
- OmniScale - Omni-Scale 1D-CNN (Tang, 2020) (paper)
- ResCNN - 1D-ResCNN (Sun , 2020) (paper)
- TST - Time Series Transformer (Zerveas, 2020) (paper)
- TabTransformer (Huang, 2020) (paper)
- XCM - Explainable Convolutional Neural Network) (Fauvel, 2020) (paper)
- MiniRocket (Dempster, 2021) (paper)
among others!
To get to know the tsai package, we'd suggest you start with this notebook in Google Colab: 01_Intro_to_Time_Series_Classification It provides an overview of a time series classification task.
We have also develop many other tutorial notebooks.
To use tsai in your own notebooks, the only thing you need to do after you have installed the package is to run this:
from tsai.all import *
These are just a few examples of how you can use tsai
:
from tsai.all import *
X, y, splits = get_classification_data('ECG200', split_data=False)
batch_tfms = TSStandardize()
clf = TSClassifier(X, y, splits=splits, arch=InceptionTimePlus, batch_tfms=batch_tfms, metrics=accuracy, cbs=ShowGraph(), verbose=True)
clf.fit_one_cycle(100, 3e-4)
from tsai.all import *
X, y, splits = get_classification_data('LSST', split_data=False)
batch_tfms = TSStandardize(by_sample=True)
clf = TSClassifier(X, y, splits=splits, arch=InceptionTimePlus, batch_tfms=batch_tfms, metrics=accuracy, cbs=ShowGraph(), verbose=True)
clf.fit_one_cycle(10, 1e-2)
from tsai.all import *
from sklearn.metrics import mean_squared_error
X_train, y_train, X_test, y_test = get_regression_data('AppliancesEnergy')
rmse_scorer = make_scorer(mean_squared_error, greater_is_better=False)
reg = MiniRocketRegressor(scoring=rmse_scorer)
reg.fit(X_train, y_train)
y_pred = reg.predict(X_test)
mean_squared_error(y_test, y_pred, squared=False)
from tsai.all import *
ts = get_forecasting_time_series("Sunspots").values
X, y = SlidingWindow(60, horizon=1)(ts)
splits = TimeSplitter(235)(y)
batch_tfms = TSStandardize()
fcst = TSForecaster(X, y, splits=splits, batch_tfms=batch_tfms, bs=512, arch=TST, metrics=mae, cbs=ShowGraph())
fcst.fit_one_cycle(50, 1e-3)
We welcome contributions of all kinds. Development of enhancements, bug fixes, documentation, tutorial notebooks, ...
We have created a guide to help you start contributing to tsai. You can read it here.
If you use tsai in your research please use the following BibTeX entry:
@Misc{tsai,
author = {Ignacio Oguiza},
title = {tsai - A state-of-the-art deep learning library for time series and sequential data},
howpublished = {Github},
year = {2020},
url = {https://github.com/timeseriesAI/tsai}
}