STContext: A Multifaceted Dataset for Developing Context-aware Spatio-temporal Crowd Mobility Prediction Models

Liyue Chen, Jiangyi Fang, Tengfei Liu, Fangyuan Gao, Leye WangarXiv 2025 · DOI · arXiv

Abstract

Spatio-temporal Crowd Flow Prediction (STCFP) is a cornerstone of smart city infrastructure, yet current models often struggle to integrate external "contextual" data effectively. This paper introduces STContext, a comprehensive dataset spanning nine crowd flow scenarios across six major cities, integrated with ten distinct contextual features. We propose a unified paradigm for context incorporation, categorizing features into spatial, temporal, and spatio-temporal domains. Our evaluation reveals that while context-aware models show marginal improvements in aggregate metrics, they provide critical accuracy gains during "long-tail" events, such as extreme weather, where traditional models typically fail.

Introduction

Predicting urban mobility patterns is vital for optimizing services like bike-sharing and traffic management. However, mobility is not an isolated phenomenon; it is deeply influenced by external factors such as weather, holidays, and local demographics. Despite this, the field faces three significant challenges: data scarcity of diverse context types, inconsistent modeling methodologies, and the "average trap"—where models appear accurate on average but fail during high-impact, rare events.

The STContext Dataset

To address these challenges, we present STContext. This dataset integrates crowd flow data from five scenarios (Bike-sharing, Ride-hailing, Pedestrian flow, Vehicle speed, and Metro flow) with a rich set of contextual features. We categorize these features into a new taxonomy based on their spatial and temporal characteristics.

Taxonomy of contextual features in the STContext dataset.

As shown in the taxonomy, features are divided into:

  • Spatial Context: Static features like Point of Interest (POI) distributions and road networks.
  • Temporal Context: Dynamic but spatially uniform features like holidays and time of day.
  • Spatio-temporal Context: Features that vary across both dimensions, such as weather forecasts and Air Quality Index (AQI).

Data Quality and Standardization

A major hurdle in context-aware modeling is the inconsistency of external data sources. For instance, weather data from different providers (e.g., NOAA vs. Weather Underground) may use different units or have varying levels of missingness.

The data standardization and calibration pipeline for handling multi-source weather data.

We implemented a rigorous three-stage pipeline—Data Standardization, Column-wise Pivot Selection, and Sample-level Calibration—to ensure a high-quality, unified dataset. By selecting "pivots" with the least missing data and calibrating other sources against them, we minimize noise and improve the reliability of the contextual signals.

A Unified Paradigm for Context Incorporation

We propose a four-step framework to systematically integrate these features into deep learning models:

  1. Feature Transformation: Converting raw signals into model-ready tensors.
  2. Dependency Modeling: Determining if context impacts are space-invariant (uniform across the city) or space-varying (unique to specific locations).
  3. Representation Fusion: Employing techniques like addition, concatenation, or gating mechanisms to merge context with mobility data.
  4. Training Strategies: Comparing end-to-end training with "Pretrain & Finetune" approaches.

Key Insights and Results

Our experiments yielded several critical findings for the future of STCFP:

  • The Long-Tail Effect: Contextual features are most valuable during rare events. In the NYC Bike dataset, weather features improved accuracy by over 2.7% during storms, despite having a negligible effect on overall RMSE.
  • Simplicity in Dependency: "Space-invariant" models often outperformed more complex "space-varying" ones, suggesting that factors like rain or holidays exert a relatively uniform influence across urban grids, and simpler models avoid overfitting.
  • The Importance of Forecasts: Models utilizing weather forecasts consistently outperformed those relying solely on historical weather, emphasizing the need for predictive context in real-world applications.
  • Universal Predictors: Among POIs, dining-related locations (cafes, restaurants) emerged as the most consistent predictors of crowd movement across all tested scenarios.

Conclusion

STContext provides a robust foundation for developing next-generation mobility models. By moving beyond "average" accuracy and focusing on context-aware performance during critical events, researchers can build more resilient smart city systems. Future work will focus on automating context selection and testing these paradigms across a broader range of neural architectures.

Summary updated

Abstract

In smart cities, context-aware spatio-temporal crowd flow prediction (STCFP) models leverage contextual features (e.g., weather) to identify unusual crowd mobility patterns and enhance prediction accuracy. However, the best practice for incorporating contextual features remains unclear due to inconsistent usage of contextual features in different papers. Developing a multifaceted dataset with rich types of contextual features and STCFP scenarios is crucial for establishing a principled context modeling paradigm. Existing open crowd flow datasets lack an adequate range of contextual features, which poses an urgent requirement to build a multifaceted dataset to fill these research gaps. To this end, we create STContext, a multifaceted dataset for developing context-aware STCFP models. Specifically, STContext provides nine spatio-temporal datasets across five STCFP scenarios and includes ten contextual features, including weather, air quality index, holidays, points of interest, road networks, etc. Besides, we propose a unified workflow for incorporating contextual features into deep STCFP methods, with steps including feature transformation, dependency modeling, representation fusion, and training strategies. Through extensive experiments, we have obtained several useful guidelines for effective context modeling and insights for future research. The STContext is open-sourced at https://github.com/Liyue-Chen/STContext.
BibTeX
@misc{chen2025stcontext,
  author = {Liyue Chen and Jiangyi Fang and Tengfei Liu and Fangyuan Gao and Leye Wang},
  title = {{STContext: A Multifaceted Dataset for Developing Context-aware Spatio-temporal Crowd Mobility Prediction Models}},
  year = {2025},
  eprint = {2501.03583},
  archivePrefix = {arXiv},
  url = {https://arxiv.org/abs/2501.03583},
}
Figure