avatarPeijin Chen

Summary

The undefined website introduces tsai, a Python library offering state-of-the-art machine learning models for time series analysis, with a focus on deep learning architectures and the inclusion of ROCKET and MiniROCKET algorithms.

Abstract

The undefined website discusses the landscape of time series machine learning libraries in Python, highlighting tsai as a prominent tool for time series classification (TSC) and regression tasks. It compares tsai with other popular libraries like sktime, noting that tsai provides a comprehensive suite of deep learning models implemented with PyTorch and fastai, alongside efficient classification and regression models such as ROCKET and MiniROCKET. The article emphasizes tsai's performance, speed, and ease of use, suggesting that it is a valuable resource for those working with time series data, particularly in comparison to more traditional machine learning methods like XGBoost or LightGBM. The author also mentions the ongoing development of sktime-dl, a companion package for sktime that will incorporate deep learning methods, but points out its current state of flux, positioning tsai as a stable and feature-rich alternative.

Opinions

  • The author believes that ROCKET and MiniROCKET are among the best general-purpose time series classification algorithms available.
  • MiniROCKET is noted to be particularly fast in training, potentially outperforming gradient boosted decision tree algorithms like XGBoost and LightGBM in both speed and accuracy.
  • Deep learning methods for time series, while potentially powerful, are seen as more complex and time-consuming due to the need for architecture adaptation from fields like computer vision and NLP, as well as extensive hyperparameter tuning.
  • The author suggests that despite the complexity, exploring deep learning models on time series data can be beneficial.
  • sktime is recognized for its extensive algorithm offerings and scikit-learn-like API but is critiqued for lacking native deep learning support, which is being addressed by the separate sktime-dl package.
  • tsai is presented as a current and practical choice for time series analysis, offering a wide range of deep learning architectures and the aforementioned ROCKET algorithms, making it a comprehensive tool for the community.

tsai — State of the Art Machine Learning for Time Series, Part 1.

There are more cool time series libraries for Python than you can shake a stick at. You might have heard of some of them:

Each of these libraries has different methods for dealing with the various time series learning tasks — regression, classification and forecasting. Where they tend to differ is in the selection of methods they use, ranging from traditional statistical methods (e.g. ARIMA), to dynamic time series warping, symbolic time series approximations, and more.

For those who are interested in time series classification (TSC)— let’s talk about two types of machine learning methods that are popular these days. One is ROCKET, and the other is deep learning. For an overview into TSC methods and ROCKET in particular, you would do well to read the following posts by Alexandra Amidon:

ROCKET vs. Deep Learning

The tldr is this: ROCKET is one of the best off-the-shelf, general purpose of time series classification algorithms out there. And then there is Mini-ROCKET, which is faster to train without much loss (if any) in performance. Both are fairly fast. Anecdotally, I would say that MiniROCKET, in particular, is faster than many gradient boosted decision tree type algos, such as XGBoost or LightGBM, or at least on par. On my data set, the thing is that they are faster AND more accurate.

The same thing cannot be said for deep learning methods — those that deal with time series tend to borrow or adapt architectures normally associated with computer vision and NLP. So you have people experimenting with ResNets, Transformers, LSTMs, CNNs, Temporal Convolutional Networks, Wavelet-based methods, and various other hybrids of all these. These can take a lot more time to train, and then there’s all the time you might spend hyperparameter tuning. Still, it might be at least worth exploring how deep learning models work on your data. Just in case.

sktime vs tsai

Many of you have no doubt heard of a sktime — as the name suggests, it takes inspiration from scikit-learn, with a similar API. Think of it as the time-series module of an expanded scikit-learn. This library has a plethora of algorithms and methods, including implementation of interval-based classifiers, such as the supervised time series forest, as well as ROCKET and MiniRocket — all of which are considered among the best in terms of TSC tasks.

But what about deep learning? There is no deep learning methods in sktime, but there is an companion package for sktime called sktime-dl, which incorporates all the cool deep-learning architectures mentioned above. The problem is, according the GitHub link, is that it’s in a state of flux. Their page says that they are working on it this summer so that it will be compatible with the current, latest stable release of sktime. In the meantime, however, it might be worth exploring some alternatives — hence tsai.

tsai — Time Series AI

from the tsai docs

The point of this post is to introduce tsai. So what does tsai bring to the table?

  • lots of deep learning architectures, implemented with PyTorch and fastai libraries.
  • ROCKET and MiniROCKET classification and regression models.

Here is a picture summarizing some of the models you have at your disposal:

some of the many models that you can use in tsai

Within each of these categories there are even more variations of the architectures. For example, here is a picture of the RNN_FCN architecture — a RNN Cell of some variety + a fully connected network at the end. You can choose vanilla RNN, GRU or LSTM for the recurrent network head — regardless, there is a classification block at the end.

If you’re a fan of convolutional neural networks (CNNs) for computer vision or sequential data, as you might find in natural language processing (NLP), here is a list of the models that use convolutional blocks in some way, shape, or form:

Lots of networks that use residual blocks, dilated convolutional filters, etc.

I hope that gets you excited enough to try tsai out. Part deux of this post is going to show you how I used tsai on an actual time series classification problem with real-world data from the Indian stock market.

Time Series Analysis
Time Series Data
Deep Learning
Machine Learning
Python
Recommended from ReadMedium