CASPER: Causality-Aware Spatiotemporal Graph Neural Networks for Spatiotemporal Time Series Imputation

Baoyu Jing, Dawei Zhou, Kan Ren, Carl Yang · OpenReview

Abstract

Spatiotemporal time series are usually collected via monitoring sensors placed at different locations, which usually contain missing values due to various failures, such as mechanical damages and Internet outages. Imputing the missing values is crucial for analyzing time series. When recovering a specific data point, most existing methods consider all the information relevant to that point regardless of the cause-and-effect relationship. During data collection, it is inevitable that some unknown confounders are included, e.g., background noise in time series and non-causal shortcut edges in the constructed sensor network. These confounders could open backdoor paths and establish non-causal correlations between the input and output. Over-exploiting these non-causal correlations could cause overfitting. In this paper, we first revisit spatiotemporal time series imputation from a causal perspective and show how to block the confounders via the frontdoor adjustment. Based on the results of frontdoor adjustment, we introduce a novel Causality-Aware Spatiotemporal Graph Neural Network (Casper), which contains a novel Prompt Based Decoder (PBD) and a Spatiotemporal Causal Attention (SCA). PBD could reduce the impact of confounders and SCA could discover the sparse causal relationships among embeddings. Theoretical analysis reveals that SCA discovers causal relationships based on the values of gradients. We evaluate Casper on three real-world datasets, and the experimental results show that Casper could outperform the baselines and could effectively discover causal relationships.

Introduction

Spatiotemporal time series data—such as traffic flow, air quality, and weather patterns—are essential for urban planning and environmental monitoring. However, these datasets are frequently plagued by missing values caused by sensor malfunctions or connectivity issues. While modern deep learning architectures like Transformers and Graph Neural Networks (GNNs) have shown promise in imputation tasks, they often rely on "pattern matching" that fails to distinguish between true physical influences and spurious correlations.

In real-world sensor networks, "confounders" (e.g., shared background noise or arbitrary distance-based network edges) create "backdoor paths." These paths establish non-causal correlations that do not represent actual physical influence. When models over-exploit these shortcuts, they become prone to overfitting and perform poorly when environmental dynamics shift. CASPER addresses this by moving from correlation-based imputation to a causality-aware framework.

Causal Modeling and Frontdoor Adjustment

To mitigate the influence of unknown confounders, the authors revisit the imputation task through the lens of causal inference. By identifying that confounders $C$ can create spurious links between the input $G$ and the ground truth $Y$, the authors propose using frontdoor adjustment to block these backdoor paths.

Causal diagram showing the relationship between input G, embeddings H, and output Y, with confounder C blocked via frontdoor adjustment.

This theoretical foundation ensures that the model focuses on the causal mechanism $G \to H \to Y$, where $H$ represents the learned embeddings, effectively ignoring the "shortcut" of geographical proximity or noise when it does not represent actual influence.

The CASPER Architecture

CASPER (Causality-Aware Spatiotemporal Graph Neural Network) implements these causal principles through two primary innovations integrated into an encoder-decoder framework.

The overall architecture of CASPER, integrating Spatiotemporal Causal Attention (SCA) and a Prompt-Based Decoder (PBD).

1. Spatiotemporal Causal Attention (SCA)

Unlike standard attention mechanisms that are "dense" (where every node influences every other node), SCA introduces a causal gate based on the principle of Granger Causality. This gate uses a differentiable Gumbel-Softmax trick to learn a binary mask. If a sensor does not "Granger-cause" the target value, its influence is zeroed out. This forces the model to remain robust by focusing only on the sparse set of sensors that actually drive the signal.

2. Prompt-Based Decoder (PBD)

Implementing frontdoor adjustment typically requires complex external models to estimate global context. CASPER simplifies this by using learnable "prompts"—optimized vectors that capture the dataset's global context during training. These prompts allow the decoder to effectively block non-causal paths between input and output without requiring explicit knowledge of the confounders.

Experimental Results

The model was evaluated on four diverse datasets: hourly air quality records (AQI & AQI-36), traffic speed data from Los Angeles (METR-LA) and the Bay Area (PEMS-BAY), and a gene expression dataset (DREAM-3).

  • State-of-the-Art Performance: CASPER consistently outperformed 11 baselines. On the AQI-36 dataset, it achieved a Mean Absolute Error (MAE) of 10.09, significantly lower than the next best model's 10.92.
  • Causal Discovery: On the DREAM-3 dataset, where the ground truth causal graph is known, CASPER achieved an AUC of 0.6325 for graph discovery, outperforming specialized causal discovery methods like CUTS (0.5915).
  • Interpretability: Visualization of attention maps confirmed that CASPER identifies physical influences, such as wind patterns and terrain in Beijing, rather than relying solely on simple Euclidean distance.

Conclusion

CASPER represents a significant step toward robust and interpretable time series imputation. By integrating frontdoor adjustment and sparse causal attention, it successfully filters out the noise of spurious correlations. While the model currently relies on an initial adjacency matrix and faces the computational challenges inherent in spatiotemporal transformers, its ability to discover true causal relationships makes it a powerful tool for reliable sensor data analysis.

Summary updated

BibTeX
@inproceedings{jing2024casper,
  author = {Baoyu Jing and Dawei Zhou and Kan Ren and Carl Yang},
  title = {{CASPER: Causality-Aware Spatiotemporal Graph Neural Networks for Spatiotemporal Time Series Imputation}},
  booktitle = {ACM International Conference on Information and Knowledge Management},
  year = {2024},
  doi = {10.1145/3627673.3679642},
}
Figure