Traffic Accident Prediction via Patch-Aware and Basis Representation in Time Series Modeling

Peizhe Zhang, Xiao LiuApplied Sciences 2026 · DOI

TL;DR

This paper introduces a novel time series forecasting framework that combines "patch-aware" local pattern recognition with "global basis representation" to improve traffic accident prediction. By effectively capturing both sudden bursts and long-term trends in accident data, the model significantly outperforms existing methods, offering a more robust solution for intelligent transportation systems.

What Problem Does This Paper Address?

Predicting traffic accidents is crucial for public safety and intelligent transportation systems. However, accident data presents unique challenges: it's highly infrequent (sparse), often occurs in concentrated bursts, and exhibits strong daily and weekly periodic patterns. Traditional time series forecasting methods struggle with these characteristics, especially those assuming data stationarity or focusing on single time periods. This makes accurate and reliable prediction difficult, particularly for identifying high-risk periods.

Methods

The proposed framework, named "Patch-Aware Basis Representation" (PABR), integrates two key ideas:

  • Patch-Aware Local Perception: Similar to PatchTST, the input time series is divided into smaller, fixed-length "patches." This allows the model to capture fine-grained, short-term fluctuations and sudden accident surges within these local windows. A "Patch Encoder" then extracts semantic features from each patch.
  • Global Basis Representation: Inspired by BasisFormer, this component models the overall trends and periodic structures of the time series. It uses a set of learned "basis vectors" to reconstruct and represent latent temporal patterns. The PABR model enhances this by using a "Basis Module" that incorporates a "Basis Cross Attention Block" to learn coefficients that map patch features to these basis vectors.

These two components work together: the patch mechanism captures local dynamics, while the basis representation provides a robust understanding of global trends. A Transformer-based module then integrates these representations for final prediction.

Datasets

The primary dataset used is from the Traffic Incident Management System (TIMS), focusing on the I-405 highway in Los Angeles, California. This dataset is characterized by high traffic demand, complex infrastructure, and diverse accident patterns, making it a challenging benchmark.

For generalization testing, the authors also used two public benchmark datasets:

  • ETTh1: An electricity load forecasting dataset, known for its strong periodicity.
  • Electricity: A demand dataset exhibiting concurrent fluctuations across multiple users and regions.

Key Insights and Ideas

  • Complementary Strengths: The core idea is that local patch-based modeling and global basis representation are not mutually exclusive but rather complementary. Patching excels at capturing sudden, short-term events, while basis representation handles longer-term trends and periodicity.
  • Addressing Sparsity and Burstiness: The combination of patch segmentation and basis decomposition is particularly well-suited for the sparse and bursty nature of accident data, allowing the model to be sensitive to both rare extreme events and underlying patterns.
  • Interpretable Feature Importance: The interpretability analysis using attention heatmaps reveals that temporal features (like hour of day, day of week) and historical accident signals are consistently weighted heavily, validating the model's reliance on these key predictors. Environmental variables show more varied attention, suggesting the model selectively uses them based on context.
  • Structured Global Representation: The basis representation approach provides a more structured and interpretable way to model global trends compared to standard Transformer attention, which can sometimes be less transparent.

Key Results

  • I-405 Dataset Performance: The proposed model achieved the best performance on the I-405 dataset, with an MSE of 0.4630 and MAE of 0.2733. This represents a 9.7% reduction in MSE and 12.6% reduction in MAE compared to PatchTST, and a significant improvement over BasisFormer (22.3% MSE and 28.2% MAE reduction).
  • Generalization: On the ETTh1 dataset, the model performed comparably to strong baselines, and on the Electricity dataset, it achieved comparable or superior performance to mainstream models, demonstrating its generalization ability.
  • Risk-Oriented Metrics: In extreme accident scenarios, the model showed significant advantages. It achieved the lowest P95-MAE of 0.82 and the highest Top-K Recall of 0.71 on the I-405 dataset, outperforming PatchTST and BasisFormer by a considerable margin. This indicates superior ability to identify and predict high-risk periods.

Limitations and Future Work

  • Single Freeway Corridor: The current model is evaluated on a single freeway corridor. Future work could extend the framework to larger-scale road networks and incorporate multi-source spatiotemporal data.
  • Real-time Data and Adaptive Learning: The authors suggest incorporating real-time traffic flow information and exploring adaptive basis learning strategies to further improve predictive robustness under rapidly changing traffic conditions.
  • Data Imbalance: While the model performs well, the inherent sparsity and imbalance of accident data remain a challenge. Further research into specialized techniques for handling extreme class imbalance could be beneficial.

Summary updated

Abstract

Traffic accident prediction is of great importance for intelligent transportation systems and public safety management. Unlike conventional traffic flow forecasting tasks, accident data are characterized by low occurrence frequency and highly imbalanced distributions, with near-zero values during most time periods and occasional concentrated bursts. Accident occurrences are also strongly influenced by daily and weekly periodic patterns, resulting in mixed characteristics of low baseline levels, abrupt peaks, and long-term trends. These properties make traditional time series forecasting methods based on stationarity assumptions or single-period modeling less effective. To address this issue, this study proposes a time series forecasting framework that integrates patch-aware local perception with global basis representation. Specifically, this study aims to improve traffic accident time-series forecasting accuracy under sparse and bursty conditions by integrating patch-aware local perception with global basis representation. The patch-level structure captures fine-grained fluctuations in accident sequences by modeling short-term local variations, while basis decomposition provides robust modeling of overall trends through a set of global latent components, leading to complementary effects at both local and global levels. Experimental results on the I-405 highway accident dataset demonstrate that the proposed model significantly outperforms baseline methods, reducing mean squared error (MSE) and mean absolute error (MAE) by approximately 9.7% and 12.6% compared with PatchTST, and by 22.3% and 28.2% compared with Basisformer. Furthermore, experiments on public benchmark datasets ETTh1 and Electricity show that the proposed method achieves comparable or superior performance to mainstream models, indicating its effectiveness and generalization ability across different types of time series scenarios.
BibTeX
@inproceedings{zhang2026traffic,
  author = {Peizhe Zhang and Xiao Liu},
  title = {{Traffic Accident Prediction via Patch-Aware and Basis Representation in Time Series Modeling}},
  booktitle = {Applied Sciences},
  year = {2026},
  doi = {10.3390/app16041793},
}
Figure