Construction method of bi-graph spatio-temporal traffic flow prediction model based on adjacency constraint

CN121838478BActive Publication Date: 2026-08-11SHANDONG UNIV OF SCI & TECH
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2026-02-12
Publication Date
2026-08-11

AI Technical Summary

Technical Problem

[0003]基于深度学习的方法近年来成为短时交通流预测的主流方向:循环神经网络通过隐状态在时间维度上传递信息,能刻画交通流的动态演化,但在长序列上易出现梯度消失/爆炸;为缓解该问题,长短期记忆网以遗忘门、输入门、输出门控制信息流,显著增强长程依赖建模能力,而门控循环单元凭借更轻量的更新门和重置门在训练与推理效率上更具优势,常作为工程替代;总体而言,循环神经网络RNN、长短期记忆网络LSTM、门控循环单元GRU是时间依赖建模的关键基线,但仅依赖时间维仍难以表达路网的非欧几里得空间依赖;为此,研究者曾以卷积神经网络近似空间相关,但城市路网并非规则栅格且具有方向性与不规则拓扑,因而更适合采用将路网显式抽象为图的图卷积网,通过邻接矩阵进行特征聚合以直接建模非欧空间依赖并提升预测精度;总体来看,卷积神经网络CNN善于提取局部空间特征但是易忽略长程时序依赖,LSTM擅长序列建模却难以直接表达道路网络拓扑

Benefits of technology

(1)本发明提出一种多源邻接动态融合的拓扑约束机制。在空间建模中,融合静态物理邻接、自适应结构邻接与动态状态邻接三类信息,通过可学习权重进行加权,作为拓扑约束。该机制不改动基础图结构,保持了道路网络的物理可解释性,同时增强了模型对复杂时空关联的适应能力。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN121838478B_ABST
    Figure CN121838478B_ABST
Patent Text Reader

Abstract

This invention discloses a method for constructing a bi-graph spatiotemporal traffic flow prediction model based on adjacency constraints, relating to the field of intelligent transportation technology. The method includes the following steps: acquiring traffic datasets and external factor data; splitting the traffic dataset into training, validation, and test sets; based on the temporal resolution of the traffic dataset, extracting continuous historical observation data to construct a historical traffic sequence of a preset length; using the historical traffic sequence as input data, combining it with external factor data, and outputting multiple traffic flow results with different prediction time intervals; weighting and fusing the multi-source adjacency data to form topological constraints, and extracting spatial features with different characteristics to output a unified spatial feature tensor; splitting the spatial feature tensor into three parallel data streams, extracting time-dependent features, and outputting three-scale time features; and generating a traffic flow prediction model based on external factor data and the three-scale time features, with the goal of minimizing the error of the predicted time interval traffic flow results.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of intelligent transportation technology, and in particular to a method for constructing a bi-graph spatiotemporal traffic flow prediction model based on adjacency constraints. Background Technology

[0002] The continued growth of urbanization and travel demand has made road congestion a prominent issue affecting traffic efficiency and management decisions. As a fundamental component of connectivity status assessment and control applications, short-term traffic flow forecasting needs to address two key aspects simultaneously: first, the spatial correlation that changes with time period, load, and scenario; and second, the temporal three-scale nature of short-term fluctuations coexisting with intraday and weekly patterns. The superposition of these two types of non-stationary characteristics poses challenges to the model's expressiveness and generalization ability.

[0003] Deep learning-based methods have become the mainstream approach for short-term traffic flow prediction in recent years. Recurrent Neural Networks (RNNs) transmit information over time through hidden states, enabling them to characterize the dynamic evolution of traffic flow. However, they are prone to gradient vanishing / exploding on long sequences. To alleviate this problem, Long Short-Term Memory (LSTM) networks control information flow with forget gates, input gates, and output gates, significantly enhancing their ability to model long-range dependencies. Gated Recurrent Units (GRUs), with their lighter update and reset gates, offer greater efficiency in training and inference and are often used as engineering alternatives. Overall, RNNs, LSTMs, and GRUs are considered the most effective methods for short-term traffic flow prediction. Root-endian (RU) models are a key baseline for time-dependent modeling, but relying solely on the time dimension is insufficient to represent the non-Euclidean spatial dependencies of road networks. To address this, researchers have used convolutional neural networks (CNNs) to approximate spatial correlation. However, urban road networks are not regular grids and exhibit directionality and irregular topology. Therefore, graph convolutional networks (GCNNs), which explicitly abstract the road network as a graph, are more suitable. By aggregating features through adjacency matrices, they can directly model non-Euclidean spatial dependencies and improve prediction accuracy. Overall, CNNs excel at extracting local spatial features but tend to overlook long-range temporal dependencies, while LSTMs are adept at sequence modeling but struggle to directly represent road network topology. Although deep models improve spatiotemporal feature extraction capabilities, a single model still cannot simultaneously handle both types of dependencies. Summary of the Invention

[0004] To address the aforementioned issues, this invention proposes a method for constructing a bi-graph spatiotemporal traffic flow prediction model based on adjacency constraints. This model defines the spatial propagation range using three types of adjacency topological constraints. On the spatial side, a graph convolutional neural network (GCN) and a graph attention network (GAT) are connected in parallel, with Highway gating used for convex fusion to balance stability and dynamic representation. On the temporal side, a three-scale causal temporal convolutional network (TCN) is used for modeling short-domain, intraday phase, and weekly trend, with optional external factors introduced as supplementary methods. Unlike adaptive methods that learn implicit topologies, this model does not learn new adjacency structures but dynamically assigns weights within the topologically feasible domain to balance interpretability and robustness.

[0005] The present invention provides a method for constructing a bi-graph spatiotemporal traffic flow prediction model based on adjacency constraints, comprising the following steps: S10: Obtain traffic dataset, multi-source adjacency data, and external factor data, and split the traffic dataset into training set, validation set, and test set; S20: Based on the temporal resolution of the traffic dataset, extract continuous historical observation data and construct a historical traffic sequence of a preset length; S30: Using historical traffic sequences as input data and combining them with external factor data, the output is traffic flow results with multiple different prediction time intervals; S40: Multi-source adjacency data are weighted and fused to form topological constraints, and spatial features with different characteristics are extracted to output a unified spatial feature tensor. S50: Split the spatial feature tensor into three parallel data streams, extract time-dependent features, and output three-scale time features; S60: Based on external factor data and three-scale time characteristics, and with the goal of minimizing the error of the predicted time-distance traffic flow, a preliminary traffic flow prediction model is generated; S70: Train and optimize the preliminary traffic flow prediction model to generate a high-precision traffic flow prediction model.

[0006] The present invention has at least the following beneficial effects: (1) This invention proposes a topological constraint mechanism for dynamic fusion of multi-source adjacency. In spatial modeling, three types of information—static physical adjacency, adaptive structural adjacency, and dynamic state adjacency—are fused and weighted by learnable weights to serve as topological constraints. This mechanism does not alter the basic graph structure, maintains the physical interpretability of the road network, and enhances the model's adaptability to complex spatiotemporal relationships.

[0007] (2) This invention proposes a dual-graph spatial coding and gating fusion module that decouples steady-state and dynamic features. By running GCN and GAT in parallel, low-frequency stable structural features and high-frequency time-varying correlation features in the road network are extracted respectively. Highway gating is introduced for convex combination fusion, so that the model can adaptively adjust the contribution of the two features according to the traffic conditions, thereby improving the robustness and expressiveness of spatial modeling.

[0008] (3) This invention proposes a three-scale time modeling and external factor fusion framework. Three-way causal dilated convolution is used to model short-term continuous fluctuations, intraday phase cycles and weekly trend evolution respectively, and multi-scale fusion is performed through learnable weights; in terms of external factor fusion, direct feature splicing is the main method, and an optional FiLM conditional modulation mechanism is designed to enhance the model's response to external disturbances and scene adaptability. Attached Figure Description

[0009] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0010] Figure 1 This is a flowchart of the traffic flow prediction model construction of the present invention; Figure 2 This is an architecture diagram of the graph attention layer of the present invention; Figure 3 This is an architectural diagram of the three-scale time module of the present invention; Figure 4 This is a feature map of the external data of the present invention; Figure 5 This is a fusion diagram of the spatiotemporal feature data of the present invention. Detailed Implementation

[0011] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.

[0012] The traffic flow prediction model of this invention uses historical observation matrices, multi-source adjacency, and external factors as inputs to construct a spatiotemporal feature learning framework under topological constraints. In the spatial modeling stage, multi-source adjacency fusion constructs topological constraints to define the range, and a graph convolutional network is used to extract low-frequency steady-state spatial features, ensuring the smoothness and consistency of the structural representation. A graph attention network adaptively weights nodes based on their states, enhancing the model's ability to characterize dynamic spatial dependencies. These two approaches are fused using Highway-gated weighted convex fusion to achieve a complementary balance between steady-state and dynamic spatial features, improving the robustness of spatial encoding. In the temporal modeling stage, to address the multi-scale non-stationarity of traffic flow, three parallel causal dilated convolutional modules TCN(H), TCN(D), and TCN(W) are constructed to capture short-term continuity, intraday phases, and weekly trends, respectively, using a unified network structure to handle dependency differences under different prediction step sizes. This achieves both short-term accuracy and long-term stability without increasing complexity. In the introduction of external factors, direct feature concatenation is the primary method, with date and meteorological information incorporated as auxiliary inputs to ensure structural simplicity and training stability. When conditions permit, the FiLM conditional modulation mechanism is introduced as an optional scheme to map external factors into channel-level scaling and offset of time features, thereby characterizing the impact of the external environment on traffic evolution. In summary, the overall structure of the traffic flow model follows the design logic of topological constraints, dual-graph decoupling, three-scale convolution, and external factor modulation to overcome the limitations of existing models in terms of physical consistency, time-varying adaptability, and multi-step prediction robustness, achieving a balance between structural interpretability and performance optimization.

[0013] like Figure 1 As shown, this invention provides a method for constructing a bi-graph spatiotemporal traffic flow prediction model based on adjacency constraints, comprising the following steps: I. Constructing a multi-source adjacency topology constraint space Three types of adjacency information sources are introduced: (1) Static adjacency, used to characterize the stable physical topological relationships in the road network; (2) Adaptive adjacency, which automatically characterizes long-term structural relationships through learnable node embedding similarity; (3) Dynamic adjacency, which is generated online based on the similarity of node states within the input time window, and is used to reflect the time-varying correlation of traffic states over time.

[0014] Learnable weights are assigned to the three types of adjacency information. The importance of each adjacency source is automatically learned through softmax constraints. After weighted fusion, a unified and effective adjacency representation is formed, namely the multi-source fusion adjacency matrix A.

[0015] It should be noted that the multi-source adjacency topology constraint space adopts a unified constraint and dual-channel parallel architecture. The core topology constraint is a unified adjacency representation formed by the weighted fusion of static, adaptive, and dynamic adjacencies through learnable weights. This constraint does not correspond to a single modeling channel, ensuring the topological consistency of spatial propagation. At the same time, two parallel modeling channels, GCN and GAT, are set up to characterize different types of spatial dependencies through adjacency smooth propagation and attention-weighted aggregation, respectively, to achieve decoupled extraction of steady-state and dynamic spatial features. The number of the three types of adjacencies is independent of the dual-channel architecture, which not only preserves the physical interpretability of roads but also adapts to complex spatiotemporal relationships, providing a stable and flexible topological foundation for subsequent spatial feature encoding.

[0016] II. Static Graph Construction and Adjacency Definition Based on the aforementioned multi-source adjacency topological constraints, a graph convolutional neural network is introduced to perform local convolutional aggregation on the historical observations of nodes.

[0017] Let the feature matrix of all nodes in the graph be... Each row corresponds to an F-dimensional feature of a node; The full-graph node feature matrix X is the input to the graph convolutional neural network. After multiple convolutions, the node features will be updated step by step.

[0018] Given the feature matrix X of all nodes in the input image, the convolution operation is represented as: In the formula, Indicates the first The node feature matrix of the layer It is the initial node feature matrix; D represents the degree matrix corresponding to the multi-source fusion adjacency matrix A. Indicates the first The convolution kernel matrix of the layer, This represents a non-linear activation function.

[0019] Node representations of the output of a graph convolutional neural network As a spatially stable feature, it provides a structured basis representation for subsequent dynamic graph attention modeling.

[0020] It should be noted that the activation function adjusts the range of output feature values ​​through nonlinear mapping, effectively preventing feature divergence during network propagation. First, graph convolution is used to weight and converge the representations of adjacent nodes to extract local structural features and suppress redundant propagation, thereby achieving simultaneous reduction in parameter count and computational cost, as well as feature dimension reduction. ReLU nonlinearity is applied after each layer to improve stability and convergence efficiency during training. Finally, fully connected layers fuse cross-layer information, achieving a mapping from low-order features to high-order global semantics; the final output is obtained by tensor format conversion according to data specifications.

[0021] III. Constructing the Graph Attention Space Building upon the steady-state spatial features extracted by graph convolutional neural networks, a graph attention network is employed for spatial encoding to further model the dynamic correlations between nodes as traffic conditions change. The graph attention network, through data-driven attention coefficients, can adaptively focus on key neighbor nodes in different spatiotemporal contexts.

[0022] To construct the input features for the graph attention network, firstly, each node i is compared with the past... The observation sequence at each time step is embedded into a single feature vector: Consider node i in the past The observation sequence at each time step is used to treat the observations of a node within a fixed historical window as its hidden features at that time step, and these features are embedded into a vector as follows: In the formula, For nodes At any moment The original observations (such as flow rate, velocity, etc.). Indicates the first Each time frame represents a time index; F is the vector dimension, representing the length of the history window. Represents a node At any moment The embedded feature vector, Represents a node At any moment Push forward Observations at each time step Represents a node At any moment Push forward Observations at each time step Represents the embedded feature vector Spatial dimension.

[0023] Combine the temporal embeddings of all nodes i into an input tensor: It is the length of the time series. It refers to the number of nodes in the transportation network. Setting it to 12 ensures that performance comparisons between our model and other baselines are performed within the same historical window size.

[0024] To accurately model the spatial dependencies between different road segments in the road network, a graph attention mechanism is used to extract spatial features from the embedded traffic state vectors, such as... Figure 2 As shown.

[0025] This mechanism adaptively assigns weights to neighboring nodes, thereby identifying the spatial neighbors that have the most significant impact on the current node. Specifically, the input is a set of node embedding feature representations: Where N is the number of nodes and G is the number of features per node.

[0026] First, to transform the input features into a higher-order spatial representation, a shared weight matrix is ​​introduced. This maps the original features to a new representation space. Then, a self-attention mechanism function is introduced to compute the attention coefficients of a node and its neighbors: In the formula, This represents the attention mechanism. This represents the calculated attention coefficient. Indicates the first Layer target node eigenvectors, Indicates the first Layer target node eigenvectors.

[0027] Next, to enhance the nonlinear expressive power, the LeakyReLU activation function is used to process the attention score, and the softmax function is used to normalize the attention coefficients of neighboring nodes to obtain normalized attention coefficients. : Subsequently, the target node's features are updated according to the graph convolution rules: in, Let i represent the set of first-order adjacent nodes of node i. This is the activation function.

[0028] Furthermore, to improve the robustness and generalization ability of the model, a multi-head attention mechanism is adopted, which involves learning different attention representations in parallel in multiple subspaces and averaging the features. The final output space representation is as follows: In the formula, K represents the number of parallel attention subspaces, which enrich the attention representation through learning multiple subspaces, thereby improving the robustness and generalization ability of the model.

[0029] To update the hidden features, an attention adjacency matrix is ​​introduced, which maps the previously learned attention coefficients to the adjacency matrix, i.e.: In the formula, The attention coefficients are represented, and the self-attention mechanism is considered. Over the entire temporal range T, an adjacency tensor that evolves over time can be constructed, the attention adjacency matrix: The latest updated hidden feature is: The final node representation It represents the time-varying spatial characteristics within the topological feasible region.

[0030] Integration and Both inputs are shared into the Highway Networks gating module to achieve adaptive weighted fusion at the spatial layer, performing learnable convex fusion of the two feature streams in the same-dimensional space: In the formula, Indicates the gating weight, ; This represents the Sigmoid activation function. This represents the learnable weight parameters.

[0031] It should be noted that the fusion formula is a convex combination, which does not change the dimensions and scale of the representation space, facilitating stable integration with subsequent time modules. Therefore, the fused representation output by Highway... It is regarded as the final output of the spatial encoding stage and serves as the input feature tensor of the three-scale temporal convolution module for further modeling of temporal dependencies.

[0032] IV. Constructing a three-scale temporal convolution To effectively capture the temporal dynamic evolution characteristics of traffic conditions, this paper introduces a temporal convolutional network as a prediction module to extract temporal dependency features from historical observation data, which then serve as the input basis for control decisions. Figure 3 As shown. Temporal features obtained through spatial encoding. Based on this, the time encoder has three parallel channels to model information at different time scales: short-domain continuity, stage repetition, and periodic trend.

[0033] In spatial fusion representation Based on this, the time encoder has three parallel channels: short-domain continuity, stage repeatability, and periodic trend. The corresponding relationships are as follows: Short-domain continuity: refers to the influence of traffic conditions in the current time period on the traffic conditions of one or more previous continuous time periods. Time series set. Represented as: in, This indicates the number of the most recent time steps. Short-domain continuous sequences capture short-term traffic flow fluctuations, providing the necessary information for short-term predictions in the model.

[0034] Phase repetition: The phased changes in traffic flow reflect periodic fluctuations within the same time period each day. A time series set can be represented as: in, Indicates the number of timestamps. This represents the number of time intervals, with 'e' representing the extended time range used to adjust for peak-period fluctuations. This method effectively captures daily traffic patterns, providing a reference for the model's daily cyclical characteristics.

[0035] Periodic trends: These refer to the cyclical patterns of traffic flow over a longer timescale (e.g., weekly). A collection of trend-based time series. Represented as in, This is a trend-following time interval (usually one week). This represents the number of trend time steps, indicating the number of trend steps to be pushed forward, used to capture fluctuations at trend points in time. Trend time series sets can effectively capture traffic changes over longer periods, which is helpful for traffic flow forecasting under different conditions such as weekdays and weekends.

[0036] Causal convolution: To satisfy the constraint of an unseen future sequence, the convolution kernel at time... It only applies to the current moment and its history, and zero padding is added to the beginning of the sequence if necessary to maintain consistent length.

[0037] Dilated Convolution: To improve the model's ability to capture dependencies over long time spans, temporal convolutional networks employ dilated convolution, which is achieved by setting a dilation factor. This expands the receptive field without increasing the number of parameters. Its basic form is as follows: In the formula, It is an expansion factor. It is the filter size. Used to indicate past direction. This represents the output feature value of the dilated convolution at time s. This represents the input time-series feature sequence. Indicates dilated convolution, This represents the feature value at a specific historical time step in the input sequence. Represents the convolution kernel The Middle The weight values ​​at each position. By stacking multiple layers of dilated convolutions, an exponentially expanded temporal receptive field can be achieved to meet the prediction needs of different time scales.

[0038] Residual Connections: To enhance the training stability and convergence speed of deep networks, temporal convolutional networks introduce residual connection structures. Each convolutional module not only outputs the feature transformation result but also retains the input information, summing them element-wise as the final output. This mechanism takes the following form: in, This represents the feature extraction operation of the convolution path. For the final output, Activation is a non-linear activation function such as ReLU.

[0039] It should be noted that in the specific implementation, the three-scale branches do not repeatedly model the same time series, but are constructed by slicing according to different time structures: the short-term branch selects the most recent continuous time window, the stage branch samples at periodic intervals and combines neighborhood expansion, and the trend branch samples at longer periods, thus displaying information sources that distinguish different time scales at the input level.

[0040] Furthermore, to prevent overfitting and improve generalization ability, the temporal convolutional network also incorporates Dropout regularization and weight normalization in each residual unit, and through... Convolution corrects the inconsistency between input and output dimensions, ultimately improving the timing of the output. This indicates that the three-scale dependent structure and spatial embedding information are preserved simultaneously.

[0041] To characterize the impact of meteorological and date factors on traffic state evolution, these two types of external features are incorporated into the model for unified modeling and fusion, such as... Figure 4As shown, meteorological factors include three elements: weather category, temperature, and wind speed. Weather category is treated as a discrete variable, divided into 17 typical weather states (sunny, rainy, snowy, cloudy, foggy, hazy, sandstorm, etc.), and a 17-dimensional feature vector is obtained using one-hot encoding. Temperature and wind speed are continuous variables, and after min-max normalization, they are converted into 1-dimensional standardized features to ensure consistency of dimensions among different features. Regarding date and holiday factors, a 7-dimensional one-hot encoding is constructed for Monday to Sunday, and additional indicators for weekends (1-dimensional) and statutory holidays (1-dimensional) are set, both of which are binary discrete features. Concatenating all the above features column-wise yields a 28-dimensional external feature vector.

[0042] To balance prediction performance and system stability under different data conditions and engineering scenarios, this invention designs external factors as optional inputs and provides multiple fusion strategies.

[0043] A simple feature concatenation approach is used to input external factors as auxiliary information into the model. This method does not introduce additional modulation parameters or change the original spatiotemporal modeling structure; it only serves as an auxiliary information source for training and prediction. It has advantages such as simple implementation, stable training process, and insensitivity to data size, making it suitable for engineering applications and small-sample scenarios. When the external factor missing rate is lower and the training sample size is sufficient, a feature-modulated FiLM mechanism can be further introduced. Using the external factor vector as a condition, channel-level scaling and translation modulation are applied to the output features of the three time branches, thereby enhancing the model's response to external disturbances in specific scenarios. The FiLM mechanism is as follows: First, external input is processed using a two-layer MLP. The mapping is represented by three sets of channel-level scaling and translation parameters, used to modulate convolutional features at three time scales: short-term, phase-based, and periodic. in, These represent the scaling factor and offset factor for the corresponding time scale, respectively.

[0044] During the temporal modeling phase, the three parallel causal convolutional modules output three types of temporal features: short-term, phase-based, and periodic, denoted as […]. These three elements together constitute the fusion input of the time module. Next, the three time characteristics were analyzed. Perform channel-level modulation: in, This indicates element-wise multiplication.

[0045] To fuse modulation results from different time scales, learnable weights are introduced. The three types of features are weighted and aggregated to obtain a comprehensive prediction representation. : Final output As a temporal feature representation conditionalized by external factors, the input prediction layer generates multi-step traffic state results, such as... Figure 5 As shown.

[0046] It should be noted that during the temporal modeling phase, the model first uses the fused features output by the spatial encoding module. As input, it is mapped to the time dimension for dynamic modeling. A three-way parallel causal dilated convolutional network extracts three types of time features: short-term continuity, stage-based regularity, and periodic trend. Finally, external factors are incorporated, enabling the model to have adaptive adjustment capabilities at different time scales.

[0047] V. Model Training and Optimization The model was trained using the AdamW optimizer, with MAE as the primary loss function and MASE as the evaluation metric. This established a complete spatiotemporal prediction path encompassing spatial adjacency topological constraints, spatial dual-channel modeling, three-scale temporal modeling, external factor modulation, and multi-step prediction, achieving a unification of physical consistency and data-driven adaptation.

[0048] Experimental verification To systematically verify the predictive performance and stability of the proposed model under different application scenarios, experimental analysis was conducted using the PEMS-BAY dataset and the Jinan regional traffic dataset. PEMS-BAY, as a public traffic prediction benchmark dataset, was used to evaluate the model's basic predictive ability under standard test conditions; the Jinan regional traffic dataset, derived from real urban road network operation data, focused on examining the model's adaptability in engineering scenarios and its responsiveness to external factors.

[0049] The Jinan regional traffic dataset focuses on the urban road network of a portion of Lixia District. The data, with a 5-minute time resolution, covers approximately 30 consecutive days of traffic operation, reflecting various typical traffic conditions such as morning peak, off-peak, and evening peak hours. The dataset models road segment-level traffic conditions, primarily depicting the temporal variations in average speed or flow rate, making it suitable for short-term traffic condition prediction tasks at the network scale. External factors such as date and weather are aligned with the traffic data in the time dimension for subsequent experiments incorporating external information.

[0050] In terms of experimental setup, data preprocessing was performed on both types of datasets. All datasets were divided into training, validation, and test sets in a 7:1:2 ratio to ensure the independence of model training, model selection, and performance evaluation. The model input consisted of historical traffic sequences with a length of 12 time steps, corresponding to a 60-minute historical observation window. Based on this, the model simultaneously outputs prediction results for multiple future time steps during a single forward computation, covering prediction time intervals of 15 minutes, 30 minutes, and 60 minutes, to evaluate the model's performance under different prediction spans.

[0051] During model training, the AdamW optimizer is used for parameter updates, and an early stopping strategy is introduced to mitigate overfitting and improve training stability. All comparative models and the proposed method are tested under the same data partitioning, prediction settings, and evaluation metrics to ensure comparability of experimental results.

[0052] The predictive performance is evaluated using three indicators: Mean Absolute Error (MAE), Root Mean Square Error (RMSE), and Mean Absolute Percentage Error (MAPE). MAE measures the overall level of prediction error, RMSE reflects the fluctuation characteristics of prediction error, and MAPE characterizes the relative error of the prediction results. By comprehensively analyzing these indicators under multiple prediction time intervals, the overall performance of the model in terms of prediction accuracy and stability is assessed.

[0053] Without introducing any external factors, a multi-model comparison experiment was conducted on the PEMS-BAY dataset. The spatiotemporal graph neural network Graph WaveNet, spatiotemporal graph convolutional network STGCN, diffusing convolutional recurrent neural network DCRNN, and fully connected gated graph model FC-GAGA were selected for comparison. The results are shown in Table 1.

[0054] Table 1. Experimental results of baseline model comparison under conditions without external factors. As can be seen, this model has achieved relatively stable and competitive prediction performance at different prediction time intervals, and its advantages are more obvious in short-to-medium-term prediction scenarios.

[0055] Specifically, with a 15-minute prediction step size, this model outperforms the comparison model in all three metrics. Specifically, MAE is reduced by approximately 10.1% and 10.8% compared to DCRNN and Graph WaveNe, respectively; RMSE is reduced by approximately 7.1% compared to DCRNN; and MAPE error is reduced by approximately 9.7% compared to DCRN. These results demonstrate that, under short-term prediction conditions, this model has a stronger ability to characterize fine-grained temporal changes in traffic flow.

[0056] With a prediction step size of 30 minutes, our model outperforms the comparison models in all three metrics: MAE is reduced by approximately 2.3% compared to both DCRNN and Graph WaveNet; RMSE is reduced by approximately 3.8% compared to DCRNN; and MAPE is reduced by approximately 1.6% compared to Graph WaveNet. These results demonstrate that the model exhibits good predictive performance as the prediction time interval increases.

[0057] With a prediction step size of 60 minutes, although the overall prediction difficulty increases significantly, this model still maintains a relative advantage in MAE and RMSE metrics. MAE is reduced by approximately 1.9% compared to STGCN, and while it does not surpass DCRNN, it remains within the same order of magnitude. RMSE is reduced by approximately 2.7% compared to DCRNN. ​​MAPE is reduced by approximately 5.7% compared to STGCN. These results indicate that, under long-term prediction conditions, this model exhibits good accuracy and stability.

[0058] In summary, without relying on external information input, this model has achieved a stable outperformance of mainstream spatiotemporal prediction models on the PEMS-BAY dataset, and this advantage can be maintained even when the prediction time interval is extended, indicating that its structural design has achieved a reasonable balance between the depth of temporal modeling and the expression of spatial dependencies.

[0059] The results above demonstrate that, without introducing external factors, the proposed model achieves relatively stable and competitive predictive performance across different prediction step sizes, validating the effectiveness of the overall model structure in temporal modeling and spatial dependency characterization. However, the comparative experiments primarily evaluate overall performance and are insufficient to reveal the specific impact of different spatial modeling structures on performance improvement. Therefore, the next section will further utilize ablation analysis of spatial modeling structures to quantitatively compare the contributions of various adjacency modeling methods to predictive performance.

[0060] To verify the impact of the multi-source adjacency topology constraint mechanism on spatial modeling and quantify the contributions of different adjacency sources, this section presents ablation experiments. This mechanism is located at the front end of the model, and its core function is to construct multi-source adjacency topology constraints, which serve as the common structural input for subsequent GCN and GAT dual-channel spatial encoding. In this embodiment, while maintaining the consistency of the remaining network structure and training parameters, three adjacency fusion models, models without dynamic graph structures, models without adaptive graph structures, and models retaining only static graph structures are constructed. Comparative tests are conducted at three prediction time intervals of 15 min, 30 min, and 60 min. The experimental results are shown in Table 2.

[0061] Table 2 Spatial structure ablation results under different adjacency modeling methods As shown in Table 2, different adjacency modeling methods have a significant impact on the model's prediction performance. Overall, the model using multi-adjacency fusion modeling achieves the best performance under all three prediction step sizes, indicating that introducing multiple adjacency information as a topological constraint helps improve the sufficiency and stability of spatial dependency modeling.

[0062] Specifically, with a prediction step size of 15 minutes, the MAE of the three-adjacency fusion model is reduced by approximately 12.1% and 13.3% compared to the model without dynamic adjacency structure and the model without adaptive adjacency structure, respectively, and by 29.9% compared to the model using only static adjacency modeling. This result indicates that in short-term prediction scenarios, introducing dynamic graphs and adaptive adjacency helps to capture rapid changes in local traffic conditions.

[0063] With a prediction step size of 30 minutes, the three-adjacency fusion model still maintains its advantage in MAE and RMSE metrics. The RMSE is reduced by about 12.7% compared to the model without dynamic adjacency and by about 36.6% compared to the model with only static adjacency. As the prediction time interval increases, the error of the static adjacency model increases more significantly, reflecting its insufficient ability to characterize changes in spatial dependence in the medium term.

[0064] With a prediction step size of 60 minutes, the overall error of all models increased, but the three-neighbor fusion model still maintained the best performance in terms of MAE and RMSE, with the RMSE decreasing by about 32.4% compared to the static neighbor model alone. In contrast, the models that removed dynamic or adaptive neighbors showed a more significant increase in error in long-term predictions, indicating that multi-neighbor modeling plays a positive role in mitigating long-term prediction uncertainty.

[0065] The above analysis shows that a single adjacency can hardly fully characterize the dynamic spatial correlations in complex traffic networks. However, topological constraints that integrate static, adaptive, and dynamic adjacency information help the model achieve more stable prediction performance at different prediction scales. This also verifies the rationality and necessity of the proposed spatial modeling structure in complex traffic scenarios.

[0066] To verify the effects of external factors, such as date and weather, on short-term traffic condition prediction, this section uses Jinan road network data as the object, setting three prediction steps of 15 minutes, 30 minutes, and 60 minutes. The evaluation indicators are MAE, RMSE, and MAPE. The external factors are fused using a simple concatenation method, where the speed sequence and external features are concatenated along the feature dimension and then input into the model.

[0067] Under a unified external factor splicing setting, the proposed method was compared with typical spatiotemporal prediction models such as DCRNN, STGCN, Graph WaveNet, and FC-GAGA. The experimental results are shown in Table 3.

[0068] Table 3. Experimental results comparing baseline models under conditions involving external factors. As shown in Table 3, this model exhibits more stable advantages in medium-to-long prediction intervals (30 min and 60 min): In the 60-minute prediction interval, the model's MAE, RMS, and MAPE are the best among the compared models. Compared to Graph WaveNet, MAE is reduced by approximately 8.0%, and MAPE by approximately 3.0%; compared to FC-GAGA, MAE is reduced by approximately 16.9%, and MAPE by approximately 20.5%. In the 30-minute prediction interval, the model's MAE is on par with Graph WaveNet, while RMSE and MAPE are optimal, indicating that after introducing external factors, the model maintains better control over both error magnitude and relative error. In the 15-minute prediction interval, the model's MAE and MAPE are optimal, with MAPE reduced by approximately 4.2% compared to Graph WaveNet, and RMSE close to Graph WaveNet and FC-GAGA, demonstrating the model's competitiveness in key accuracy metrics over short time intervals.

[0069] In summary, under the condition of unified external factor splicing input, this model achieves better or more stable error performance across time intervals of 15-60 minutes, with the most significant advantage in 60-minute predictions. This indicates that when external information is used as supplementary input, the model structure can more effectively absorb external features and improve the stability and accuracy of medium- to long-term predictions.

[0070] To further verify whether the performance improvement brought about by external factors is stable and reliable, rather than being caused by a specific combination of features or random fluctuations, this section systematically analyzes the introduction method, fusion form, and perturbation robustness of external factors on the Jinan dataset. The experimental results are shown in Table 4.

[0071] Table 4 Results of external factor ablation and disturbance experiments First, a comparison of whether or not external factors are introduced shows that, compared to the setting without external factors, introducing external factors and using a simple splicing method leads to a decrease in error across all prediction time intervals. The simple splicing method maintains a lower or comparable error level in MAE, RMSE, and MAPE indices, indicating that external factors can provide effective supplementary information for short-term traffic condition prediction, and this gain is not limited to a single prediction scale.

[0072] Further comparison of different fusion methods under the same external factors reveals that complex modulation mechanisms such as FiLM splicing and FiLM gating generally fail to outperform simple splicing. Particularly at prediction step sizes of 30 minutes and 60 minutes, FiLM-related schemes show varying degrees of regression in both MAE and MAPE metrics. This result indicates that, given the limited sample size and fewer external factors in the Jinan dataset, introducing additional feature modulation parameters may amplify external noise or instability, leading to a decline in model generalization performance. In contrast, simple splicing does not alter the core prediction structure, serving only as auxiliary information input, making the training process more controllable and thus exhibiting more stable error control capabilities in this scenario.

[0073] Further experiments with external factor ablation and perturbation showed that retaining only a single type of external factor, such as date or weather, resulted in a decrease in model performance compared to the complete external factor setting. This indicates that the external factor gain stems from the synergistic effect of multiple external information sources. Simultaneously, applying a 30% mask to external factors or introducing random noise significantly increased the prediction error. For example, under a 30% mask, the MAE increased to 0.99 and the MAPE increased to 3.79 over 60 minutes, demonstrating that the model effectively utilizes external factor information, while impaired external factor quality directly impacts prediction accuracy. These results further validate the rationale for using external factors as optional inputs. When external factors are available and of reliable quality, they can provide stable gains. However, when external factors are missing or unreliable, the model can still degenerate into a prediction mode based solely on historical traffic sequences, meeting the robustness requirements in engineering applications.

[0074] Considering the performance fluctuations caused by random initialization during deep learning model training, this embodiment repeatedly verified the stability of the external factor introduction method under different random conditions by using three settings with different random seeds (2021, 2022, 2023): no external factors, introducing external factors using a simple concatenation method, and using a feature modulation-based FiLM fusion method. The experimental results are shown in Table 5.

[0075] Table 5. Stability verification of external factor fusion method under multiple random seeds It can be observed that under most random seed and prediction time interval conditions, the simple splicing method shows a relatively consistent and stable error level in MAE and MAPE indicators, especially in the short-term prediction scenarios of 15min and 30min, where no obvious abnormal performance fluctuations are observed. In contrast, the FiLM fusion method can achieve prediction accuracy close to or exceeding that under some random seeds, but its results fluctuate more significantly due to random initialization, and its stability is not as good as that of the simple splicing method.

[0076] Meanwhile, without introducing external factors, the overall error level of the model is relatively high, indicating that external factor information can effectively supplement short-term traffic state prediction to a certain extent. These results demonstrate that under current conditions of small sample size and multiple randomizations, the simple concatenation method has advantages in stability and reliability, while the FiLM fusion method can serve as an optional enhancement scheme when the quality of external factors is high or the training conditions are sufficient. Based on this, this invention designs external factors as optional inputs and allows the system to flexibly select the fusion method according to data conditions, thereby preserving performance improvement potential while ensuring prediction stability.

[0077] The experimental results above show that, in the Jinan traffic data scenario, introducing external factors such as date and weather can produce a stable positive effect on short-term traffic state prediction over most prediction steps. Under the condition of uniform external factor settings, the model maintains relatively stable and competitive prediction performance across different prediction time intervals and evaluation indicators. Further ablation, perturbation, and multi-random seed experiments indicate that the way external factors are integrated has some impact on model stability. Compared to complex fusion methods that rely on additional modulation parameters, simple concatenation is more likely to maintain stability in the training and prediction process under small sample conditions. At the same time, more complex fusion methods still have optional application space under specific data conditions. Based on this, this invention designs external factors as optional inputs and supports flexible configuration of different fusion strategies to balance performance improvement and engineering implementation requirements while ensuring prediction stability.

[0078] The above are merely preferred embodiments of the invention and are not intended to limit the invention. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of the invention should be included within the protection scope of the invention.

Claims

1. A method for constructing a bi-graph spatiotemporal traffic flow prediction model based on adjacency constraints, characterized in that, Includes the following steps: S10: Obtain traffic datasets, multi-source adjacency data, and external factor data. Split the traffic dataset into training set, validation set, and test set. The traffic dataset includes public benchmark datasets and regional traffic datasets. The multi-source adjacency data includes static adjacency, adaptive adjacency, and dynamic adjacency. The external factor data includes date factors and meteorological factors. S20: Based on the temporal resolution of the traffic dataset, extract continuous historical observation data and construct a historical traffic sequence of a preset length; S30: Using historical traffic sequences as input data and combining them with external factor data, the output is traffic flow results with multiple different prediction time intervals; S40: Multi-source adjacency data is weighted and fused to form topological constraints, and spatial features with different characteristics are extracted to output a unified spatial feature tensor; specifically: Static adjacency, adaptive adjacency, and dynamic adjacency are fused together using learnable weights. The fusion weights are then constrained by softmax to form a unified multi-source fusion adjacency matrix A. Historical traffic sequences are converted into an initial node feature matrix X and used as input. With a multi-source fusion adjacency matrix A as topological constraint, spatial features are extracted in parallel through a graph convolutional network and a graph attention network. S50: Split the spatial feature tensor into three parallel data streams, extract time-dependent features, and output three-scale time features; S60: Based on external factor data and three-scale time characteristics, and with the goal of minimizing the error of the predicted time-distance traffic flow, a preliminary traffic flow prediction model is generated; S70: Train and optimize the preliminary traffic flow prediction model to generate a high-precision traffic flow prediction model.

2. The method for constructing a bi-graph spatiotemporal traffic flow prediction model based on adjacency constraints according to claim 1, characterized in that, Based on the temporal resolution of the traffic dataset, the specific steps for constructing a historical traffic sequence of a preset length by extracting continuous historical observation data are as follows: The regional traffic dataset extracts continuous observations at 5-minute intervals, while the public benchmark dataset extracts continuous observations at its original time resolution, forming a historical traffic sequence with a length of 12 time steps.

3. The method for constructing a bi-graph spatiotemporal traffic flow prediction model based on adjacency constraints according to claim 1, characterized in that, The historical traffic sequence is converted into an initial node feature matrix X and used as input. Using a multi-source fusion adjacency matrix A as topological constraint, the specific steps for extracting spatial features in parallel through a graph convolutional network and a graph attention network are as follows: Graph convolutional networks aggregate features through layer update formulas, outputting a low-frequency steady-state spatial feature matrix. The layer update formula is as follows: ; In the formula, Indicates the first The node feature matrix of the layer, where D represents the degree matrix corresponding to the multi-source fusion adjacency matrix A. Indicates the first The convolution kernel matrix of the layer, Represents a nonlinear activation function; The initial feature matrix X is transformed into time series embedded features through an embedding mechanism. , ; In the formula, Represents a node At any moment The embedded feature vector, Represents a node At any moment The original observations, Represents a node At any moment Push forward Observations at each time step Represents a node At any moment Push forward Observations at each time step Represents the embedded feature vector Spatial dimension; Then, the attention coefficient between the node and its neighbors is calculated using a self-attention mechanism. , ; In the formula, Represents a node With nodes The original attention coefficients between them This represents the self-attention mechanism function. Represents the shared weight matrix. Indicates the first Layer target node eigenvectors, Indicates the first Layer target node eigenvectors; After LeakyReLU activation and softmax normalization, the neighborhood features are weighted and aggregated to output a high-frequency time-varying spatial feature matrix. ; Access via Highway gate and Perform convex fusion to output a unified spatial feature tensor. The fusion formula is as follows: ; In the formula, This represents the gating weight coefficient.

4. The method for constructing a bi-graph spatiotemporal traffic flow prediction model based on adjacency constraints according to claim 3, characterized in that, The specific steps for splitting the spatial feature tensor into three parallel data streams, extracting time-dependent features, and outputting three-scale time features are as follows: spatially encoded feature tensor The data is divided into three parallel streams based on short-term continuity, phase repetition, and periodic trend, corresponding to short-term fluctuations, intraday cycles, and weekly trends in traffic flow. Three parallel data streams are used to extract time-dependent features through causal dilated convolution; where the causal dilated convolution satisfies the constraint of future unseen, and the dilation factor is set accordingly. Expanding the receptive field, the formula is: ; In the formula, This represents the output feature value of the dilated convolution at time s. Indicates the filter size. This represents the input timing characteristics of the residual unit. Indicates dilated convolution, This represents the feature value at a specific historical time step in the input sequence. Represents the convolution kernel The Middle The weight value of each position; Then, a residual connection structure is introduced to process the input time-series feature sequence. The sum is the final output; the residual connection formula is: ; In the formula, This represents the feature extraction operation of the convolution path. For the final output, Activation is a non-linear activation function; Finally, by applying Dropout regularization and weight normalization, and then using learnable weights for weighted fusion, the three-scale temporal features are output. .

5. The method for constructing a bi-graph spatiotemporal traffic flow prediction model based on adjacency constraints according to claim 4, characterized in that, Based on external factor data and three-scale time characteristics, and with the objective of minimizing the error in predicting time-distance traffic flow, the specific steps for generating a preliminary traffic flow prediction model are as follows: First, external factor data is processed through a two-layer perceptron. The mapping is divided into three sets of channel-level parameters, and the parametric convolution features are... , ; In the formula, This represents the scaling factor for the corresponding time scale. This represents the offset coefficient for the corresponding time scale; Then, channel-level modulation is performed on the three-scale time features respectively. The modulation method is as follows: , , ; In the formula, Indicates element-wise multiplication; Ultimately, through learning weights Weighted aggregation yields a comprehensive prediction , ; Comprehensive forecast This serves as the output of a preliminary traffic flow prediction model.

6. The method for constructing a bi-graph spatiotemporal traffic flow prediction model based on adjacency constraints according to claim 5, characterized in that, The specific steps for training and optimizing the initial traffic flow prediction model to generate a high-precision traffic flow prediction model are as follows: Using historical traffic sequences and external factor data from the training set as input, the AdamW optimizer is employed, with MAE as the primary loss function, and performance is evaluated using three metrics: MAE, RMSE, and MAPE. The model is then repeatedly trained under random seeds until the validation set converges, generating a high-precision traffic flow prediction model.

7. The method for constructing a bi-graph spatiotemporal traffic flow prediction model based on adjacency constraints according to claim 1, characterized in that, Meteorological factors include three elements: weather category, temperature, and wind speed. Among them, weather category is regarded as a discrete variable and divided into 17 typical weather states. One-hot encoding is used to obtain a 17-dimensional feature vector. Temperature and wind speed are continuous variables, and after min-max normalization, they are converted into 1-dimensional standardized features.

8. The method for constructing a bi-graph spatiotemporal traffic flow prediction model based on adjacency constraints according to claim 1, characterized in that, In the date factor, a 7-dimensional one-hot encoding is constructed for Monday to Sunday, and additional indicator variables for weekends and statutory holidays are set.

Citation Information

Patent Citations

  • Traffic flow prediction method based on graph diffusion and dynamic graph fusion

    CN120636177A

  • Short-term traffic flow prediction method based on causal gated-low-pass graph convolutional network

    US20240029556A1