SyncAI.news, a Varaisys broadcasting
Patch Time Series Transformer in Hugging Face
HF

Hugging Face Blog

· 1 min read

AI LabsHugging Face Blog

Patch Time Series Transformer in Hugging Face

In this blog, we provide examples of how to get started with PatchTST. We first demonstrate the forecasting capability of PatchTST on the Electricity data. We will then demonstrate the transfer learning capability of PatchTST by using the previously trained model to do zero-shot forecasting on the electrical transformer (ETTh1) dataset. The zero-shot forecasting performance will denote the test performance of the model in the target domain, without any training on the target domain. Subsequently, we will do linear probing and (then) finetuning of the pretrained model on the train part of the target data, and will validate the forecasting performance on the test part of the target data.

The PatchTST model was proposed in A Time Series is Worth 64 Words: Long-term Forecasting with Transformers by Yuqi Nie, Nam H. Nguyen, Phanwadee Sinthong, Jayant Kalagnanam and presented at ICLR 2023.

Quick overview of PatchTST

At a high level, the model vectorizes individual time series in a batch into patches of a given size and encodes the resulting sequence of vectors via a Transformer that then outputs the prediction length forecast via an appropriate head.

The model is based on two key components:

  1. segmentation of time series into subseries-level patches which serve as input tokens to the Transformer;
  2. channel-independence where each channel contains a single univariate time series that shares the same embedding and Transformer weights across all the series, i.e. a global univariate model.

The patching design naturally has three-fold benefit:

  • local semantic information is retained in the embedding;
  • computation and memory usage of the attention maps are quadratically reduced given the same look-back window via strides between patches; and
  • the model can attend longer history via a trade-off between the patch length (input vector size) and the context length (number of sequences).

Original source

This story was published by Hugging Face Blog. SyncAI.news shows a preview; the complete article is on the publisher's site.

Read the full story on huggingface.co

Similar News