Time-Series Forecasting for Out-of-Distribution Generalization Using Invariant Learning

Haoxin Liu, Harshavardhan Kamarthi, Lingkai Kong, Zhiyuan Zhao, Chao Zhang, B. Aditya Prakash · DOI

Introduction

Traditional time-series forecasting (TSF) models typically rely on Empirical Risk Minimization (ERM), which operates under the assumption that future data will follow the same statistical distribution as the past. However, real-world time series are frequently subject to "Out-of-Distribution" (OOD) shifts caused by policy changes, climate shifts, or global events like the COVID-19 pandemic.

While Invariant Learning (IL) offers a path toward robustness by identifying stable relationships across environments, it faces two critical challenges in the temporal domain: the presence of unobserved "core" variables that break the sufficiency assumption, and the lack of explicit environment labels in most time-series datasets. To address these, the authors introduce FOIL (Forecasting for Out-of-distribution generalization via Invariant Learning), a model-agnostic framework designed to enhance the OOD robustness of existing deep TSF models.

The FOIL Framework

FOIL is designed as a "plugin" that can be wrapped around various deep learning backbones. The framework consists of three primary components that work together to handle unobserved variables and discover latent temporal environments.

The FOIL framework architecture, illustrating the training and testing stages including Label Decomposing, Environment Inference, and Invariant Learning.
  1. Label Decomposing Component ($C_{LD}$): Recognizing that we cannot observe every variable affecting a target, FOIL utilizes Instance Residual Normalization (IRN). This component uses a surrogate loss to align the mean and variance of residuals, effectively filtering out the influence of unobserved factors and making the target more predictable for invariant learning.
  2. Time-Series Environment Inference Module ($\mathcal{M}_{TEI}$): This module automatically identifies distinct environments within the data using an EM-based clustering approach. A key innovation is the temporal adjacency constraint, which assumes that data points close in time likely belong to the same environment, preventing the model from overfitting to noise.
  3. Time-Series Invariant Learning Module ($\mathcal{M}_{TIL}$): The core learner works adversarially with the inference module to identify features that perform consistently across all discovered environments, discarding spurious correlations that would fail during a distribution shift.

Experimental Evaluation

The framework was evaluated using four real-world benchmarks: Exchange (currency rates), ILI (influenza-like illness ratios), and ETTh1/ETTh2 (electricity transformer temperatures). These datasets were tested against three state-of-the-art backbone models: Informer, Crossformer, and PatchTST.

Key Results and Ablation

FOIL demonstrated significant performance improvements across all benchmarks. For the Informer backbone, FOIL reduced Mean Squared Error (MSE) by up to 85% on the Exchange dataset. Even for the highly optimized PatchTST, the framework provided gains of up to 30%.

Ablation study comparing FOIL against its variants (removing sufficiency, environment inference, or temporal constraints) across four benchmarks.

As shown in the ablation study, the removal of any single component—such as the sufficiency-handling surrogate loss (FOIL\Suf) or the environment inference module (FOIL\TEI)—leads to a marked decrease in performance. This confirms that addressing unobserved variables and accurately inferring temporal environments are both essential for OOD generalization. Furthermore, a case study on the ILI dataset revealed that FOIL could successfully identify real-world environments like "Winter," "Summer," and the "H1N1 pandemic" without any manual labeling.

Conclusion

FOIL represents a significant step forward in making time-series forecasting robust to distribution shifts. By acknowledging the "blind spot" of unobserved variables and leveraging temporal structure for environment discovery, it transforms Invariant Learning into a viable tool for TSF. While the framework currently excels in short-term forecasting and involves higher computational overhead during training, its model-agnostic nature makes it a powerful enhancement for any modern forecasting pipeline.

Summary updated

BibTeX
@inproceedings{liu2024time,
  author = {Haoxin Liu and Harshavardhan Kamarthi and Lingkai Kong and Zhiyuan Zhao and Chao Zhang and B. Aditya Prakash},
  title = {{Time-Series Forecasting for Out-of-Distribution Generalization Using Invariant Learning}},
  booktitle = {International Conference on Machine Learning},
  year = {2024},
  url = {https://openreview.net/forum?id=SMUXPVKUBg},
}
Figure