Few-shot Learning for Time-series Forecasting

Tomoharu Iwata, Atsutoshi KumagaiarXiv 2020

Abstract

Time-series forecasting is a critical component in numerous applications, from financial modeling to infrastructure management. Traditionally, forecasting models are trained on extensive historical data specific to a target task. However, in many emerging scenarios, such as predicting demand for a new product or traffic in a newly developed area, sufficient historical data is unavailable, leading to significant performance degradation. This paper proposes a few-shot learning method designed to forecast future values in a target task given only a minimal "support set" of examples. Our model is trained across multiple disparate tasks to learn universal temporal dynamics. By employing a recurrent neural network integrated with an attention mechanism, the model can dynamically retrieve useful patterns from the support set that match the current query context. We demonstrate the effectiveness of this approach across 90 diverse time-series datasets, showing superior performance and faster inference compared to existing meta-learning baselines.

Introduction

Deep learning architectures, particularly Recurrent Neural Networks (RNNs) like Long Short-Term Memory (LSTM) networks, have set new benchmarks in time-series forecasting. Despite their success, these models are inherently data-hungry, requiring large volumes of historical data to capture complex temporal dependencies. This requirement poses a significant challenge for "cold-start" scenarios where data is scarce.

While transfer learning and meta-learning have addressed similar issues in computer vision and natural language processing, their application to time-series remains challenging. Current few-shot time-series methods often rely on computationally expensive fine-tuning (e.g., MAML) or manual feature engineering to select appropriate models. This paper introduces a novel few-shot forecasting model that learns latent representations automatically and adapts to new tasks instantaneously during the forward pass, bypassing the need for gradient-based updates at inference time.

Methodology

The proposed method frames time-series forecasting as an episodic meta-learning problem. The model is presented with a support set—a small collection of example time-series from the target domain—to assist in forecasting a query sequence.

Model Architecture

The architecture is designed to identify and exploit shared dynamics across different domains. It consists of three primary modules:

  1. Support Set Encoding: A Bidirectional LSTM processes the time-series in the support set. The bidirectional nature allows the model to encode both past and future context for every point in the reference sequences, creating a rich library of local patterns.
  2. Query Encoding: A standard unidirectional LSTM processes the query time-series up to the current timestep, generating a hidden state that represents the current temporal context.
  3. Attention Mechanism and Prediction: This is the core innovation of the model. The attention mechanism computes similarity scores between the query's hidden state and the hidden states of the support set. This allows the model to "look up" and weight relevant patterns found in the support set. A feed-forward neural network then integrates the query's representation with the context retrieved by the attention mechanism to predict the value for the next timestep.
The model architecture utilizes Bidirectional LSTMs for the support set and an attention mechanism to retrieve relevant patterns for the query sequence.

By training on a wide variety of tasks, the attention mechanism learns to recognize universal structures such as trends, seasonality, and abrupt changes, regardless of the specific data source.

Experimental Setup

To evaluate the model's generalizability, the authors utilized the UCR Time Series Classification Archive. Although originally intended for classification, the archive was repurposed for next-timestep forecasting. The researchers selected 90 distinct datasets after filtering for sequence length and data quality. These datasets cover a vast range of domains, including medical (ECG), industrial (sensor data), and environmental sequences. The tasks were partitioned into 55 training tasks, 10 validation tasks, and 25 target (test) tasks to ensure the model was evaluated on completely unseen domains.

Results and Discussion

The proposed method demonstrated significant improvements over state-of-the-art baselines. It achieved the highest accuracy (or was statistically tied for the best) on 62 out of the 90 tasks.

Comparison with MAML

A key finding was the model's consistent outperformance of LSTM-MAML. While MAML attempts to find a global initialization that can be fine-tuned to any task, the extreme variability in time-series dynamics makes this difficult. In contrast, the proposed attention-based model adapts via its forward pass, which proves more robust to the diverse patterns found in the UCR archive.

Qualitative Analysis

The model's ability to capture diverse dynamics is evident in qualitative comparisons across different datasets. Whether dealing with the smooth trends of the "Beef" dataset or the highly oscillatory patterns in "FaceFour," the model accurately tracks the true values by leveraging the support set.

Qualitative forecasting results across diverse datasets from the UCR archive, comparing the proposed method against baselines.

Efficiency and Scaling

Beyond accuracy, the model offers practical advantages. Because it avoids gradient updates at test time, inference is significantly faster than fine-tuning-based methods. Furthermore, the model exhibits favorable scaling properties: forecasting error decreases as the number of training tasks increases and as the size of the test support set grows.

Conclusion

This paper presents a robust few-shot learning framework for univariate time-series forecasting. By combining RNNs with an attention mechanism, the model successfully transfers knowledge across disparate domains without the need for task-specific fine-tuning. While currently limited to univariate data, the success of this approach suggests a promising path forward for more complex multivariate forecasting tasks. Future research will focus on extending this architecture to handle multi-dimensional temporal dependencies.

Summary updated

BibTeX
@misc{iwata2020few,
  author = {Tomoharu Iwata and Atsutoshi Kumagai},
  title = {{Few-shot Learning for Time-series Forecasting}},
  year = {2020},
  eprint = {2009.14379},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2009.14379},
}
Figure