readme.md
October 26, 2025 · View on GitHub
This is a PyTorch implementation of STDCformer which has been accepted by Information Fusion.
This work is also a part of our works on Spatial-temporal Representation Learning and Prediction, called T-GCN, from a causality perspective.
Abstract
Crowd Flow Prediction is critical to urban management, with the goal of capturing the arrival and departure characteristics of crowd movements under different spatial and temporal distributions, which is fundamentally a spatial–temporal prediction task. Existing works typically treat spatial–temporal prediction as the task of learning a function F to transform historical observations to future observations. We further decompose this cross-time transformation into three processes: (1) Encoding (E): learning the intrinsic representation of observations, (2) Cross-Time Mapping (M): transforming past representations into future representations, and (3) Decoding (D): reconstructing future observations from the future representations. From this perspective, spatial–temporal prediction can be viewed as learning F=E⋅M⋅D, which includes learning the space transformations E,D between the observation space and the hidden representation space, as well as the spatial–temporal mapping M from future states to past states within the representation space. This leads to two key questions: Q1: What kind of representation space allows for mapping the past to the future? Q2: How to achieve mapping the past to the future within the representation space? To address Q1, we propose a Spatial–Temporal Backdoor Adjustment strategy, which learns a Spatial–Temporal De-Confounded (STDC) representation space and estimates the de-confounding causal effect of historical data on future data. This causal relationship we captured serves as the foundation for subsequent spatial–temporal mapping. To address Q2, we design a Spatial–Temporal Embedding (STE) that fuses the information of temporal and spatial confounders, capturing the intrinsic spatial–temporal characteristics of the representations. Additionally, we introduce a Cross-Time Attention mechanism, which queries the attention between the future and the past to guide spatial–temporal mapping. Finally, we integrate the process of learning the STDC representation space and the spatial–temporal mapping into an E-M-D skeleton for spatial–temporal prediction. The skeleton is further instantiated with a Transformer model, building a Transformer model with Spatial–Temporal De-Confounding Strategy (STDCformer). Experiments on three real-world datasets demonstrate that STDCformer achieves state-of-the-art predictive performance and exhibits stronger out-of-distribution generalization capabilities.
Hypothesis and Method
Causal hypothesis:
Model Architecture:
How to run
Save your configs of experiments in 'STDC.yaml', and run the following code to train/test model.
python main.py
Citation
Thank you for your attention to our work. If this work is helpful to your research, please cite the following paper:
@article{HE2026103645,
title = {STDCformer: A transformer-based model with a spatial–temporal causal de-confounding strategy for crowd flow prediction},
journal = {Information Fusion},
volume = {126},
pages = {103645},
year = {2026},
issn = {1566-2535},
doi = {https://doi.org/10.1016/j.inffus.2025.103645},
url = {https://www.sciencedirect.com/science/article/pii/S1566253525007171},
author = {Silu He and Peng Shen and Pingzhen Xu and Qinyao Luo and Haifeng Li},
keywords = {Crowd flow prediction, Causal inference, Spatial–temporal transformer, Causal de-confounding, Cross-time mapping}
}