Combating Distribution Shift for Accurate Time Series Forecasting via Hypernetworks

Wenying Duan, Xiaoxi He, Lu Zhou, Lothar Thiele, Hong Rao

Abstract

Time series forecasting has widespread applications in urban life ranging from air quality monitoring to traffic analysis. However, accurate time series forecasting is challenging because real-world time series suffer from the distribution shift problem, where their statistical properties change over time. Despite extensive solutions to distribution shifts in domain adaptation or generalization, they fail to function effectively in unknown, constantly-changing distribution shifts, which are common in time series. In this paper, we propose Hyper Time-Series Forecasting (HTSF), a hypernetwork-based framework for accurate time series forecasting under distribution shift. HTSF jointly learns the time-varying distributions and the corresponding forecasting models in an end-to-end fashion. Specifically, HTSF exploits the hyper layers to learn the best characterization of the distribution shifts, generating the model parameters for the main layers to make accurate predictions. We implement HTSF as an extensible framework that can incorporate diverse time series forecasting models such as RNNs and Transformers. Extensive experiments on 9 benchmarks demonstrate that HTSF achieves state-of-the-art performances.

Introduction

Time series forecasting is a critical component in various domains, including urban planning, energy management, and environmental monitoring. A significant hurdle in achieving high accuracy is the distribution shift problem. Real-world time series data are often non-stationary; their statistical properties (mean, variance, etc.) change over time due to external factors like seasonality, sensor drift, or sudden behavioral changes.

Conceptual overview of HTSF: Hyper layers characterize shifting distributions from historical windows to generate weights for the main forecasting layers.

Traditional deep learning models often assume stationarity, leading to performance degradation when the data distribution evolves. While domain adaptation and generalization techniques exist, they typically assume discrete, known domains. In contrast, time series shifts are often continuous and unknown. We propose Hyper Time-Series Forecasting (HTSF), a framework that dynamically adapts to these shifts by using hypernetworks to generate model parameters on-the-fly.

Methodology

The HTSF framework is designed to be model-agnostic, meaning it can enhance various base forecasting architectures like RNNs or Transformers. It consists of two primary components: Hyper Layers and Main Layers.

Detailed architecture of the HTSF framework, illustrating the flow from input sequences through hyper layers and the attention-based weight generation for the main forecasting layers.

Hyper Layers

The Hyper Layers function as a meta-learner. They process historical data sequences to extract a "distribution characterization." To maintain efficiency, input sequences are first downsampled using 1D average pooling. A bidirectional GRU (BiGRU) then processes these sequences to capture temporal dependencies and represent the underlying distribution shifts mathematically.

Main Layers and Weight Generation

The Main Layers constitute the actual forecasting model. Unlike standard models with static weights, the weights of the Main Layers in HTSF are dynamically generated. An attention mechanism serves as the bridge: it queries the historical distribution representations from the Hyper Layers based on the current state of the Main Layer. This results in a set of weights specifically tailored to the current temporal context, allowing the model to reconfigure its internal logic to match the current data distribution.

Experiments and Results

HTSF was rigorously tested across nine benchmarks, including air quality data from Beijing, electricity consumption, human activity sensors, and various spatiotemporal traffic datasets (NYC-Taxi, PeMSD).

Key Findings

  • Superior Accuracy: HTSF consistently outperformed state-of-the-art baselines. For instance, on the Air Quality dataset, it achieved a 3.9% reduction in RMSE compared to the previous state-of-the-art method, ADARNN.
  • Flexibility: The framework successfully "hyper-charged" diverse models, including standard GRUs and complex Graph Convolutional Networks (like AGCRN), demonstrating its broad applicability.
  • Robustness to Shift: Visual analysis confirmed that the Hyper Layers effectively organize chaotic raw data into structured representations that reflect meaningful distribution patterns, proving that parameter-level adaptation is more flexible than traditional feature engineering.

Conclusion

HTSF addresses the fundamental challenge of non-stationarity in time series forecasting. By shifting the focus from learning invariant features to learning dynamic parameter generation, HTSF provides a flexible and powerful solution for real-world applications where data distributions are in constant flux. While hypernetworks introduce some computational overhead, the significant gains in accuracy and robustness across diverse benchmarks establish HTSF as a new state-of-the-art framework for handling distribution shifts in time series.

Summary updated

BibTeX
@inproceedings{duan2022combating,
  author = {Wenying Duan and Xiaoxi He and Lu Zhou and Lothar Thiele and Hong Rao},
  title = {{Combating Distribution Shift for Accurate Time Series Forecasting via Hypernetworks}},
  booktitle = {ICPADS},
  year = {2022},
  doi = {10.1109/icpads56603.2022.00121},
}
Figure