RobustTSF: Towards Theory and Design of Robust Time Series Forecasting with Anomalies

Hao Cheng, Qingsong Wen, Yang Liu, Liang Sun

TL;DR

This paper tackles the critical problem of time series forecasting when the training data is contaminated with anomalies. The authors propose "RobustTSF," a novel framework that bridges the gap between learning with noisy labels and time series forecasting. RobustTSF achieves state-of-the-art performance by theoretically analyzing anomaly impacts and developing an efficient algorithm that filters out problematic samples and uses a robust loss function.

What Problem Does This Paper Address?

Time series forecasting is crucial for many applications, but real-world data is often plagued by anomalies (outliers, missing values, etc.). Traditional forecasting models assume clean data, leading to degraded performance when trained on noisy datasets. Existing methods for handling anomalies in time series forecasting, like detection-imputation-retraining pipelines, are often sensitive to thresholds and anomaly types, and lack theoretical grounding. This paper aims to develop a robust forecasting method that can effectively handle various anomaly types in both input features and target values, drawing parallels with advancements in learning with noisy labels.

Methods

The authors introduce a unified framework for Time Series Forecasting with Anomalies (TSFA). Their approach involves:

  1. Anomaly Definition: Statistically defining three common point-wise anomaly types: Constant, Missing, and Gaussian.
  2. Theoretical Analysis: Analyzing the "loss robustness" (how well loss functions handle target anomalies) and "sample robustness" (how well models handle input anomalies). They theoretically prove that Mean Absolute Error (MAE) is robust to Constant and Missing type anomalies, while both MAE and Mean Squared Error (MSE) are robust to Gaussian anomalies. They also show that the position of anomalies in the input sequence significantly impacts performance.
  3. RobustTSF Algorithm: Proposing a simple and efficient algorithm that:
  4. Trend Filtering: Uses a robust trend filtering method to estimate the underlying trend of the time series, making it less sensitive to anomalies.
  5. Anomaly Score Calculation: Computes an anomaly score for input segments based on the deviation from the estimated trend.
  6. Sample Selection: Selects training samples with low anomaly scores, effectively filtering out problematic data points near the label.
  7. Robust Loss Function: Employs a robust loss function (specifically MAE) on the selected samples.

This approach differs from traditional methods by avoiding explicit imputation and directly learning from a filtered subset of the data.

Datasets

The paper evaluates its method on several standard time series datasets:

  • Electricity
  • Traffic
  • ETT (ETT-h1, ETT-h2, ETT-m1)
  • Exchange
  • NAB (real-cloud)
  • M4 forecasting dataset

The authors also mention using synthetic data for theoretical analysis and visualizations.

Key Insights and Ideas

  • Bridging LNL and TSFA: The paper successfully establishes a theoretical link between Learning with Noisy Labels (LNL) and TSFA, suggesting that insights from LNL can be leveraged to improve time series forecasting in the presence of anomalies.
  • Anomaly Position Matters: The location of anomalies within the input time series significantly impacts forecasting performance, with anomalies closer to the target label being more detrimental.
  • MAE's Robustness: MAE is shown to be inherently more robust to certain types of anomalies (Constant, Missing) compared to MSE, offering a theoretical justification for its use in robust forecasting.
  • Sample Selection is Key: Filtering out samples with high anomaly scores is crucial for achieving robust performance, even more so than relying solely on robust loss functions.
  • Model Agnosticism: The proposed RobustTSF framework is designed to be model-agnostic, meaning it can be integrated with various forecasting architectures like LSTMs, Transformers, and TCNs.

Key Results

  • RobustTSF consistently outperforms existing methods, including vanilla training, offline imputation, online imputation, and loss-based sample selection, across various datasets and anomaly types.
  • On the Electricity and Traffic datasets, RobustTSF achieves significant improvements in MAE and MSE, particularly under challenging anomaly conditions. For instance, in Table 2, RobustTSF achieves the best MAE/MSE across multiple anomaly types and anomaly rates.
  • The method demonstrates robustness to different anomaly scales and positions.
  • RobustTSF is shown to be more efficient than detection-imputation-retraining pipelines.
  • The paper provides extensive experimental evidence supporting its theoretical analyses.

Limitations and Future Work

  • Point-wise Anomalies: The current theoretical analysis primarily focuses on point-wise anomalies. Extending this to sequence-wise anomalies, which are more complex and challenging to model, is identified as a key area for future research.
  • Training Data Size: The authors acknowledge that theoretical analyses are based on statistical perspectives, and performance might be impacted if the training dataset size is very small. However, their experiments suggest that for reasonably sized datasets, RobustTSF performs well.
  • Hyperparameter Sensitivity: While RobustTSF is generally robust, the paper notes that some hyperparameters (like the threshold for anomaly detection) can be sensitive to anomaly types, although they maintain consistent hyperparameters across experiments for fairness.
  • Future Work: The authors suggest exploring more intricate anomaly patterns, developing theoretical frameworks for sequence-wise anomalies, and investigating the application of RobustTSF to other advanced forecasting architectures.

Summary updated

BibTeX
@inproceedings{cheng2024robusttsf,
  author = {Hao Cheng and Qingsong Wen and Yang Liu and Liang Sun},
  title = {{RobustTSF: Towards Theory and Design of Robust Time Series Forecasting with Anomalies}},
  booktitle = {International Conference on Learning Representations},
  year = {2024},
  url = {https://openreview.net/forum?id=ltZ9ianMth},
}
Figure