A traffic speed prediction method based on bidirectional interaction fusion space-time graph prompt
By constructing multi-scale time graphs and multi-relation space graphs, and combining them with graph attention mechanisms for feature interaction and fusion, the problem of insufficient accuracy and generalization ability of existing traffic speed prediction methods under complex urban road networks is solved, and more efficient traffic speed prediction is achieved.
Patent Information
- Application Number
- CN202610698466.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-05-20
- Publication Date
- 2026-08-25
AI Technical Summary
Existing traffic speed prediction methods struggle to balance prediction accuracy and generalization ability in complex urban road networks, and lack effective representation of the multi-scale characteristics and spatial dependencies of traffic speed.
A bidirectional interactive fusion spatiotemporal graph prompting method is adopted. By constructing multi-scale time graphs and multi-relation space graphs, and combining graph attention mechanism for feature modeling and interactive fusion, bidirectional interactive fusion spatiotemporal graph prompts are generated for traffic speed prediction.
It improves the accuracy and generalization ability of traffic speed prediction, especially in cross-time and cross-regional scenarios.
Smart Images

Figure CN122637583A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic spatiotemporal data prediction, and in particular to a traffic speed prediction method based on bidirectional interactive fusion spatiotemporal map prompts. Background Technology
[0002] With urbanization and the continuous growth of motor vehicle ownership, urban road traffic systems are becoming increasingly complex, and problems such as traffic congestion, travel delays, and low road resource utilization efficiency are becoming more prominent. Traffic speed is one of the key indicators for describing the operational status of roads, and accurate traffic speed prediction is of great significance for improving road traffic efficiency. Currently, commonly used speed prediction methods in engineering practice include statistical methods based on historical averages or rules, and time-series prediction methods based on traditional machine learning or deep learning models. However, in complex urban road networks, it is often difficult to balance prediction accuracy and generalization ability.
[0003] Existing research has gradually incorporated models such as spatiotemporal graph neural networks into traffic speed prediction to capture spatial correlations and temporal dependencies using road network topology and historical speed sequences. However, on the one hand, traffic speed exhibits multi-scale characteristics in the time dimension, including short-term fluctuations, diurnal periodicity, and long-term trends, demonstrating significant non-stationarity. Traditional models struggle to explicitly model these complex temporal patterns. On the other hand, spatial dependencies between roads stem not only from physical adjacency but also from implicit semantic associations such as functional similarity and similar flow patterns. Relying solely on a fixed road network structure to construct a spatiotemporal model often fails to fully depict the spatial propagation patterns of congestion. Furthermore, existing cue learning methods often employ uniform or static cue designs, lacking structured cue modeling and bidirectional interaction mechanisms for both temporal and spatial graphs. Therefore, it is necessary to utilize spatiotemporal graph cue structures to express temporal evolution patterns and spatial dependencies, and to enhance the model's spatiotemporal coupling representation capabilities through cue interaction to improve the accuracy and efficiency of traffic speed prediction. Summary of the Invention
[0004] Technical Problem: The purpose of this invention is to overcome the shortcomings of existing technologies and provide a traffic speed prediction method based on bidirectional interactive fusion spatiotemporal map prompts. This addresses the problem that existing traffic speed prediction methods are insufficient in expressing complex spatiotemporal coupling relationships and have limited prediction accuracy and generalization ability in distributed migration scenarios such as cross-time periods and cross-regions.
[0005] Technical Solution: To achieve the above objectives, a traffic speed prediction method based on bidirectional interactive fusion spatiotemporal map prompts is provided, comprising the following steps:
[0006] Step 1: Based on the road network data and historical traffic speed observation data of the target area, the road network data is structured to construct traffic spatial data; and the historical traffic speed observation data is processed for missing values, outliers, and time alignment to obtain historical traffic speed sequences. On this basis, samples are constructed from the historical traffic speed sequences based on a sliding time window to form a traffic speed prediction dataset including historical input sequences and corresponding future sequences to be predicted.
[0007] Step 2: Based on the historical traffic speed sequence obtained in Step 1, a multi-scale time map prompt generation module is used to construct a multi-scale time sub-map containing multiple time relationships in the time dimension, and multi-scale time map prompts are generated through feature modeling of the multi-scale time sub-map.
[0008] Step 3: Based on the traffic spatial data and historical traffic speed sequence in Step 1, construct a multi-relation spatial subgraph that simultaneously contains physical and semantic neighborhood relationships in the spatial dimension through the multi-relation spatial graph prompt generation module. Generate multi-relation spatial graph prompts through structure-aware feature aggregation.
[0009] Step 4: Align the multi-scale temporal graph hints from Step 2 with the multi-relationship spatial graph hints from Step 3 through the spatiotemporal graph hint alignment interaction module to achieve unified alignment of feature spaces. Then, through a bidirectional cross-attention mechanism, achieve bidirectional transmission of spatiotemporal information and gating weight fusion to form a bidirectional interactive fused spatiotemporal graph hint.
[0010] Step 5: Input the bidirectional interactive fusion spatiotemporal map prompts generated in Step 4 and the historical input sequences in the traffic speed prediction dataset in Step 1 into the traffic speed prediction module to predict traffic speed and output the future traffic speed prediction results.
[0011] In step 1, the process of constructing traffic spatial data involves abstracting the road network data of the target area into a graph. ,in, For a set of sensor nodes, each node The corresponding road network One sensor node, , This represents the number of sensor nodes. Let be the set of topologically connected edges of sensor nodes. If sensor nodes and If the roads are directly connected in the road topology, then Define the adjacency matrix ,like ,but ,otherwise ;
[0012] The historical traffic speed sequence is represented as a historical traffic speed observation matrix. ,in, Indicates the first Each sensor node at time Traffic speed observations The number of time steps for historical data. Define all sensors at the same time. The velocity sequence is Define the same sensor node The velocity sequence at all historical moments is ;
[0013] The process of constructing the traffic speed prediction dataset is as follows: in the traffic speed observation matrix In the time dimension, based on window length And a sliding segmentation with a step size of 1 is performed for any prediction time. ,structure set ,in For the length of the historical input, To predict the number of steps, and .
[0014] In step 1, the road network data of the target area is used to construct traffic spatial data G based on the actual connectivity between roads, with sensors as nodes and the connectivity between sensors as edges, and a corresponding adjacency matrix A is generated.
[0015] The historical traffic speed observation data is processed for missing values, outliers, and time alignment. Specifically, missing values and outliers are identified, and speed data corresponding to missing values and outliers are filled in by a weighted average of spatiotemporally neighboring nodes based on road network topology and temporal proximity. The traffic speed observation data is time aligned according to a preset sampling time interval to obtain a continuous and complete historical traffic speed sequence X.
[0016] The continuous and complete historical traffic speed sequence X is used to construct a traffic speed prediction dataset in the time dimension using a sliding window method based on the set historical window length H and prediction step number K. It is used for the construction of subsequent multi-scale time subgraphs and multi-relation space subgraphs, as well as for the training and prediction of traffic speed prediction models.
[0017] In step 2, the multi-scale time map prompt generation module constructs a multi-scale time sub-graph using historical traffic speed sequences and uses a graph attention mechanism to obtain multi-scale time map prompts.
[0018] The multi-scale temporal subgraph is defined as follows: the current time in the prediction task is... In the current sliding window The multi-scale time subplots on the corresponding windows of its historical cycles are as follows ;in, For multi-scale time sub-map point sets, For multi-scale time subgraph edge sets;
[0019] The multi-scale time subgraph point set Defined as a global time index set A specific subset, namely The multi-scale time subgraph point set is composed of the current observation node set. and historical cycle context node set It consists of two parts, namely ;in, , indicating the current history input window A series of consecutive time points; This represents the long-term period node that corresponds to the current window time step in history, where Indicates the period span, and indicates the relationship with The set of periodic time indices corresponding to each time index in history;
[0020] The multi-scale temporal subgraph edge set It is based on the node set The construction process includes three types of connection rules: local, trend, and periodic. When a node pair satisfies the corresponding rule, the corresponding edge is added to the multi-scale time subgraph edge set. For local edges, for the current set of observed nodes Any two time points in If their time index difference satisfies ,in To define a local receptive field, the edge is set to any two time points. Add multi-scale temporal subgraph edge sets For trend edges, targeting Any two non-locally adjacent time nodes The similarity between two time points is calculated based on historical traffic speed sequences. If the similarity is greater than a preset threshold, the similarity is considered. Then the edge Add edge set For a periodic edge, for any node within the current window... The corresponding node in the historical cycle context set ,satisfy Then the edge from the periodic node to the current node Add edge set ;
[0021] The multi-scale temporal graph cue generation process employs a feature encoding and aggregation method based on a graph attention mechanism, which includes... Layer feature propagation layer, and the first layer feature propagation layer, and the second layer feature propagation layer. The time node features output by the layer are used as the first Layer input, sensor node The initial time node characteristics are ,in, Represents sensor nodes At the time point Traffic speed observations; This indicates mapping scalar traffic speed observations to... A learnable feature mapping function for a 3D semantic feature space;
[0022] With the first Taking layers as an example, the graph attention mechanism is used in... The specific process of performing feature propagation and aggregation to generate multi-scale time-map hints is as follows:
[0023] For time nodes and its neighboring nodes Calculate attention scores and update node features, with the input being... Layer node features The output is the updated node features. For sensor nodes , No. The feature update process of the layer is as follows:
[0024] ;
[0025] in, Indicates in In the middle, with time nodes A set of time nodes directly connected by local edges, periodic edges, and trend edges; Trainable feature transformation matrix, It is a non-linear activation function. The normalized attention weights represent time points. For nodes The degree of impact;
[0026] The graph attention mechanism will pass through The features from each time point after the feature propagation layer are input into the readout layer to generate the final multi-scale time map cue. The importance of each node is scored to obtain weight coefficients, and the features from all time points are weighted and aggregated to output the sensor node. At any moment Multiscale time plot hints:
[0027] ;
[0028] in, For sensor nodes Adaptive importance weights; Indicates the process Time nodes after layer feature propagation The final feature representation; This is the set of time points corresponding to the current historical input window.
[0029] In step 3, the multi-relation space subgraph is defined as: for time... The One sensor, built with multi-relation space subgraph centered on ,in, For a multi-relation space subgraph point set, representing the relationship with the central sensor node. A set of sensor nodes with semantic and physical relationships; Let the edge set of the multi-relation space subgraph represent the edges connected to the central sensor node. A set of edges between sensor nodes that have semantic and physical relationships;
[0030] The aforementioned multi-relation space subgraph point set It consists of the union of three parts: the central node, the physical neighborhood node set, and the semantic neighborhood node set; for the physical neighborhood node, the sensor node set is traversed. Except for the central sensor node Other nodes ,in ,and ,calculate With the central node Shortest topological path distance If satisfied , To preset the physical neighborhood order, the node for The physical neighborhood nodes, will the nodes Add to physical neighborhood node set For semantic neighborhood nodes, calculate Other nodes in the current history window The velocity sequence within and the central node Based on the similarity of the velocity sequences, the sequences with the highest similarity are selected. Nodes Add it to the semantic neighborhood node set ;
[0031] The edge set of the multi-relation space subgraph is defined as the set of edges connecting nodes in the physical neighborhood node set and the semantic neighborhood node set to the center node. The edge set of the multi-relation space subgraph includes both the physical neighborhood edge set and the semantic neighborhood edge set; traversing the physical neighborhood node set... For each of these nodes ,in ,and , build Connecting the central node edge Add the edge to the physical neighborhood edge set and the edge The type is marked as physical edge Traverse the semantic neighborhood node set For each of these nodes ,in ,and Build connections and central node edge , will the side Add semantic neighborhood edge set and the edge The type is marked as semantic edge .
[0032] In step 3, the generation process of the multi-relation space graph hints employs a feature encoding and aggregation method based on a graph attention mechanism. This graph attention mechanism includes... Layer feature propagation layer, and the first layer feature propagation layer, and the second layer feature propagation layer. The spatial node features output by the first layer are used as the first layer's spatial node features. Layer input; for sensor nodes Its initial spatial node features are defined as follows: ,in, Represents sensor nodes Traffic speed sequence within the current historical input window, It is to make the length of Historical velocity sequence mapping to A learnable feature mapping function for a 3D semantic feature space;
[0033] With the first Taking a layer as an example, the graph attention mechanism is used in subgraphs of multi-relation space. The specific process of performing feature propagation and aggregation to generate a multi-relation space graph hint is as follows:
[0034] nodes within the subgraph and its neighboring nodes At any moment Multi-relation space subgraph Calculate attention weights and update node features; the input is the first node. Layer node features The output is the updated node features. Node features updated as follows:
[0035] ;
[0036] in, Indicates in In and space nodes The set of neighboring nodes directly connected by multi-relation edges; This is a trainable feature transformation matrix; It is a non-linear activation function; To normalize the attention weights, we represent the neighbor nodes. For nodes The degree of impact;
[0037] Will pass The spatial node features after layer graph attention encoding are input into the readout layer to generate the final multi-relation spatial graph cue. Node importance is scored to obtain weight coefficients, and the spatial node features are weighted and aggregated to output the sensor nodes. At any moment Multi-relation space graph hints:
[0038] ;
[0039] in, For sensor nodes For nodes Adaptive importance weights; Indicates the process Spatial nodes after layer feature propagation The final characteristic representation.
[0040] In step 4, the multi-scale temporal graph hints and multi-relational spatial graph hints are aligned and fused through the spatiotemporal graph hint alignment and interaction module to obtain a bidirectional interactive fused spatiotemporal graph hint:
[0041] The spatiotemporal graph prompt alignment interaction module includes: a feature mapping unit, a distribution alignment unit, a bidirectional cross-attention interaction mechanism, and an adaptive gating fusion unit. The specific process is as follows:
[0042] Based on all within the target area Multiple relational space graph hints for individual sensor nodes The processing procedure of the feature mapping unit is as follows:
[0043] Will Construct the timeline along the node dimension according to the sensor node index order. Full-graph multi-relation space graph hint matrix Similarly, based on multi-scale time-map cues, a full-map multi-scale time-map cues matrix is constructed. Next, a linear mapping layer projects both onto a unified [plane / plane]. The 3D feature space is calculated using the following formula:
[0044] ;
[0045] ;
[0046] in, and respectively after mapping Full-scale temporal and spatial plot hint matrices; , The projective weight matrix is a learnable matrix. , For bias terms;
[0047] The result of processing the feature mapping unit , The distribution alignment unit processing procedure is as follows:
[0048] The hints after linear mapping are subjected to layer normalization to ensure that the multi-relation space graph hints and multi-scale time graph hints have similar statistical distributions in the same feature space. The calculation formula is as follows:
[0049] ;
[0050] ;
[0051] in, , For layer normalization function;
[0052] Results of processing distributed alignment units , The processing procedure of the bidirectional cross-attention interaction mechanism is as follows:
[0053] First, use the full-map spatial diagram to suggest the matrix. As a query, use the full-map timeline to suggest the matrix. Using these as keys and values, we compute the global attention of space to time, extracting the temporal evolution features most relevant to the current spatial structure. :
[0054] ;
[0055] Secondly, the matrix is indicated by a reverse full-time graph. As a query, the full-map spatial graph hint matrix As keys and values, extract the spatial distribution features that best match the current time pattern. :
[0056] ;
[0057] in ;
[0058] The adaptive gating fusion unit generates a bidirectional interactive fusion spatiotemporal graph prompting process as follows:
[0059] First, the interaction features from both directions are concatenated along the feature dimension, and then a gating coefficient matrix is generated using a linear layer and an activation function. :
[0060] ;
[0061] ;
[0062] in, and These are the parameters of the gating network; Use the Sigmoid activation function; This indicates element-wise multiplication; This provides a hint for the final bidirectional interactive fusion spatiotemporal graph.
[0063] In step 5, the historical input sequence and the two-way interactive fusion spatiotemporal map prompts in the traffic speed prediction dataset are input into the traffic speed prediction module to predict the future traffic speed sequence.
[0064] The traffic speed prediction mentioned above: at the prediction time is At that time, the model learns by using the historical input sequence in the traffic speed prediction dataset as the model input and the future speed sequence in the traffic speed prediction dataset as the supervised target, and outputs the corresponding future speed prediction results.
[0065] Define the central time of traffic speed prediction dataset The input sequence is ,in, This represents the number of sensor nodes. For the length of the historical input, Indicates time Traffic speed observation vectors for all sensor nodes;
[0066] Define the central time of traffic speed prediction dataset The target output sequence is in, To predict the number of steps;
[0067] Will The suggestion is to enhance the input traffic speed prediction backbone model, calculate the parameter updates using backpropagation with the loss function gradient, and thus obtain the prediction output, denoted as . ;
[0068] The traffic speed prediction backbone model is a spatiotemporal modeling network for traffic speed prediction, including time-dependent modeling, spatial-dependent modeling, and spatiotemporal fusion and output: Time-dependent modeling is used to encode the time features of historical input sequences, extract short-term dynamic changes and multi-scale time-dependent features, and output time representation features; Spatial-dependent modeling is used to propagate and aggregate information between sensor nodes according to traffic spatial relationships and learnable spatial associations, model spatial propagation and cross-node correlations, and output spatial representation features; Spatiotemporal fusion and output is used to fuse time representation features and spatial representation features, and generate traffic speed prediction output results for multiple future time steps.
[0069] In step 5, the traffic speed prediction module includes a prompt enhancement input construction unit, a traffic speed prediction backbone model, and a loss function and training / optimization unit. The specific implementation process is as follows:
[0070] The processing procedure of the aforementioned prompt enhancement input building unit is as follows: The traffic speed prediction data is centralized at specific times. input sequence Received by stacking in batches Where B is the batch size, it is projected onto the map using an embedding map. In the feature space, we obtain the historical feature tensor. Simultaneously, obtain the bidirectional interactive fusion spatiotemporal graph prompts output from step 4. And expands to the time dimension Finally, feature fusion is used to... and The input features of the enhanced backbone model are obtained by concatenating and fusing them along the feature dimension.
[0071] ;
[0072] in, This indicates that on the feature dimension... and A feature fusion function is used to concatenate and fuse features through learnable mappings. ;
[0073] The processing procedure of the traffic speed prediction backbone model is as follows: The input is enhanced with prompts. Input into the traffic speed prediction backbone model Output the future time t Traffic speed prediction results for steps:
[0074] ;
[0075] in ;
[0076] The loss function and training / tuning unit are used to base predictions on the results. With target output Construct training objectives, Depend on The parameters of the traffic speed prediction backbone model are updated by batch stacking to gradually reduce the prediction error. Further optimization of the traffic speed prediction backbone model parameters is performed under different data distributions or task settings to obtain stable prediction performance. The loss function and training / tuning units include prediction loss. And comparative loss ;
[0077] During training and tuning, relevant parameters and backbone model parameters are updated by minimizing a weighted combination of multiple losses;
[0078] ;
[0079] in, and This is the loss weighting coefficient.
[0080] The predicted loss Used to supervise and constrain the consistency between the predicted output and the actual output; the contrastive loss To enhance the consistency and robustness of the cue representation, the cue-related parameters and backbone model parameters are updated by minimizing a weighted combination of multiple losses during training and tuning. To reduce the impact of missing values or abnormally low values on training, a mask tensor is introduced. The mean absolute error is calculated at the mask location to obtain the prediction loss:
[0081] ;
[0082] in This indicates element-wise multiplication. For numerically stable terms, Depend on Obtained by stacking in batches;
[0083] Construct using the original input and the prompted and enhanced input and , respectively representing the first The original input and the enhanced input of each sample are fused with the prompt generation and bidirectional interaction to obtain the prompt representation vector, where... , For batch size; where, For the first The prompt representation vector is obtained by reading out and aggregating the bidirectional interactive fusion spatiotemporal graph prompts corresponding to the original input samples. For the first The enhanced input of each sample prompt is followed by a bidirectional interactive fusion spatiotemporal graph prompt, which is then aggregated through readout to obtain a prompt representation vector. This prompt representation vector is then normalized using the L2 norm. The similarity score is defined as the dot product. Using a temperature coefficient of The contrastive learning objective yields the contrastive loss:
[0084] ;
[0085] in, Similarity between positive sample pairs of the same sample. Similarity of negative sample pairs composed of different samples.
[0086] Beneficial Effects: By adopting the above technical solution, this invention solves the problems of insufficient ability of existing traffic speed prediction methods to express complex spatiotemporal coupling relationships, and limited prediction accuracy and generalization ability in distributed migration scenarios such as cross-time periods and cross-regions. First, by acquiring road network data and historical traffic speed observation data of the target area, the road network data is structured to obtain traffic spatial data; the historical traffic speed observation data is processed to obtain historical traffic speed sequences, and a traffic speed prediction dataset is constructed based on a sliding time window; then, a multi-scale time subgraph is constructed based on the historical traffic speed sequences to obtain multi-scale time map hints; next, based on the traffic spatial data and historical traffic speed sequences, a multi-relationship spatial subgraph containing physical and semantic neighborhoods is constructed to obtain multi-relationship spatial map hints; then, the multi-scale time map hints and multi-relationship spatial map hints are fused through feature alignment, bidirectional attention mechanism interaction, and gating fusion to obtain a bidirectional interactive fused spatiotemporal map hint for representing traffic speed data; finally, the bidirectional interactive fused spatiotemporal map hints and the historical input sequence in the traffic speed data are input into the traffic speed prediction model to obtain the future traffic speed prediction result. The method is simple, clear, and easy to operate, and has wide applicability in this technical field. Attached Figure Description
[0087] Figure 1 This is a flowchart of the present invention. Detailed Implementation
[0088] The present invention will be further described below with reference to the embodiments shown in the accompanying drawings:
[0089] The present invention provides a traffic speed prediction method based on bidirectional interactive fusion spatiotemporal map prompts, comprising the following steps:
[0090] Step 1: Based on the road network data and historical traffic speed observation data of the target area, the road network data is structured to construct traffic spatial data; and the historical traffic speed observation data is processed for missing values, outliers, and time alignment to obtain historical traffic speed sequences. On this basis, samples are constructed from the historical traffic speed sequences based on a sliding time window to form a traffic speed prediction dataset including historical input sequences and corresponding future sequences to be predicted.
[0091] The process of constructing traffic spatial data involves abstracting the road network data of the target area into a graph. ,in, For a set of sensor nodes, each node The corresponding road network One sensor node, , This represents the number of sensor nodes. Let be the set of topologically connected edges of sensor nodes. If sensor nodes and If the roads are directly connected in the road topology, then Define the adjacency matrix ,like ,but ,otherwise ;
[0092] The historical traffic speed sequence is represented as a historical traffic speed observation matrix. ,in, Indicates the first Each sensor node at time Traffic speed observations The number of time steps for historical data. Define all sensors at the same time. The velocity sequence is Define the same sensor node The velocity sequence at all historical moments is ;
[0093] The process of constructing the traffic speed prediction dataset is as follows: in the traffic speed observation matrix In the time dimension, based on window length And a sliding segmentation with a step size of 1 is performed for any prediction time. ,structure set ,in For the length of the historical input, To predict the number of steps, and .
[0094] The specific steps for preprocessing road network data and historical traffic speed observation data of the target area to obtain traffic spatial data and traffic speed prediction dataset are as follows:
[0095] Step 1-1: Obtain road network data for the target area. Based on the actual connectivity between roads, construct traffic spatial data G using sensors as nodes and the connectivity between sensors as edges, and generate the corresponding adjacency matrix A.
[0096] Steps 1-2: Clean and fill the historical traffic speed observation data, identify missing and outlier values, and fill the missing speed data using a weighted average method of spatiotemporally neighboring nodes based on road network topology and temporal proximity to obtain a continuous and complete historical traffic speed sequence X.
[0097] Steps 1-3: Based on the set historical traffic speed sequence X, construct a traffic speed prediction dataset using a sliding window method in the time dimension according to the set historical window length H and prediction step number K. It is used for the construction of subsequent multi-scale time subgraphs and multi-relation space subgraphs, as well as for the training and prediction of traffic speed prediction models.
[0098] The road network data of the target area is used to construct traffic spatial data G based on the actual connectivity between roads, with sensors as nodes and the connectivity between sensors as edges, and a corresponding adjacency matrix A is generated.
[0099] The historical traffic speed observation data is processed for missing values, outliers, and time alignment. Specifically, missing values and outliers are identified, and speed data corresponding to missing values and outliers are filled in by a weighted average of spatiotemporally neighboring nodes based on road network topology and temporal proximity. The traffic speed observation data is time aligned according to a preset sampling time interval to obtain a continuous and complete historical traffic speed sequence X.
[0100] The continuous and complete historical traffic speed sequence X is used to construct a traffic speed prediction dataset in the time dimension using a sliding window method based on the set historical window length H and prediction step number K. It is used for the construction of subsequent multi-scale time subgraphs and multi-relation space subgraphs, as well as for the training and prediction of traffic speed prediction models.
[0101] Step 2: Based on the historical traffic speed sequence obtained in Step 1, a multi-scale time map prompt generation module is used to construct a multi-scale time sub-map containing multiple time relationships in the time dimension, and multi-scale time map prompts are generated through feature modeling of the multi-scale time sub-map.
[0102] The multi-scale time map prompt generation module uses historical traffic speed sequences to construct multi-scale time sub-graphs and employs a graph attention mechanism to obtain multi-scale time map prompts.
[0103] The multi-scale temporal subgraph is defined as follows: the current time in the prediction task is... In the current sliding window The multi-scale time subplots on the corresponding windows of its historical cycles are as follows ;in, For multi-scale time sub-map point sets, For multi-scale time subgraph edge sets;
[0104] The multi-scale time subgraph point set Defined as a global time index set A specific subset, namely The multi-scale time subgraph point set is composed of the current observation node set. and historical cycle context node set It consists of two parts, namely ;in, , indicating the current history input window A series of consecutive time points; This represents the long-term period node that corresponds to the current window time step in history, where Indicates the period span, and indicates the relationship with The set of periodic time indices corresponding to each time index in history;
[0105] The multi-scale temporal subgraph edge set It is based on the node set The construction process includes three types of connection rules: local, trend, and periodic. When a node pair satisfies the corresponding rule, the corresponding edge is added to the multi-scale time subgraph edge set. For local edges, for the current set of observed nodes Any two time points in If their time index difference satisfies ,in To define a local receptive field, the edge is set to any two time points. Add multi-scale temporal subgraph edge sets For trend edges, targeting Any two non-locally adjacent time nodes The similarity between two time points is calculated based on historical traffic speed sequences. If the similarity is greater than a preset threshold, the similarity is considered. Then the edge Add edge set For a periodic edge, for any node within the current window... The corresponding node in the historical cycle context set ,satisfy Then the edge from the periodic node to the current node Add edge set ;
[0106] The multi-scale temporal graph cue generation process employs a feature encoding and aggregation method based on a graph attention mechanism, which includes... Layer feature propagation layer, and the first layer feature propagation layer, and the second layer feature propagation layer. The time node features output by the layer are used as the first Layer input, sensor node The initial time node characteristics are ,in, Represents sensor nodes At the time point Traffic speed observations; This indicates mapping scalar traffic speed observations to... A learnable feature mapping function for a 3D semantic feature space;
[0107] With the first Taking layers as an example, the graph attention mechanism is used in... The specific process of performing feature propagation and aggregation to generate multi-scale time-map hints is as follows:
[0108] For time nodes and its neighboring nodes Calculate attention scores and update node features, with the input being... Layer node features The output is the updated node features. For sensor nodes , No. The feature update process of the layer is as follows:
[0109] ;
[0110] in, Indicates in In the middle, with time nodes A set of time nodes directly connected by local edges, periodic edges, and trend edges; Trainable feature transformation matrix, It is a non-linear activation function. The normalized attention weights represent time points. For nodes The degree of impact;
[0111] The graph attention mechanism will pass through The features from each time point after the feature propagation layer are input into the readout layer to generate the final multi-scale time map cue. The importance of each node is scored to obtain weight coefficients, and the features from all time points are weighted and aggregated to output the sensor node. At any moment Multiscale time plot hints:
[0112] ;
[0113] in, For sensor nodes Adaptive importance weights; Indicates the process Time nodes after layer feature propagation The final feature representation; This is the set of time points corresponding to the current historical input window.
[0114] Step 3: Based on the traffic spatial data and historical traffic speed sequences from Step 1, a multi-relationship spatial subgraph containing both physical and semantic neighborhood relationships is constructed in the spatial dimension using the multi-relationship spatial graph prompt generation module. Through structure-aware feature aggregation, multi-relationship spatial graph prompts are generated. The multi-relationship spatial graph prompts are then used to construct the multi-relationship spatial subgraph from the traffic spatial data and historical traffic speed sequences, and generate the multi-relationship spatial graph prompts.
[0115] The spatial graph prompt generation module constructs a multi-relational spatial subgraph that integrates physical topology and semantic association based on the traffic spatial data and historical traffic speed sequences from step 1, and introduces a structure-aware attention mechanism to obtain multi-relational spatial graph prompts.
[0116] The aforementioned multi-relation space subgraph is defined as: for time... The One sensor, built with multi-relation space subgraph centered on ,in, For a multi-relation space subgraph point set, representing the relationship with the central sensor node. A set of sensor nodes with semantic and physical relationships; Let the edge set of the multi-relation space subgraph represent the edges connected to the central sensor node. A set of edges between sensor nodes that have semantic and physical relationships;
[0117] The aforementioned multi-relation space subgraph point set Defined as the entire set of sensor nodes A subset, a set of points in a multi-relation space subgraph It consists of the union of three parts: the central node, the physical neighborhood node set, and the semantic neighborhood node set; for the physical neighborhood node, the sensor node set is traversed. Except for the central sensor node Other nodes ,in ,and ,calculate With the central node Shortest topological path distance If satisfied , To preset the physical neighborhood order, the node for The physical neighborhood nodes, will the nodes Add to physical neighborhood node set For semantic neighborhood nodes, calculate Other nodes in the current history window The velocity sequence within and the central node Based on the similarity of the velocity sequences, the sequences with the highest similarity are selected. Nodes Add it to the semantic neighborhood node set ;
[0118] The edge set of the multi-relation space subgraph is defined as the set of edges connecting nodes in the physical neighborhood node set and the semantic neighborhood node set to the center node. The edge set of the multi-relation space subgraph includes both the physical neighborhood edge set and the semantic neighborhood edge set; traversing the physical neighborhood node set... For each of these nodes ,in ,and , build Connecting the central node edge Add the edge to the physical neighborhood edge set and the edge The type is marked as physical edge Traverse the semantic neighborhood node set For each of these nodes ,in ,and Build connections and central node edge , will the side Add semantic neighborhood edge set and the edge The type is marked as semantic edge .
[0119] The generation process of the multi-relation space graph hints employs a feature encoding and aggregation method based on a graph attention mechanism. This graph attention mechanism includes... Layer feature propagation layer, and the first layer feature propagation layer, and the second layer feature propagation layer. The spatial node features output by the first layer are used as the first layer's spatial node features. Layer input; for sensor nodes Its initial spatial node features are defined as follows: ,in, Represents sensor nodes Traffic speed sequence within the current historical input window, It is to make the length of Historical velocity sequence mapping to A learnable feature mapping function for a 3D semantic feature space;
[0120] With the first Taking a layer as an example, the graph attention mechanism is used in subgraphs of multi-relation space. The specific process of performing feature propagation and aggregation to generate a multi-relation space graph hint is as follows:
[0121] nodes within the subgraph and its neighboring nodes At any moment Multi-relation space subgraph Calculate attention weights and update node features; the input is the first node. Layer node features The output is the updated node features. Node features updated as follows:
[0122] ;
[0123] in, Indicates in In and space nodes The set of neighboring nodes directly connected by multi-relation edges; This is a trainable feature transformation matrix; It is a non-linear activation function; To normalize the attention weights, we represent the neighbor nodes. For nodes The degree of impact;
[0124] Will pass The spatial node features after layer graph attention encoding are input into the readout layer to generate the final multi-relation spatial graph cue. Node importance is scored to obtain weight coefficients, and the spatial node features are weighted and aggregated to output the sensor nodes. At any moment Multi-relation space graph hints:
[0125] ;
[0126] in, For sensor nodes For nodes Adaptive importance weights; Indicates the process Spatial nodes after layer feature propagation The final characteristic representation.
[0127] Step 4: The multi-scale temporal graph hints from Step 2 and the multi-relationship spatial graph hints from Step 3 are aligned in feature space using the spatiotemporal graph hint alignment interaction module. Then, a bidirectional cross-attention mechanism is used to achieve bidirectional transmission of spatiotemporal information and gating weight fusion, forming a bidirectional interactive fused spatiotemporal graph hint. The bidirectional interactive fused spatiotemporal graph hints obtained after the multi-scale temporal graph hints and multi-relationship spatial graph hints are aligned and fused using the spatiotemporal graph hint alignment interaction module are as follows:
[0128] The spatiotemporal graph prompt alignment interaction module includes: a feature mapping unit, a distribution alignment unit, a bidirectional cross-attention interaction mechanism, and an adaptive gating fusion unit. The specific process is as follows:
[0129] Based on all within the target area Multiple relational space graph hints for individual sensor nodes The processing procedure of the feature mapping unit is as follows:
[0130] Will Construct the timeline along the node dimension according to the sensor node index order. Full-graph multi-relation space graph hint matrix Similarly, based on multi-scale time-map cues, a full-map multi-scale time-map cues matrix is constructed. Next, a linear mapping layer projects both onto a unified [plane / plane]. The 3D feature space is calculated using the following formula:
[0131] ;
[0132] ;
[0133] in, and respectively after mapping Full-scale temporal and spatial plot hint matrices; , The projective weight matrix is a learnable matrix. , For bias terms;
[0134] The result of processing the feature mapping unit , The distribution alignment unit processing procedure is as follows:
[0135] The hints after linear mapping are subjected to layer normalization to ensure that the multi-relation space graph hints and multi-scale time graph hints have similar statistical distributions in the same feature space. The calculation formula is as follows:
[0136] ;
[0137] ;
[0138] in, , For layer normalization function;
[0139] Results of processing distributed alignment units , The processing procedure of the bidirectional cross-attention interaction mechanism is as follows:
[0140] First, use the full-map spatial diagram to suggest the matrix. As a query, use the full-map timeline to suggest the matrix. Using these as keys and values, we compute the global attention of space to time, extracting the temporal evolution features most relevant to the current spatial structure. :
[0141] ;
[0142] Secondly, the matrix is indicated by a reverse full-time graph. As a query, the full-map spatial graph hint matrix As keys and values, extract the spatial distribution features that best match the current time pattern. :
[0143] ;
[0144] in ;
[0145] The adaptive gating fusion unit generates a bidirectional interactive fusion spatiotemporal graph prompting process as follows:
[0146] First, the interaction features from both directions are concatenated along the feature dimension, and then a gating coefficient matrix is generated using a linear layer and an activation function. :
[0147] ;
[0148] ;
[0149] in, and These are the parameters of the gating network; Use the Sigmoid activation function; This indicates element-wise multiplication; This provides a hint for the final bidirectional interactive fusion spatiotemporal graph.
[0150] Step 5: Input the bidirectional interactive fusion spatiotemporal map prompts generated in Step 4 and the historical input sequences in the traffic speed prediction dataset in Step 1 into the traffic speed prediction module to predict traffic speed and output the future traffic speed prediction results.
[0151] The historical input sequence from the traffic speed prediction dataset and the bidirectional interactive spatiotemporal map prompts are input into the traffic speed prediction module to predict future traffic speed sequences.
[0152] The traffic speed prediction mentioned above refers to the prediction of speeds based on a traffic speed prediction dataset at a given time. At that time, the model learns by using the historical input sequence in the traffic speed prediction dataset as the model input and the future speed sequence in the traffic speed prediction dataset as the supervised target, and outputs the corresponding future speed prediction results.
[0153] Define the central time of traffic speed prediction dataset The input sequence is ,in, This represents the number of sensor nodes. For the length of the historical input, Indicates time Traffic speed observation vectors for all sensor nodes;
[0154] Define the central time of traffic speed prediction dataset The target output sequence is in, To predict the number of steps;
[0155] Will The suggestion is to enhance the input traffic speed prediction backbone model, calculate the parameter updates using backpropagation with the loss function gradient, and thus obtain the prediction output, denoted as . ;
[0156] The traffic speed prediction backbone model is a spatiotemporal modeling network for traffic speed prediction, including time-dependent modeling, spatial-dependent modeling, and spatiotemporal fusion and output: Time-dependent modeling is used to encode the time features of historical input sequences, extract short-term dynamic changes and multi-scale time-dependent features, and output time representation features; Spatial-dependent modeling is used to propagate and aggregate information between sensor nodes according to traffic spatial relationships and learnable spatial associations, model spatial propagation and cross-node correlations, and output spatial representation features; Spatiotemporal fusion and output is used to fuse time representation features and spatial representation features, and generate traffic speed prediction output results for multiple future time steps.
[0157] The traffic speed prediction module includes a prompt enhancement input construction unit, a traffic speed prediction backbone model, and a loss function and training / optimization unit. The specific implementation process is as follows:
[0158] The processing procedure of the aforementioned prompt enhancement input building unit is as follows: The traffic speed prediction data is centralized at specific times. input sequence Received by stacking in batches Where B is the batch size, it is projected onto the map using an embedding map. In the feature space, we obtain the historical feature tensor. Simultaneously, obtain the bidirectional interactive fusion spatiotemporal graph prompts output from step 4. And expands to the time dimension Finally, feature fusion is used to... and The input features of the enhanced backbone model are obtained by concatenating and fusing them along the feature dimension.
[0159] ;
[0160] in, This indicates that on the feature dimension... and A feature fusion function is used to concatenate and fuse features through learnable mappings. ;
[0161] The processing procedure of the traffic speed prediction backbone model is as follows: The input is enhanced with prompts. Input into the traffic speed prediction backbone model Output the future time t Traffic speed prediction results for steps:
[0162] ;
[0163] in ;
[0164] The loss function and training / tuning unit are used to base predictions on the results. With target output Construct training objectives, Depend on The parameters of the traffic speed prediction backbone model are updated by batch stacking, gradually reducing the prediction error. Further optimization of the traffic speed prediction backbone model parameters is performed under different data distributions or task settings to obtain stable prediction performance. The loss function and training / tuning unit include prediction loss. And comparative loss During training and tuning, relevant parameters and backbone model parameters are updated by minimizing a weighted combination of multiple losses.
[0165] ;
[0166] in, and This is the loss weighting coefficient.
[0167] The predicted loss Used to supervise and constrain the consistency between the predicted output and the actual output; the contrastive loss To enhance the consistency and robustness of the cue representation, the cue-related parameters and backbone model parameters are updated by minimizing a weighted combination of multiple losses during training and tuning. To reduce the impact of missing values or abnormally low values on training, a mask tensor is introduced. The mean absolute error is calculated at the mask location to obtain the prediction loss:
[0168] ;
[0169] in This indicates element-wise multiplication. For numerically stable terms, Depend on Obtained by stacking in batches;
[0170] To align the cue representations of the same sample under different augmented views, we construct cue representations for the original view and the augmented view, denoted as follows: and Construct using the original input and the input enhanced by prompts and , respectively representing the first The original input and the enhanced input of each sample are fused with the prompt generation and bidirectional interaction to obtain the prompt representation vector, where... B represents the batch size; where, For the first The prompt representation vector is obtained by reading out and aggregating the bidirectional interactive fusion spatiotemporal graph prompts corresponding to the original input samples. For the first The suggestion representation vector is obtained by reading out and aggregating the bidirectional interactive fusion spatiotemporal graph suggestions corresponding to the enhanced input of each sample suggestion; and Let be the cue representation vector obtained from the fusion of cue generation and interaction, corresponding to the original input and the enhanced input, respectively. Then, perform L2 normalization on the cue representation vector: The similarity score is defined as the dot product. Using a temperature coefficient of The contrastive learning objective yields the contrastive loss:
[0171] ;
[0172] in, Similarity between positive sample pairs of the same sample. Similarity of negative sample pairs composed of different samples.
[0173] Experimental environment and hyperparameter settings: All experiments were implemented in Python on a server with an Nvidia RTX 5060 Ti GPU. The deep learning framework used was PyTorch 2.9.0, and the programming language was Python 3.10. During training, Adam was used to optimize the training. The initial learning rate was 0.001, the batch size was 64, and the number of layers in GAT was 4.
[0174] The above embodiments illustrate and describe the basic principles, main features, and advantages of the present invention. Those skilled in the art should understand that the above embodiments are specific examples of implementing the present invention, and in practical applications, various changes in form and detail can be made without departing from the spirit and scope of the invention.
Claims
1. A traffic speed prediction method based on bidirectional interactive fusion spatiotemporal map prompts, characterized in that: Includes the following steps: Step 1: Based on the road network data and historical traffic speed observation data of the target area, the road network data is structured to construct traffic spatial data; and the historical traffic speed observation data is processed for missing values, outliers, and time alignment to obtain historical traffic speed sequences. On this basis, samples are constructed from the historical traffic speed sequences based on a sliding time window to form a traffic speed prediction dataset including historical input sequences and corresponding future sequences to be predicted. Step 2: Based on the historical traffic speed sequence obtained in Step 1, a multi-scale time map prompt generation module is used to construct a multi-scale time sub-map containing multiple time relationships in the time dimension, and multi-scale time map prompts are generated through feature modeling of the multi-scale time sub-map. Step 3: Based on the traffic spatial data and historical traffic speed sequence in Step 1, construct a multi-relation spatial subgraph that simultaneously contains physical and semantic neighborhood relationships in the spatial dimension through the multi-relation spatial graph prompt generation module. Generate multi-relation spatial graph prompts through structure-aware feature aggregation. Step 4: Align the multi-scale temporal graph hints from Step 2 with the multi-relationship spatial graph hints from Step 3 through the spatiotemporal graph hint alignment interaction module to achieve unified alignment of feature spaces. Then, through a bidirectional cross-attention mechanism, achieve bidirectional transmission of spatiotemporal information and gating weight fusion to form a bidirectional interactive fused spatiotemporal graph hint. Step 5: Input the bidirectional interactive fusion spatiotemporal map prompts generated in Step 4 and the historical input sequences in the traffic speed prediction dataset in Step 1 into the traffic speed prediction module to predict traffic speed and output the future traffic speed prediction results.
2. The traffic speed prediction method based on bidirectional interactive fusion spatiotemporal map prompts according to claim 1, characterized in that: In step 1, the process of constructing traffic spatial data involves abstracting the road network data of the target area into a graph. ,in, For a set of sensor nodes, each node The corresponding road network One sensor node, , This represents the number of sensor nodes. Let be the set of topologically connected edges of sensor nodes. If sensor nodes and If the roads are directly connected in the road topology, then Define the adjacency matrix ,like ,but ,otherwise ; The historical traffic speed sequence is represented as a historical traffic speed observation matrix. ,in, Indicates the first Each sensor node at time Traffic speed observations The number of time steps for historical data. Define all sensors at the same time. The velocity sequence is Define the same sensor node The velocity sequence at all historical moments is ; The process of constructing the traffic speed prediction dataset is as follows: in the traffic speed observation matrix In the time dimension, based on window length And a sliding segmentation with a step size of 1 is performed for any prediction time. ,structure set ,in For the length of the historical input, To predict the number of steps, and .
3. A traffic speed prediction method based on bidirectional interactive fusion spatiotemporal map prompts according to claim 1 or 2, characterized in that: In step 1, the road network data of the target area is used to construct traffic spatial data G based on the actual connectivity between roads, with sensors as nodes and the connectivity between sensors as edges, and a corresponding adjacency matrix A is generated. The historical traffic speed observation data is processed for missing values, outliers, and time alignment. Specifically, missing values and outliers are identified, and speed data corresponding to missing values and outliers are filled in by a weighted average of spatiotemporally neighboring nodes based on road network topology and temporal proximity. The traffic speed observation data is time aligned according to a preset sampling time interval to obtain a continuous and complete historical traffic speed sequence X. The continuous and complete historical traffic speed sequence X is used to construct a traffic speed prediction dataset in the time dimension using a sliding window method based on the set historical window length H and prediction step number K. It is used for the construction of subsequent multi-scale time subgraphs and multi-relation space subgraphs, as well as for the training and prediction of traffic speed prediction models.
4. The traffic speed prediction method based on bidirectional interactive fusion spatiotemporal map prompts according to claim 1, characterized in that: In step 2, the multi-scale time map prompt generation module constructs a multi-scale time sub-graph using historical traffic speed sequences and uses a graph attention mechanism to obtain multi-scale time map prompts. The multi-scale temporal subgraph is defined as follows: the current time in the prediction task is... In the current sliding window The multi-scale time subplots on the corresponding windows of its historical cycles are as follows ;in, For multi-scale time sub-map point sets, For multi-scale time subgraph edge sets; The multi-scale time subgraph point set Defined as a global time index set A specific subset, namely The multi-scale time subgraph point set consists of the current observation node set. and historical cycle context node set It consists of two parts, namely ;in, , indicating the current history input window A series of consecutive time points; This represents the long-term period node that corresponds to the current window time step in history, where Indicates the period span, and indicates the period with The set of periodic time indices corresponding to each time index in history; The multi-scale temporal subgraph edge set It is based on the node set The construction process includes three types of connection rules: local, trend, and periodic. When a node pair satisfies the corresponding rule, the corresponding edge is added to the multi-scale time subgraph edge set. For local edges, for the current set of observed nodes Any two time points in If their time index difference satisfies ,in To define a local receptive field, the edge is set to any two time points. Add multi-scale temporal subgraph edge sets For trend edges, targeting Any two non-locally adjacent time nodes The similarity between two time points is calculated based on historical traffic speed sequences. If the similarity is greater than a preset threshold, the similarity is considered. Then the edge Add edge set For a periodic edge, for any node within the current window... The corresponding node in the historical cycle context set ,satisfy Then the edge from the periodic node to the current node Add edge set ; The multi-scale temporal graph cue generation process employs a feature encoding and aggregation method based on a graph attention mechanism, which includes... Layer feature propagation layer, and the first layer feature propagation layer, and the second layer feature propagation layer. The time node features output by the layer are used as the first Layer input, sensor node The initial time node characteristics are ,in, Represents sensor nodes At the time point Traffic speed observations; This indicates mapping scalar traffic speed observations to... A learnable feature mapping function for a 3D semantic feature space; With the first Taking layers as an example, the graph attention mechanism is used in... The specific process of performing feature propagation and aggregation to generate multi-scale time-map hints is as follows: For time nodes and its neighboring nodes Calculate attention scores and update node features, with the input being... Layer node features The output is the updated node features. For sensor nodes , No. The feature update process of the layer is as follows: ; in, Indicates in In the middle, with time nodes A set of time nodes directly connected by local edges, periodic edges, and trend edges; Trainable feature transformation matrix, It is a non-linear activation function. The normalized attention weights represent time points. For nodes The extent of the impact; The graph attention mechanism will pass through Features from each time point after the feature propagation layer are input into the readout layer to generate the final multi-scale time map cue. Node importance is scored to obtain weight coefficients, and the features from all time points are weighted and aggregated to output the sensor node. At any moment Multi-scale time plot hints: ; in, For sensor nodes Adaptive importance weights; Indicates the process Time nodes after layer feature propagation The final feature representation; This is the set of time points corresponding to the current historical input window.
5. The traffic speed prediction method based on bidirectional interactive fusion spatiotemporal map prompts according to claim 1, characterized in that: In step 3, the multi-relation space subgraph is defined as: for time... The One sensor, built with multi-relation space subgraph centered on ,in, For a multi-relation space subgraph point set, representing the relationship with the central sensor node. A set of sensor nodes with semantic and physical relationships; Let the edge set of the multi-relation space subgraph represent the edges connected to the central sensor node. A set of edges between sensor nodes that have semantic and physical relationships; The aforementioned multi-relation space subgraph point set It consists of the union of three parts: the central node, the physical neighborhood node set, and the semantic neighborhood node set; for the physical neighborhood node, the sensor node set is traversed. Except for the central sensor node Other nodes ,in ,and ,calculate With the central node Shortest topological path distance If satisfied , To preset the physical neighborhood order, the node for The physical neighborhood nodes, will the nodes Add to physical neighborhood node set For semantic neighborhood nodes, calculate Other nodes in the current history window The velocity sequence within and the central node Based on the similarity of the velocity sequences, the sequences with the highest similarity are selected. Nodes Add it to the semantic neighborhood node set ; The multi-relation space subgraph edge set is defined as the set of edges connecting nodes in the physical neighborhood node set and the semantic neighborhood node set to the center node. The multi-relation space subgraph edge set includes both the physical neighborhood edge set and the semantic neighborhood edge set; traversing the physical neighborhood node set... For each of these nodes ,in ,and , build Connecting the central node edge Add the edge to the physical neighborhood edge set and the edge The type is marked as physical edge Traverse the semantic neighborhood node set For each of these nodes ,in ,and Build connections and central node edge , will the side Add semantic neighborhood edge set and the edge The type is marked as semantic edge .
6. The traffic speed prediction method based on bidirectional interactive fusion spatiotemporal map prompts according to claim 1, characterized in that: In step 3, the generation process of the multi-relation space graph hints employs a feature encoding and aggregation method based on a graph attention mechanism. This graph attention mechanism includes... Layer feature propagation layer, and the first layer feature propagation layer, and the second layer feature propagation layer. The spatial node features output by the first layer are used as the first layer's spatial node features. Layer input; for sensor nodes Its initial spatial node features are defined as follows: ,in, Represents sensor nodes Traffic speed sequence within the current historical input window, It is to make the length of Historical velocity sequence mapping to A learnable feature mapping function for a 3D semantic feature space; With the first Taking a layer as an example, the graph attention mechanism is used in subgraphs of multi-relation space. The specific process of performing feature propagation and aggregation to generate a multi-relation space graph hint is as follows: nodes within the subgraph and its neighboring nodes At any moment Multi-relation space subgraph Calculate attention weights and update node features; the input is the first node. Layer node features The output is the updated node features. Node features updated as follows: ; in, Indicates in In and spatial nodes The set of neighboring nodes directly connected by multi-relation edges; This is a trainable feature transformation matrix; It is a non-linear activation function; To normalize the attention weights, we represent the neighbor nodes. For nodes The extent of the impact; Will pass The spatial node features after layer graph attention encoding are input into the readout layer to generate the final multi-relation spatial graph cue. Node importance is scored to obtain weight coefficients, and the spatial node features are weighted and aggregated to output the sensor nodes. At any moment Multi-relation space graph hints: ; in, For sensor nodes For nodes Adaptive importance weights; Indicates the process Spatial nodes after layer feature propagation The final characteristic representation.
7. A traffic speed prediction method based on bidirectional interactive fusion spatiotemporal map prompts according to claim 1, 4, or 6, characterized in that: In step 4, the multi-scale temporal graph hints and multi-relational spatial graph hints are aligned and fused through the spatiotemporal graph hint alignment and interaction module to obtain a bidirectional interactive fused spatiotemporal graph hint: The spatiotemporal graph prompt alignment interaction module includes: a feature mapping unit, a distribution alignment unit, a bidirectional cross-attention interaction mechanism, and an adaptive gating fusion unit. The specific process is as follows: Based on all within the target area Multiple relational space graph hints for individual sensor nodes The processing procedure of the feature mapping unit is as follows: Will Construct the timeline along the node dimension according to the sensor node index order. Full-graph multi-relation space graph hint matrix Similarly, based on multi-scale time-map cues, a full-map multi-scale time-map cues matrix is constructed. Next, a linear mapping layer projects both onto a unified [plane / plane]. The feature space is calculated using the following formula: ; ; in, and They are respectively mapped Full-scale temporal and spatial plot hint matrices; , The projective weight matrix is a learnable matrix. , For bias terms; The result of processing the feature mapping unit , The distribution alignment unit processing procedure is as follows: The hints after linear mapping are subjected to layer normalization to ensure that the multi-relation space graph hints and multi-scale time graph hints have similar statistical distributions in the same feature space. The calculation formula is as follows: ; ; in, , For layer normalization function; Results of processing distributed alignment units , The processing procedure of the bidirectional cross-attention interaction mechanism is as follows: First, use the full-map spatial diagram to suggest the matrix. As a query, use the full-map timeline to suggest the matrix. Using these as keys and values, we compute the global attention of space to time, extracting the temporal evolution features most relevant to the current spatial structure. : ; Secondly, the matrix is indicated by a reverse full-time graph. As a query, the full-map spatial graph hint matrix As keys and values, extract the spatial distribution features that best match the current time pattern. : ; in ; The adaptive gating fusion unit generates a bidirectional interactive fusion spatiotemporal graph prompting process as follows: First, the interaction features from both directions are concatenated along the feature dimension, and then a gating coefficient matrix is generated using a linear layer and an activation function. : ; ; in, and These are the parameters of the gated network; Use the Sigmoid activation function; This indicates element-wise multiplication; This provides a hint for the final bidirectional interactive fusion spatiotemporal graph.
8. The traffic speed prediction method based on bidirectional interactive fusion spatiotemporal map prompts according to claim 1, characterized in that: In step 5, the historical input sequence and the two-way interactive fusion spatiotemporal map prompts in the traffic speed prediction dataset are input into the traffic speed prediction module to predict the future traffic speed sequence. The traffic speed prediction mentioned above: at the prediction time is At that time, the model learns by using the historical input sequence in the traffic speed prediction dataset as the model input and the future speed sequence in the traffic speed prediction dataset as the supervised target, and outputs the corresponding future speed prediction results. Define the central time of traffic speed prediction dataset The input sequence is ,in, This represents the number of sensor nodes. For the length of the historical input, Indicates time Traffic speed observation vectors for all sensor nodes; Define the central time of traffic speed prediction dataset The target output sequence is in, To predict the number of steps; Will The suggestion is to enhance the input traffic speed prediction backbone model, calculate the parameter updates using backpropagation with the loss function gradient, and thus obtain the prediction output, denoted as . ; The traffic speed prediction backbone model is a spatiotemporal modeling network for traffic speed prediction, including time-dependent modeling, spatial-dependent modeling, and spatiotemporal fusion and output: Time-dependent modeling is used to encode the time features of historical input sequences, extract short-term dynamic changes and multi-scale time-dependent features, and output time representation features; Spatial-dependent modeling is used to propagate and aggregate information between sensor nodes according to traffic spatial relationships and learnable spatial associations, model spatial propagation and cross-node correlations, and output spatial representation features; Spatiotemporal fusion and output is used to fuse time representation features and spatial representation features, and generate traffic speed prediction output results for multiple future time steps.
9. The traffic speed prediction method based on bidirectional interactive fusion spatiotemporal map prompts according to claim 1, characterized in that: In step 5, the traffic speed prediction module includes a prompt enhancement input construction unit, a traffic speed prediction backbone model, and a loss function and training / optimization unit. The specific implementation process is as follows: The processing procedure of the aforementioned prompt enhancement input building unit is as follows: Centralize the traffic speed prediction data to the specified times. input sequence Received by stacking in batches Where B is the batch size, it is projected onto the map using an embedding map. In the feature space, we obtain the historical feature tensor. Simultaneously, obtain the bidirectional interactive fusion spatiotemporal graph prompts output from step 4. And expands to the time dimension Finally, feature fusion is used to... and The input features of the enhanced backbone model are obtained by concatenating and fusing them along the feature dimension. ; in, This indicates that on the feature dimension... and A feature fusion function is used to concatenate and fuse features through learnable mappings. ; The processing procedure of the traffic speed prediction backbone model is as follows: The input is enhanced with prompts. Input into the traffic speed prediction backbone model Output the future time t Traffic speed prediction results for steps: ; in ; The loss function and training / tuning unit are used to base predictions on the results. With target output Construct training objectives, Depend on The parameters of the traffic speed prediction backbone model are updated by batch stacking to gradually reduce the prediction error. Further optimization of the traffic speed prediction backbone model parameters is performed under different data distributions or task settings to obtain stable prediction performance. The loss function and training / tuning units include prediction loss. And comparative loss ; During training and tuning, relevant parameters and backbone model parameters are updated by minimizing a weighted combination of multiple losses; , in, and This is the loss weighting coefficient.
10. A traffic speed prediction method based on bidirectional interactive fusion spatiotemporal map prompts according to claim 9, characterized in that: The predicted loss Used to supervise and constrain the consistency between the predicted output and the actual output; the contrastive loss To enhance the consistency and robustness of the cue representation, the cue-related parameters and backbone model parameters are updated by minimizing a weighted combination of multiple losses during training and tuning. To reduce the impact of missing values or abnormally low values on training, a mask tensor is introduced. The mean absolute error is calculated at the mask location to obtain the prediction loss: ; in This indicates element-wise multiplication. For numerically stable terms, Depend on Obtained by stacking in batches; Constructing input using the original input and the enhanced input with prompts and , respectively representing the first The original input and the enhanced input of each sample are fused with the prompt generation and bidirectional interaction to obtain the prompt representation vector, where... , For batch size; where, For the first The prompt representation vector is obtained by reading out and aggregating the bidirectional interactive fusion spatiotemporal graph prompts corresponding to the original input samples. For the first The enhanced input of each sample prompt is followed by a bidirectional interactive fusion spatiotemporal graph prompt, which is then aggregated through readout to obtain a prompt representation vector. This prompt representation vector is then normalized using the L2 norm. The similarity score is defined as the dot product. Using a temperature coefficient of The contrastive learning objective yields the contrastive loss: ; in, Similarity between positive sample pairs of the same sample. Similarity of negative sample pairs composed of different samples.