Skip to main content

Practical Deep Learning for Time Series / Sequential Data library based on fastai & Pytorch

Project description


tsai

CI PyPI PRs

Description

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.

What's new:

September, 2021

  • See our new tutorial notebook on how to track your experiments with Weights & Biases Open In Colab

  • tsai just got easier to use with the new sklearn-like APIs: TSClassifier, TSRegressor, and TSForecaster!! See this for more info.

  • 🚀🚀 New tutorial notebook on how to train your model with larger-than-memory datasets in less time achieving up to 100% GPU usage!! 🚀🚀 Open In Colab

  • tsai supports now more input formats: np.array, np.memmap, zarr, xarray, dask, list, L, ...

Previously

  • MINIROCKET a SOTA Time Series Classification model (now available in Pytorch): You can now check MiniRocket's performance in our new tutorial notebook Open In Colab

"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: Open In Colab

  • Self-supervised learning: Learn how to leverage your unlabeled datasets Open In Colab

  • 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:

Installation

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 *

Documentation

Here's the link to the documentation.

Available models:

Here's a list with some of the state-of-the-art models available in tsai:

among others!

How to start using tsai?

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 *

Examples

These are just a few examples of how you can use tsai:

Binary, univariate classification

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)

Multi-class, multivariate classification

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)

Multivariate Regression

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)

Univariate Forecasting

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)

How to contribute to tsai?

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.

Citing tsai

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}
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tsai-0.2.23.tar.gz (165.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

tsai-0.2.23-py3-none-any.whl (198.8 kB view details)

Uploaded Python 3

File details

Details for the file tsai-0.2.23.tar.gz.

File metadata

  • Download URL: tsai-0.2.23.tar.gz
  • Upload date:
  • Size: 165.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for tsai-0.2.23.tar.gz
Algorithm Hash digest
SHA256 211cdbd43cfbdf2de96c2db36237b6b7ab2847b614ab2a29f9bb274b5973b411
MD5 fc147c6e08af1a78ed6eb4747c098415
BLAKE2b-256 71529c7f31800c6ac55cd25e4c3524ce8595f22fd47701a66569153d56082b1e

See more details on using hashes here.

File details

Details for the file tsai-0.2.23-py3-none-any.whl.

File metadata

  • Download URL: tsai-0.2.23-py3-none-any.whl
  • Upload date:
  • Size: 198.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.6.0 importlib_metadata/3.10.0 pkginfo/1.7.0 requests/2.25.1 requests-toolbelt/0.9.1 tqdm/4.59.0 CPython/3.8.8

File hashes

Hashes for tsai-0.2.23-py3-none-any.whl
Algorithm Hash digest
SHA256 47da9d0787146dbe55e81dafa84936617177da939883cd51fed7f63ba811c585
MD5 3c809e4a5385d6d17c6f95802a6e340c
BLAKE2b-256 acdcdc07f6786bd8f58b126379f9642016b2535696e9f14b9a4ef6b2fa5f34be

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page