Traffic prediction method, device and equipment for urban road network under abnormal event
By constructing a fusion feature matrix and a dynamic causal adjacency matrix, combined with temporal feature representation and a multilayer perceptron, the problem of low speed prediction accuracy in urban road networks is solved, and accurate quantification and dynamic adaptation to abnormal events are achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- BEIHANG UNIV
- Filing Date
- 2026-01-30
- Publication Date
- 2026-04-10
AI Technical Summary
Existing methods for predicting urban road network speeds fail to effectively distinguish the causal relationship between abnormal events and speed changes, resulting in low prediction accuracy and an inability to adapt to dynamic changes in urban road network topology.
A spatiotemporal attention mechanism is used to construct a fusion feature matrix. Through dynamic causal adjacency matrix and temporal feature representation, the individual causal effects of anomalous events are accurately quantified, and traffic prediction is performed in combination with a multilayer perceptron.
It improves the accuracy of urban road network speed prediction, can adapt to dynamic changes in road network topology, and accurately quantifies the differentiated impact of different abnormal events on speed.
Smart Images

Figure CN121838475A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of intelligent transportation technology, and more specifically, to a method, apparatus, and equipment for predicting traffic flow under abnormal events in urban road networks. Background Technology
[0002] Urban road networks are characterized by dense road sections, numerous intersections, and complex traffic flows. Frequent abnormal events such as traffic congestion, traffic accidents, temporary traffic control, and large-scale events cause drastic fluctuations in road speeds, severely impacting traffic efficiency.
[0003] Currently, existing methods for predicting urban road network speeds have the following shortcomings: First, they rely on data correlation modeling, failing to distinguish the causal relationship between abnormal events and speed changes, and easily misjudging correlations caused by mixed factors such as intersection signals and pedestrian interference as causal relationships; second, they use static adjacency matrices for road network speed prediction, but static adjacency matrices cannot adapt to dynamic changes in urban road network topology (such as tidal congestion and changes in road segment associations caused by temporary traffic restrictions); third, they lack sufficient differentiation of individual causal effects of various types of abnormal events, making it difficult to accurately quantify the differentiated impacts of different abnormal events such as traffic accidents and road construction on speed; these shortcomings significantly reduce the accuracy of urban road network speed prediction. Summary of the Invention
[0004] In view of this, the purpose of this application is to provide a method, apparatus and equipment for predicting traffic flow under abnormal events in urban road networks, so as to overcome at least one of the above-mentioned defects.
[0005] In a first aspect, embodiments of this application provide a method for traffic flow prediction under abnormal events in urban road networks, including: Obtain the current road network data and current abnormal event information of the target road network, and construct a fusion feature matrix based on the current road network data and current abnormal event information; The spatiotemporal attention mechanism is used to perform spatiotemporal calibration on the fused feature matrix to obtain the spatiotemporal calibration feature matrix; Based on the individual causal effects of abnormal events and historical traffic spatiotemporal state data, time feature representations are determined. Based on the spatiotemporal calibration feature matrix and time feature representations, a dynamic causal adjacency matrix is determined to reflect the causal relationship between road segments. Based on the dynamic causal adjacency matrix and the spatiotemporal calibration feature matrix, spatial feature representation is determined; By utilizing dynamic causal adjacency matrix, temporal feature representation, and spatial feature representation, the traffic prediction results of the target road network at future time points are determined.
[0006] In an optional implementation, the step of constructing a fusion feature matrix based on current road network data and current abnormal event information includes: constructing an initial fusion feature matrix based on current road network data and current abnormal event information; constructing a causal graph based on a structural causal model and a front-door criterion; and using the initial fusion feature matrix to verify the structured features of the causal graph to obtain the fusion feature matrix.
[0007] In an optional implementation, the step of using a spatiotemporal attention mechanism to perform spatiotemporal calibration on the fused feature matrix to obtain a spatiotemporal calibrated feature matrix includes: performing global pooling on each feature channel of the fused feature matrix to obtain a feature descriptor; converting the feature descriptor into a channel weight vector for quantifying the causal contribution of each feature channel; and weighting the channel weight vector with the fused feature matrix to obtain the spatiotemporal calibrated feature matrix.
[0008] In an optional implementation, the target road network includes multiple road segments. The step of determining a dynamic causal adjacency matrix reflecting the causal relationships between road segments, based on a spatiotemporal calibration feature matrix and temporal feature representations, includes: determining the traffic flow time series for each road segment based on current road network data, and determining an initial adjacency matrix based on the Spearman correlation coefficient of the traffic flow time series between every two target road segments; performing a linear transformation on the spatiotemporal calibration feature matrix and temporal feature representations to obtain a dynamic correlation representation; determining a causal correlation matrix based on the spatiotemporal calibration feature matrix and the dynamic correlation representations; and fusing the causal correlation matrix, the initial adjacency matrix, and the dynamic correlation representations using an adaptive weight fusion mechanism to obtain a dynamic causal adjacency matrix.
[0009] In an optional implementation, the dynamic individual causal effect is determined by the following method: taking samples of abnormal events that occur in the current abnormal event information as the processing group, and using K-nearest neighbor matching to take samples of historical periods without events as the control group; comparing the traffic flow of the processing group with the traffic flow of the control group in the same road segment to determine the individual causal effect of abnormal events; and performing unbiased correction on the individual causal effect of abnormal events to obtain the dynamic individual causal effect.
[0010] In an optional implementation, the step of determining the temporal feature representation based on the individual causal effects of abnormal events and historical traffic spatiotemporal state data includes: linearly mapping the individual causal effects of abnormal events and historical traffic spatiotemporal state data to a low-dimensional space to generate a current time query vector, a historical event key vector, and a historical event value vector; using a scaled dot product attention mechanism to perform similarity quantification and weight normalization processing on the current time query vector, historical event key vector, and historical event value vector to obtain attention features; and capturing the traffic fluctuation patterns of attention features in different periods to obtain the temporal feature representation.
[0011] In an optional implementation, the step of determining spatial feature representation based on the dynamic causal adjacency matrix and the spatiotemporal calibration feature matrix includes: concatenating the spatiotemporal calibration feature matrix with the adaptive node embedding matrix to obtain node features; using the dynamic causal adjacency matrix as a topological constraint, employing a two-layer graph convolutional network to perform neighbor-weighted aggregation of the node features to obtain initial spatial features; and performing weighted aggregation of the attention features and the initial spatial features to obtain spatial feature representation.
[0012] In an optional implementation, the step of determining the traffic prediction result of the target road network at a future time using a dynamic causal adjacency matrix, temporal feature representation, and spatial feature representation includes: splicing temporal feature representation and spatial feature representation to obtain spatiotemporal joint features; weighted fusion of dynamic causal adjacency matrix and attention features to obtain composite topological features; and using a multilayer perceptron to analyze the spliced features of composite topological features and spatiotemporal joint features to obtain traffic prediction results.
[0013] Secondly, embodiments of this application also provide a traffic flow prediction device under abnormal events in urban road networks, the device comprising: The data preprocessing module is used to acquire the current road network data and current abnormal event information of the target road network, and to construct a fusion feature matrix based on the current road network data and current abnormal event information; The feature calibration module is used to perform spatiotemporal calibration on the fused feature matrix using a spatiotemporal attention mechanism to obtain a spatiotemporal calibrated feature matrix. The time feature extraction module is used to determine time feature representations based on the individual causal effects of abnormal events and historical traffic spatiotemporal state data. Based on the spatiotemporal calibration feature matrix and the time feature representations, a dynamic causal adjacency matrix is determined to reflect the causal relationship between road segments. The spatial feature extraction module is used to determine spatial feature representations based on the dynamic causal adjacency matrix and the spatiotemporal calibration feature matrix. The speed prediction module is used to determine the traffic flow prediction results of the target road network at future times by utilizing dynamic causal adjacency matrix, temporal feature representation, and spatial feature representation.
[0014] Thirdly, embodiments of this application also provide an electronic device, including: a processor, a memory, and a bus. The memory stores machine-readable instructions executable by the processor. When the electronic device is running, the processor communicates with the memory via the bus. When the machine-readable instructions are executed by the processor, the steps of the traffic prediction method under abnormal events in urban road networks described above are performed.
[0015] The embodiments of this application bring the following beneficial effects: This application provides a method, apparatus, and device for predicting traffic flow under abnormal events in urban road networks. It can distinguish the causal relationship between abnormal events and speed changes, avoiding misjudging correlations caused by confounding factors as causal relationships. Furthermore, it employs a dynamic causal adjacency matrix for road network speed prediction, adapting to dynamic changes in urban road network topology. It also introduces the individual causal effects of abnormal events, accurately quantifying the differentiated impact of different abnormal events on speed, thus improving the prediction accuracy of urban road network speed. Compared with existing methods for predicting traffic flow under abnormal events in urban road networks, this application solves the problem of low prediction accuracy for urban road network speed.
[0016] To make the above-mentioned objectives, features and advantages of this application more apparent and understandable, preferred embodiments are described below in detail with reference to the accompanying drawings. Attached Figure Description
[0017] To more clearly illustrate the technical solutions of the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. It should be understood that the following drawings only show some embodiments of this application and should not be regarded as a limitation of the scope. For those skilled in the art, other related drawings can be obtained based on these drawings without creative effort.
[0018] Figure 1 A flowchart of the traffic flow prediction method for abnormal events in urban road networks provided in this application embodiment is shown; Figure 2 A flowchart illustrating the steps for constructing the fusion feature matrix provided in the embodiments of this application is shown; Figure 3 A flowchart illustrating the steps for constructing the spatiotemporal calibration feature matrix provided in the embodiments of this application is shown; Figure 4 A flowchart illustrating the steps for determining the time feature representation provided in the embodiments of this application is shown; Figure 5 A flowchart illustrating the steps for determining the dynamic causal adjacency matrix provided in an embodiment of this application is shown; Figure 6 A flowchart illustrating the steps for determining spatial feature representation provided in the embodiments of this application is shown; Figure 7 A flowchart illustrating the steps for determining the traffic prediction results provided in the embodiments of this application is shown; Figure 8 This invention provides a schematic diagram of the structure of a traffic flow prediction device for abnormal events in urban road networks, as shown in an embodiment of this application. Figure 9 A schematic diagram of the structure of the electronic device provided in the embodiments of this application is shown. Detailed Implementation
[0019] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. The components of the embodiments of this application described and shown in the accompanying drawings can generally be arranged and designed in various different configurations. Therefore, the following detailed description of the embodiments of this application provided in the accompanying drawings is not intended to limit the scope of the claimed application, but merely represents selected embodiments of this application. Based on the embodiments of this application, every other embodiment obtained by those skilled in the art without inventive effort falls within the scope of protection of this application.
[0020] To facilitate understanding of this embodiment, the following description uses the application of the urban road network traffic prediction method under abnormal events provided in this application to a terminal device as an example to illustrate the exemplary steps provided in this application embodiment. The terminal device is equipped with a traffic prediction model, which can execute the urban road network traffic prediction method under abnormal events. The traffic prediction model includes a data preprocessing module, a spatiotemporal feature calibration module, a dynamic causal adjacency matrix generation module, a time feature extraction module, a spatial feature extraction module, and a speed prediction module.
[0021] Please see Figure 1 , Figure 1 This is a flowchart illustrating a traffic flow prediction method for urban road networks under abnormal events, provided as an embodiment of this application. Figure 1 As shown in the embodiments of this application, the method for predicting traffic flow under abnormal events in urban road networks includes: Step S101: Obtain the current road network data and current abnormal event information of the target road network, and construct a fusion feature matrix based on the current road network data and current abnormal event information.
[0022] Current road network data refers to a dynamic quantitative data set used to characterize traffic flow status, facility operation, and environmental impact. Current road network data includes road network topology data (such as road segment number, road grade, length, and number of lanes), traffic flow data (such as vehicle speed, lane occupancy, headway, traffic density, and cross-sectional flow), traffic signal data (signal green ratio, signal cycle, signal control mode, and phase release status), road facility operation data (lane traffic status, entrance and exit status, and road network ancillary setting status), road network and environmental auxiliary data (such as weather, visibility, and road surface conditions), and traffic flow derived data (congestion index and travel time).
[0023] Current abnormal event information includes event type (such as traffic accident, road maintenance, commercial activity), time of occurrence, and scope of impact (e.g., the scope of impact can be 3 adjacent road sections).
[0024] The data preprocessing module acquires the current road network data and current abnormal event information of the target road network, and performs data preprocessing on the current road network data and current abnormal event information to construct a fusion feature matrix.
[0025] Specifically, the current road network data and current abnormal event information are cleaned, completed, and normalized. For example, cubic spline interpolation is used to complete traffic data that is missing multiple consecutive time steps, and negative traffic and outliers exceeding the design capacity of road sections are filtered out. Traffic characteristics are processed according to the standard normalization formula to construct a standardized current dataset.
[0026] The following reference Figure 2 This section will introduce the process of constructing the fusion feature matrix.
[0027] Figure 2 A flowchart illustrating the steps for constructing the fusion feature matrix provided in this application embodiment is shown, as follows: Figure 2 As shown, the steps for constructing the fused feature matrix include: Step S1011: Construct an initial fusion feature matrix based on the current road network data and current abnormal event information.
[0028] Based on time windows, time steps, and road segments, the current dataset and historical datasets are grouped and aggregated to obtain an initial fusion feature matrix. For example, one time window (1 hour) is considered as one sample, each sample contains 12 consecutive time steps, and each time step aggregates 8-dimensional features of 658 road segments. All road segments under the same time step are grouped together for subsequent synchronous extraction of spatiotemporal features. All 8 types of features are included in the fusion feature system.
[0029] For example, the dimensions of the initial fusion feature matrix are (8916, 12, 658, 8), where 8916 represents the number of samples, 12 represents the length of the 1-hour time window, 658 represents the number of road segments, and the 8 types of features are cross-sectional flow, congestion index, event type, impact range, signal cycle, green ratio, time period (e.g., 0-287) and weekday (e.g., 1-7).
[0030] Step S1012: Construct a causal graph based on the structural causal model and the front door criterion.
[0031] Commuting patterns and customer flow in commercial areas are identified as confounding variables U in the structural causal model. Abnormal events are identified as intervention variables X. Eight types of characteristics (including characteristics of the treatment group and the control group) are identified as mediating variables Z. Traffic flow in road segments is identified as the outcome variable Y. The causal objective is clearly defined, for example: to estimate the causal effect of X on Y using the structural causal model (SCM), and the existence of a confounding variable U between X and Y has been confirmed.
[0032] Using the core variables of the SCM as nodes, and based on the causal assumptions of the SCM, a directed acyclic graph (DAG) is drawn as the basic causal graph. Then, using the three structured conditions of the front-door criterion as the core, qualified mediator variables Z are selected. Finally, the basic causal graph after selecting mediator variables Z is revised based on the front-door criterion to form the final causal graph.
[0033] Step S1013: Use the initial fusion feature matrix to verify the structured features of the causal graph and obtain a fusion feature matrix with causal relationships.
[0034] The first step is to extract the causal roles of variables (such as X as the intervention variable, Z as the mediator variable, Y as the outcome variable, and U as the confounding variable), the front door core path (X→Z→Y), and the confounding blocking rules from the constructed causal graph, and generate a causal processing rule set. This involves transforming the abstract causal structure of the causal graph (such as nodes, paths, and variable relationships) into specific feature processing operations. For example, the causal processing rule set includes retaining only the intervention variable X, mediator variable Z, outcome variable Y, and confounding variable U from the causal graph, and removing all irrelevant variables without causal relationships.
[0035] The second step is to apply the causal processing rule set to the initial fusion feature matrix, purify the 8-dimensional features in the initial fusion feature matrix into qualified mediator variables Z that meet the front door criterion, and integrate the intervention variable X, confounding variable U, and outcome variable Y to assign causal roles to all features in the initial fusion feature matrix.
[0036] For example, the core causal variables defined in the causal diagram—such as the intervention variable X, confounding variable U, and outcome variable Y—are added as feature columns to the initial fused feature matrix, generating a complete feature set containing all causally related variables. Simultaneously, each added feature dimension is assigned a unique causal role, giving causal localization to purely numerical features that lack causal significance.
[0037] The third step involves processing the initial fusion feature matrix, which is assigned a causal role, based on the confounding blocking rule. The influence of the confounding variable U is then weighted and integrated into the mediator variable Z, completely eliminating the direct feature interference of the confounding variable U on X and Y, and obtaining the feature set that blocks all confounding paths.
[0038] The fourth step involves grouping the mediating variable Z, which was integrated in the third step, according to the causal path X→Z and based on the value (0 / 1) of the intervention variable X, to obtain the treatment group and the control group. The sample dimensions of the treatment group and the control group are kept consistent with the initial fusion feature matrix (e.g., 658 road segments).
[0039] The fifth step involves performing a directed weighted fusion of the feature sets that block all hybrid paths, following the front-door core path X→Z→Y from the first step (X is coupled with the treatment / control group, and Y is integrated as the result feature), to generate a hybrid feature matrix without hybridity.
[0040] Step S102: Using a spatiotemporal attention mechanism, the fused feature matrix is spatiotemporally calibrated to obtain a spatiotemporally calibrated feature matrix.
[0041] The spatiotemporal feature calibration module includes a spatiotemporal attention mechanism, which can be used to perform spatiotemporal calibration on the fused feature matrix. See below for reference. Figure 3 This section will introduce the process of constructing the spatiotemporal calibration feature matrix.
[0042] Figure 3 A flowchart illustrating the steps for constructing the spatiotemporal calibration feature matrix provided in this application embodiment is shown, as follows: Figure 3 As shown, the steps for constructing the spatiotemporal calibration feature matrix include: Step S1021: Perform global pooling on each feature channel of the fused feature matrix to obtain feature descriptors.
[0043] During the compression stage, global average pooling and max pooling are performed on each feature channel of the fused feature matrix, and 658×2 feature descriptors are generated by aggregating them according to the road segment dimension to extract the global feature pattern and local feature pattern of the road segment.
[0044] Step S1022: Convert the feature descriptor into a channel weight vector for quantifying the causal contribution of each feature channel.
[0045] During the activation phase, the feature descriptors are input into a two-layer fully connected network, and then the LeakyReLU activation function and the Sigmoid activation function are used to map the feature descriptors to the [0,1] interval. Through cross-channel aggregation, a 1×8-dimensional spatiotemporal channel weight vector is obtained to quantify the causal contribution of each feature.
[0046] Step S1023: Weight the channel weight vector with the fusion feature matrix to obtain the spatiotemporal calibration feature matrix.
[0047] During the recalibration phase, the spatiotemporal channel weight vector and the fusion feature matrix are weighted element-wise by Hadamard product to strengthen core causal features such as traffic and events, and weaken redundant interference such as time period and weekday, resulting in a 658×8 spatiotemporal calibration feature matrix.
[0048] Step S103: Based on the individual causal effects of abnormal events and historical traffic spatiotemporal state data, determine the temporal feature representation; based on the spatiotemporal calibration feature matrix and the temporal feature representation, determine the dynamic causal adjacency matrix to reflect the causal relationship between road segments.
[0049] The time feature extraction module is used to extract time feature representations, and the dynamic causal adjacency matrix generation module is used to generate dynamic causal adjacency matrices, which are also called dynamic causal graph adjacency matrices.
[0050] Before determining the temporal characteristics, we can first determine the dynamic individual causal effects.
[0051] Specifically, the samples of abnormal events occurring in the current abnormal event information are used as the processing group, and samples without events in the historical period are used as the control group through K-nearest neighbor matching; the traffic flow of the processing group and the traffic flow of the control group in the same road segment are compared to determine the individual causal effect of abnormal events; the individual causal effect of abnormal events is unbiasedly corrected to obtain the dynamic individual causal effect.
[0052] For example, using "when an abnormal event occurs on the same road segment" as the processing condition (T=1), the traffic flow data of the corresponding time period is extracted as the processing group result y(1), resulting in a set of 658 road segments, with one y(1) for each road segment. Then, a control group is obtained through K-nearest neighbor matching. For example, using the fusion feature matrix as the matching basis, for each road segment's processing group sample, historical traffic flow data of "same road segment, similar time period, no abnormal event" (T=0) is matched as the control group result y(0), ensuring that the processing group and the control group are the same in terms of road segment attributes and spatiotemporal characteristics.
[0053] Then, based on the sample pair (y(1), y(0)), the Individual Treatment Effect (ITE) of each road segment is calculated according to the core formula of the Potential Outcome Framework (RCM). ITE directly quantifies the traffic change caused by abnormal events in a single road segment. A positive value indicates that the event increases traffic, and a negative value indicates that traffic decreases.
[0054] Since there may still be a bias in the feature distribution between the treatment group and the control group for each sample pair, the sample weights can be calculated based on the fusion feature matrix. The feature distributions of the treatment group and the control group can be adjusted using the sample weights to make the feature distributions of the treatment group and the control group more consistent, eliminate the residual influence of confounding variables, and ensure that the calculation of ITE is unbiased.
[0055] Road segments are grouped according to preset conditions (such as road segment type, time period, and scope of event impact). The weighted conditional mean of the ITE within each group is calculated based on sample weights, which is the conditional average causal effect (CATE) of the ITE. The weighting operation can correct for distribution bias, so that CATE can accurately reflect the average causal effect of abnormal events on road segment traffic under specific conditions.
[0056] Finally, using CATE as the unbiased static average benchmark for each group, the original ITE is subjected to benchmark constraints and dynamic deviation correction to generate dynamic individual causal effects that fit the real-time state of the road segment.
[0057] The following reference Figure 4 This section will introduce the process of determining the temporal characteristic representation.
[0058] Figure 4 A flowchart illustrating the steps for determining the time feature representation provided in an embodiment of this application is shown, as follows: Figure 4 As shown, the steps for determining the temporal feature representation include: Step S1031: Linearly map the individual causal effects of abnormal events and the spatiotemporal state data of historical traffic to a low-dimensional space to generate the current time query vector, the historical event key vector, and the historical event value vector.
[0059] Using the individual causal effects of abnormal events and historical traffic spatiotemporal state data as input data, the input data is mapped to a 64-dimensional low-dimensional space through a fully connected layer. Based on the weight matrices WQ, WK, and WV, the input data in the low-dimensional space is linearly transformed to generate the current event query vector Q, the historical event key vector K, and the historical event value vector V.
[0060] Among them, the current event query vector Q is a 658×64-dimensional vector used to represent the current individual characteristics; the historical event key vector K is a 658×12×64-dimensional vector used to represent the historical individual characteristics; the historical event value vector V is a 658×12×64-dimensional vector used to carry historical traffic spatiotemporal information; WQ, WK, and WV are learnable weight matrices that are automatically learned during the training process of the traffic prediction model to adapt to the causal relationship between the current event and the historical event.
[0061] Step S1032: Using the scaling dot product attention mechanism, similarity metric and weight normalization are performed on the current time query vector, historical event key vector, and historical event value vector to obtain attention features.
[0062] A scaled dot product attention mechanism is used to calculate attention weights (658×1×12). For example, the dot product of the current event query vector Q and the transpose of the historical event key vector K is calculated to determine the attention similarity. The original attention similarity is then divided by the scaling factor. (d represents the feature dimension of 64) to perform dimensional scaling optimization. Simultaneously, the 1×12 dimensional scaled attention similarity corresponding to each current individual is softmax normalized along the dimensions of the 12 historical individuals, mapping the attention similarity to a probability distribution with values in the (0,1) interval and a row sum of 1, i.e., attention weight. A larger attention weight indicates a stronger association between the current individual and that historical individual. Here, the current event query vector Q is a 658×64 dimensional vector, representing the existence of 658 current individuals, with 64 dimensions representing the dimension of the encoded feature vector for each current individual.
[0063] Then, the final attention weights are used as coefficients and weighted summed with the historical event value vector V to obtain the attention features.
[0064] Step S1033: Capture the flow fluctuation pattern of attention features in different periods to obtain temporal feature representation.
[0065] Attention features are input into three parallel dilated causal convolutional networks (diffraction rates of 1, 3, and 6) to capture short-term, medium-term, and long-term traffic fluctuation patterns, respectively. Each dilated causal convolutional network is paired with skip connections and residual connections to preserve original features and avoid gradient vanishing. The output vector of each dilated causal convolutional network has a dimension of 658×1×64. The three output vectors are concatenated to obtain a multi-scale temporal feature of 658×1×192.
[0066] Then, effective features of multi-scale time features are extracted through gating units (including tanh transformation and σ screening), the feature dimension of effective features is compressed by pooling layers, and then input into fully connected layers for optimization to obtain a time feature representation (658×1×64) that integrates historical event experience and causal reweighting results, and simultaneously outputs the spatiotemporal hidden state for iteration of the dynamic causal relationship generator.
[0067] The following reference Figure 5 This section will introduce the process of determining the dynamic causal adjacency matrix.
[0068] Figure 5A flowchart illustrating the steps for determining the dynamic causal adjacency matrix provided in an embodiment of this application is shown, as follows: Figure 5 As shown, the steps for determining the dynamic causal adjacency matrix include: Step S1034: Based on the current road network data, determine the traffic flow time series of each road segment, and determine the initial adjacency matrix based on the Spearman correlation coefficient of the traffic flow time series of every two target road segments.
[0069] The target road network includes multiple road segments. For each road segment, the flow rate sequence is extracted and sorted according to a unified time axis to obtain the flow rate time series. Each element in the flow rate time series corresponds to the flow rate value of the road segment at a certain time point, which is the basis for the subsequent calculation of the Spearman correlation coefficient.
[0070] The initial adjacency matrix is generated by calculating the Spearman correlation coefficient of the traffic time series of any two road segments. When the Spearman correlation coefficient is greater than or equal to 0.55, the elements in the initial adjacency matrix are assigned the value 1; when the Spearman correlation coefficient is less than 0.55, the elements in the initial adjacency matrix are assigned the value 0.
[0071] Step S1035: Perform a linear transformation on the spatiotemporal calibration feature matrix and the time feature representation to obtain the dynamic correlation representation.
[0072] The spatiotemporal calibration feature matrix and time feature representation are input into the dynamic causal relationship generator, and a dynamic correlation representation is obtained through linear transformation. The dynamic correlation representation integrates the current spatiotemporal calibration features of the road network and the deep hidden features of historical time, which can accurately depict the causal relationship between road segments in the road network that changes over time. This makes up for the inherent defects of the static adjacency matrix and supplements the road network traffic analysis with auxiliary correlation features that are dynamic, causal, and spatiotemporally integrated.
[0073] Step S1036: Determine the causal correlation matrix based on the spatiotemporal calibration feature matrix and dynamic correlation representation.
[0074] Based on the spatiotemporal calibration feature matrix and dynamic correlation representation, dual feature vectors are extracted for any pair of road segments in the road network, and the mutual information entropy of the dual feature vectors corresponding to each pair of road segments is calculated. The spatiotemporal calibration feature vector and the dynamic correlation representation vector of a single road segment are concatenated to form the causal correlation comprehensive feature vector of that road segment, and the cosine similarity of the comprehensive feature vectors corresponding to each pair of road segments is calculated.
[0075] The mutual information entropy and cosine similarity are normalized, and then a weighted fusion method is used to sum the normalized mutual information entropy and cosine similarity to obtain the comprehensive causal similarity. A causal similarity threshold (e.g., 0.5) is set, and the causal similarity of all road segment pairs in the road network is iterated. If the causal similarity is greater than or equal to the threshold, it is determined that the road segment pair has a significant traffic causal relationship, i.e., a valid causal relationship exists; if the causal similarity is less than the threshold, it is determined that the road segment pair does not have a traffic causal relationship, i.e., no valid causal relationship exists.
[0076] Each road segment in the road network is regarded as a graph node. Based on the determination of whether there is a valid causal relationship between road segments, causal relationship edges are marked for road segments that are determined to be validly related in the graph structure representation of the road network, and finally a road network graph with causal relationship edges is obtained. The causal connections between road segment nodes in the road network diagram are transformed into element values of a numerical matrix to obtain the causal correlation matrix.
[0077] Step S1037: Using an adaptive weight fusion mechanism, the causal association matrix, the initial adjacency matrix, and the dynamic association representation are fused to obtain the dynamic causal adjacency matrix.
[0078] The causal correlation matrix, the initial adjacency matrix, and the dynamic correlation representation are weighted and fused according to a specified weight ratio to generate a causal fusion matrix that takes into account the road network physical topology, traffic causal correlation, and dynamic feature dependence.
[0079] By eliminating weakly correlated edges through graph Laplacian regularization and performing row normalization on the causal fusion matrix, a dynamic causal adjacency matrix with a dimension of 658×658 is generated. This dynamic causal adjacency matrix can adaptively adapt to dynamic changes in the road network, such as tidal flow in the business district and temporary traffic control, and accurately reflect the causal dependencies between road segments, rather than simply statistical correlations.
[0080] Step S104: Determine the spatial feature representation based on the dynamic causal adjacency matrix and the spatiotemporal calibration feature matrix.
[0081] The spatial feature extraction module is used to extract spatial feature representations. See below for reference. Figure 6 This section will introduce the process of determining spatial feature representations.
[0082] Figure 6 A flowchart illustrating the steps for determining spatial feature representation provided in embodiments of this application is shown, such as... Figure 6 As shown, the steps for determining spatial feature representation include: Step S1041: Concatenate the spatiotemporal calibration feature matrix with the adaptive node embedding matrix to obtain node features.
[0083] The spatiotemporal calibration feature matrix is concatenated with the adaptive node embedding matrix to obtain 658×40 node features, which are then directly passed to subsequent layers through skip connections to preserve the basic features.
[0084] The adaptive node embedding matrix is obtained through self-learning after random initialization. For example, two initial node embedding matrices E1 and E2 are randomly initialized (both have a dimension of 658×d, where d is the embedding dimension). The initial association matrix is calculated based on the initial node embedding matrix. After inputting the initial association matrix into ReLU activation to eliminate weak connections, each row element is normalized by Softmax to obtain the adaptive node embedding matrix.
[0085] Step S1042: Using the dynamic causal adjacency matrix as the topological constraint, a two-layer graph convolutional network is used to perform neighbor-weighted aggregation of node features to obtain the initial spatial features.
[0086] A two-layer graph convolutional network (GCN) is employed, using a dynamic causal adjacency matrix as a topological constraint, to perform neighbor-weighted aggregation of node features to obtain initial spatial features. The first GCN layer maps node features to 128 dimensions, while the second GCN layer further extracts higher-order spatial relationships.
[0087] Step S1043: Weighted aggregation of attention features and initial spatial features is performed to obtain spatial feature representation.
[0088] Attention features and initial spatial features are input into a graph attention network (GAT). Attention coefficients between nodes and their first- and second-order neighbors are calculated. These attention coefficients are then used to weight and aggregate the attention features and initial spatial features to obtain spatial fusion features, thereby enhancing the feature contribution of core associated road segments. Here, a node can refer to a pair of road segments with causal edges in a dynamic causal adjacency matrix, which serves as the topological basis for the node. First- and second-order neighbors can refer to the hierarchical extension of the adjacency relationship.
[0089] The spatial fusion feature dimension is compressed by combining 1×1 convolution, ReLU, and 1×1 convolution. The compressed spatial fusion feature is then input into the residual connection layer. The residual connection layer integrates the skip connection feature, that is, it merges the previous core feature (skip connection feature) that skips the current convolution compression with the spatial fusion feature after the current convolution processing to obtain a 658×64 spatial feature representation. This spatial feature representation can accurately reflect the spatial dependency relationship between the road segment and the surrounding road network.
[0090] Step S105: Using the dynamic causal adjacency matrix, temporal feature representation, and spatial feature representation, determine the traffic prediction results of the target road network at future time points.
[0091] The speed prediction module is used to determine the traffic prediction results, as shown below. Figure 7 This section will introduce the process of determining the traffic forecast results.
[0092] Figure 7 A flowchart illustrating the steps for determining the traffic prediction results provided in this application embodiment is shown, as follows: Figure 7 As shown, the steps for determining the traffic forecast result include: Step S1051: Combine temporal and spatial feature representations to obtain spatiotemporal joint features.
[0093] The dynamic causal adjacency matrix, dynamic individual causal effect, non-normal event individual causal effect, conditional average causal effect (CATE), temporal feature representation, spatial feature representation, and fused feature matrix are input into the velocity prediction module. The velocity prediction module concatenates the temporal feature representation and spatial feature representation to obtain spatiotemporal joint features. The spatiotemporal joint features are then input into two convolutional layers, paired with skip connections, and compressed to 658×64 dimensions to obtain compressed spatiotemporal joint features.
[0094] Step S1052: The dynamic causal adjacency matrix and attention features are weighted and fused to obtain composite topological features.
[0095] The dynamic causal adjacency matrix and the attention feature (i.e., the graph attention matrix) are weighted and aggregated to obtain the composite topological feature.
[0096] Step S1053: Using a multilayer perceptron, analyze the spliced features of composite topological features and spatiotemporal joint features to obtain the traffic prediction results.
[0097] The composite topological features are concatenated with spatiotemporal joint features and CATE features to obtain concatenated features. These concatenated features are then input into a multi-layer perceptron (MLP) to obtain higher-order fusion features. The MLP consists of two hidden layers with 256 and 128 neurons, respectively. The higher-order fusion features are mapped through a fully connected layer to output a 658×6-dimensional spatiotemporal fusion prediction feature. Simultaneously, the predicted flow rates for the processing group and the control group are output to obtain the flow prediction results. The flow prediction results include the spatiotemporal prediction features, the predicted flow rates for the processing group, and the predicted flow rates for the control group.
[0098] The traffic flow prediction method for urban road networks under abnormal events provided in this application can distinguish the causal relationship between abnormal events and speed changes, avoiding misjudging the correlation caused by confounding factors as a causal relationship. At the same time, it adopts a dynamic causal adjacency matrix for road network speed prediction, which can adapt to the dynamic changes of urban road network topology. Furthermore, it introduces the individual causal effect of abnormal events, accurately quantifies the differentiated impact of different abnormal events on speed, and improves the prediction accuracy of urban road network speed. Compared with existing traffic flow prediction methods for urban road networks under abnormal events, it solves the problem of low prediction accuracy of urban road network speed.
[0099] Based on the same inventive concept, this application also provides an urban road network traffic prediction device under abnormal events, which corresponds to the traffic prediction method under abnormal events in urban road networks. Since the principle of the device in this application is similar to the traffic prediction method under abnormal events in urban road networks described above, the implementation of the device can refer to the implementation of the method, and the repeated parts will not be described again.
[0100] Please see Figure 8 , Figure 8 This is a schematic diagram of a traffic flow prediction device for abnormal events in an urban road network, provided as an embodiment of this application. Figure 8 As shown, the traffic flow prediction device 200 for abnormal events in the urban road network includes: The data preprocessing module 201 is used to acquire the current road network data and current abnormal event information of the target road network, and to construct a fusion feature matrix based on the current road network data and current abnormal event information; Feature calibration module 202 is used to perform spatiotemporal calibration on the fused feature matrix using a spatiotemporal attention mechanism to obtain a spatiotemporal calibration feature matrix; The time feature extraction module 203 is used to determine time feature representations based on the individual causal effects of abnormal events and historical traffic spatiotemporal state data, and to determine a dynamic causal adjacency matrix that reflects the causal relationship between road segments based on the spatiotemporal calibration feature matrix and the time feature representations. The spatial feature extraction module 204 is used to determine spatial feature representations based on the dynamic causal adjacency matrix and the spatiotemporal calibration feature matrix. The speed prediction module 205 is used to determine the traffic prediction results of the target road network at future time by utilizing the dynamic causal adjacency matrix, time feature representation and spatial feature representation.
[0101] Please see Figure 9 , Figure 9 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Figure 9 As shown, the electronic device 300 includes a processor 310, a memory 320, and a bus 330.
[0102] The memory 320 stores machine-readable instructions executable by the processor 310. When the electronic device 300 is running, the processor 310 and the memory 320 communicate via the bus 330. When the machine-readable instructions are executed by the processor 310, they can perform the operations described above. Figure 1 The steps of the traffic flow prediction method under abnormal events in the urban road network shown in the method embodiment can be found in the method embodiment for specific implementation, and will not be repeated here.
[0103] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, can perform the above-described actions. Figure 1 The steps of the traffic flow prediction method under abnormal events in the urban road network shown in the method embodiment can be found in the method embodiment for specific implementation, and will not be repeated here.
[0104] Those skilled in the art will understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0105] In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. The apparatus embodiments described above are merely illustrative. For example, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. Furthermore, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Additionally, the shown or discussed mutual couplings, direct couplings, or communication connections may be through some communication interfaces; indirect couplings or communication connections between devices or units may be electrical, mechanical, or other forms.
[0106] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0107] In addition, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit.
[0108] If the aforementioned functions are implemented as software functional units and sold or used as independent products, they can be stored in a processor-executable, non-volatile, computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or a portion of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this application. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0109] Finally, it should be noted that the above-described embodiments are merely specific implementations of this application, used to illustrate the technical solutions of this application, and not to limit them. The scope of protection of this application is not limited thereto. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that any person skilled in the art can still modify or easily conceive of changes to the technical solutions described in the foregoing embodiments, or make equivalent substitutions for some of the technical features, within the scope of the technology disclosed in this application. Such modifications, changes, or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be covered within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the scope of the claims.
Claims
1. A method for traffic flow prediction under abnormal events of urban road network, characterized in that, The method comprises the following steps: obtaining current road network data and current abnormal event information of a target road network, and constructing a fusion feature matrix based on the current road network data and the current abnormal event information; using a space-time attention mechanism to perform space-time calibration on the fusion feature matrix to obtain a space-time calibrated feature matrix; determining a time feature representation based on individual causal effects of abnormal events and historical traffic space-time state data, and determining a dynamic causal adjacency matrix reflecting causal correlations between road segments based on the space-time calibrated feature matrix and the time feature representation; determining a space feature representation based on the dynamic causal adjacency matrix and the space-time calibrated feature matrix; determining a traffic prediction result of the target road network at a future time by using the dynamic causal adjacency matrix, the time feature representation, and the space feature representation.
2. The method of claim 1, wherein, The step of constructing a fusion feature matrix based on the current road network data and the current abnormal event information comprises the following steps: constructing an initial fusion feature matrix based on the current road network data and the current abnormal event information; constructing a causal graph based on a structural causal model and a pre-door criterion; verifying the structured features of the causal graph by using the initial fusion feature matrix to obtain a fusion feature matrix.
3. The method of claim 1, wherein, The step of using a space-time attention mechanism to perform space-time calibration on the fusion feature matrix to obtain a space-time calibrated feature matrix comprises the following steps: performing global pooling processing on each feature channel of the fusion feature matrix to obtain a feature descriptor; converting the feature descriptor into a channel weight vector for quantifying the causal contribution degree of each feature channel; weighting the channel weight vector and the fusion feature matrix to obtain a space-time calibrated feature matrix.
4. The method of claim 1, wherein, The target road network comprises a plurality of road segments, and the step of determining a dynamic causal adjacency matrix reflecting causal correlations between road segments based on the space-time calibrated feature matrix and the time feature representation comprises the following steps: determining a traffic time series of each road segment based on the current road network data, and determining an initial adjacency matrix based on the Spearman correlation coefficients of the traffic time series of each two target road segments; performing linear transformation on the space-time calibrated feature matrix and the time feature representation to obtain a dynamic correlation representation; determining a causal correlation matrix based on the space-time calibrated feature matrix and the dynamic correlation representation; fusing the causal correlation matrix, the initial adjacency matrix, and the dynamic correlation representation by using an adaptive weight fusion mechanism to obtain a dynamic causal adjacency matrix.
5. The method of claim 1, wherein, The dynamic individual causal effect is determined in the following manner: taking samples of abnormal events occurring in the current abnormal event information as a treatment group, and taking samples of historical periods without events as a control group through K-nearest neighbor matching; comparing the traffic of the treatment group with the traffic of the control group in the same road segment to determine the individual causal effect of abnormal events; performing unbiased correction on the individual causal effect of abnormal events to obtain a dynamic individual causal effect.
6. The method of claim 1, wherein, The step of determining a time feature representation based on individual causal effects of abnormal events and historical traffic space-time state data comprises the following steps: linearly mapping the abnormal event individual causal effect and historical traffic spatio-temporal state data to a low-dimensional space to generate a current time query vector, a historical event key vector, and a historical event value vector; using a scaled dot-product attention mechanism to perform similarity quantization and weight normalization processing on the current time query vector, the historical event key vector, and the historical event value vector to obtain attention features; capturing traffic fluctuation rules of the attention features at different periods to obtain time feature representations.
7. The method of claim 6, wherein, The step of determining the spatial feature representation based on the dynamic causal adjacency matrix and the spatio-temporal calibration feature matrix comprises: concatenating the spatio-temporal calibration feature matrix and an adaptive node embedding matrix to obtain node features; using a two-layer graph convolution network to perform neighbor weighted aggregation on the node features under the topological constraint of the dynamic causal adjacency matrix to obtain initial spatial features; performing weighted aggregation on the attention features and the initial spatial features to obtain a spatial feature representation.
8. The method of claim 6, wherein, The step of determining the traffic prediction result of the target road network at a future time using the dynamic causal adjacency matrix, the time feature representation, and the spatial feature representation comprises: concatenating the time feature representation and the spatial feature representation to obtain a spatio-temporal joint feature; performing weighted fusion on the dynamic causal adjacency matrix and the attention features to obtain a composite topological feature; using a multi-layer perception to analyze the concatenated feature of the composite topological feature and the spatio-temporal joint feature to obtain a traffic prediction result.
9. An urban road network traffic flow prediction device under abnormal events, characterized in that, comprises: a data preprocessing module configured to acquire current road network data and current abnormal event information of a target road network, and construct a fusion feature matrix based on the current road network data and the current abnormal event information; a feature calibration module configured to calibrate the fusion feature matrix in space and time using a spatio-temporal attention mechanism to obtain a spatio-temporal calibration feature matrix; a time feature extraction module configured to determine a time feature representation based on abnormal event individual causal effect and historical traffic spatio-temporal state data, and determine a dynamic causal adjacency matrix reflecting causal correlation between road segments based on the spatio-temporal calibration feature matrix and the time feature representation; a spatial feature extraction module configured to determine a spatial feature representation based on the dynamic causal adjacency matrix and the spatio-temporal calibration feature matrix; a speed prediction module configured to determine a traffic prediction result of the target road network at a future time using the dynamic causal adjacency matrix, the time feature representation, and the spatial feature representation.
10. An electronic device, comprising: comprises: a processor, a memory, and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating through the bus when the electronic device is running, and the processor executing the machine-readable instructions to perform the steps of the traffic prediction method for urban road networks under abnormal events according to any one of claims 1 to 8.