Traffic flow prediction method based on multi-source dynamic space-time graph and mamba
By constructing a multi-source dynamic spatiotemporal graph and using the Mamba traffic flow prediction method, and integrating fine-grained weather features to generate a dynamic adjacency matrix, redundant connections are eliminated and long- and short-term spatiotemporal dependencies are captured. This solves the problem of balancing the static structure of the road network graph and the efficiency and accuracy of long-sequence prediction, thus improving the accuracy and efficiency of traffic flow prediction.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- CHINA UNIV OF GEOSCIENCES (WUHAN)
- Filing Date
- 2026-01-14
- Publication Date
- 2026-06-09
AI Technical Summary
Existing traffic flow prediction methods suffer from static road network structures that make it difficult to respond to environmental changes in real time, crude utilization of weather factors, and difficulty in balancing efficiency and accuracy in long-sequence predictions.
By constructing a traffic flow prediction method based on multi-source dynamic spatiotemporal graphs and Mamba, a dynamic adjacency matrix is generated by fusing fine-grained weather features. Redundant connections are eliminated using a traffic perception sparsification module, and long- and short-term spatiotemporal dependencies are captured through a dual-path Mamba hidden state update module.
It achieves efficient response to complex dynamic environments, improves the accuracy and efficiency of traffic flow prediction, and truly restores the asymmetric propagation characteristics of urban traffic flow, outperforming existing models.
Smart Images

Figure CN122176937A_ABST
Abstract
Description
Technical Field
[0001] This application belongs to the field of intelligent transportation technology, and more specifically, relates to a traffic flow prediction method based on multi-source dynamic spatiotemporal graphs and Mamba. Background Technology
[0002] Traffic flow prediction is one of the core technologies of intelligent transportation systems, and it is of great significance for urban road network planning, congestion mitigation, and dynamic vehicle scheduling. With the development of deep learning, graph neural networks (GNNs) have become the mainstream method for capturing the spatiotemporal dependencies in traffic data. However, existing prediction methods based on spatiotemporal graphs still have the following significant limitations: First, spatial modeling typically relies on static, predefined adjacency matrices. Existing GNN models (such as STGCN and T-GCN) mostly construct static graphs based on physical distance or road connectivity. This static structure cannot reflect the real-time dynamic changes in traffic flow (e.g., the propagation of temporary congestion caused by accidents or sudden weather changes) and is difficult to adapt to complex real-time road conditions. Although some studies have proposed adaptive graph learning, they often neglect the real-time evolution of traffic states over time.
[0003] Second, the utilization of external factors (especially weather) is rather crude. Most existing studies treat weather data as simple additional input features for concatenation, or only use coarse-grained weather information. This approach fails to model, mechanistically, how weather conditions (such as slippery roads due to rain, or low visibility due to fog) dynamically alter the connectivity and impact range between road nodes. The dynamic coupling mechanism between fine-grained meteorological features (such as specific precipitation and wind speed) and road network topology has not been fully explored.
[0004] Third, there are bottlenecks in the efficiency and capability of long-sequence time modeling. Traditional recurrent neural networks (RNNs) face problems such as vanishing gradients and difficulties in parallelization when processing long sequences; while Transformer-based models can capture long-distance dependencies, their quadratic time complexity limits their real-time application in large-scale road networks. Although the recently emerging Mamba architecture has the advantage of linear complexity, current explorations have not yet effectively combined it with dynamic graph structures driven by multi-source information, and lack the ability to jointly model forward causality and backward periodic dependencies in bidirectional road networks.
[0005] Therefore, how to effectively integrate fine-grained weather features to construct a dynamically evolving road network map structure, and how to use efficient sequence models to simultaneously capture long-term and short-term spatiotemporal dependencies, are key technical problems that urgently need to be solved in the field of traffic flow prediction. Summary of the Invention
[0006] To address the shortcomings of existing technologies, this application aims to provide a traffic flow prediction method based on multi-source dynamic spatiotemporal maps and Mamba. This method addresses the problems of static road network map structures, difficulty in real-time response to environmental changes, and the difficulty in balancing efficiency and accuracy in long-sequence predictions in existing technologies. By deeply integrating multi-source heterogeneous data with an efficient state-space model, the method improves the accuracy of traffic flow prediction in bidirectional road networks.
[0007] To achieve the above objectives, in a first aspect, this application provides a traffic flow prediction method based on multi-source dynamic spatiotemporal graphs and Mamba, which is implemented by constructing a traffic flow prediction model. This model includes at least a dynamic graph generation module, a traffic perception sparsification module, and a dual-path Mamba hidden state update module. The method includes the following steps: S10: Acquire and preprocess historical traffic status data, real-time traffic flow data, and fine-grained weather feature data of the target area's road network; S20, through the dynamic graph generation module, based on the preprocessed data, weather features and traffic status features are fused to generate a dynamic adjacency matrix that evolves with time step; S30, the traffic perception sparsification module performs sparsification processing on the dynamic adjacency matrix, and uses the processed dynamic adjacency matrix to extract spatial features. S40, through the dual-path Mamba hidden state update module, bidirectional temporal modeling of the spatial features is performed, the forward and backward temporal dependencies are fused, and the hidden state is updated in combination with historical information; As a further preferred embodiment, in step S20, the operations performed by the dynamic graph generation module include: The fine-grained weather feature data is transformed into a weather embedding vector through a weather perception embedding layer; The weather embedding vector is fused with traffic state features, time features, and features extracted based on static road network topology to calculate the dynamic correlation between nodes and generate the dynamic adjacency matrix.
[0008] As a further preferred embodiment, the weather perception embedding layer processes the fine-grained weather feature vector at time t using a multilayer perceptron. Generate weather embedding vectors The calculation formula is:
[0009] MLP stands for Multilayer Perceptron. and For learnable weight and bias parameters, This indicates element-wise multiplication.
[0010] As a further preferred embodiment, in step S20, a dynamic adjacency matrix is generated. The calculation formula is:
[0011]
[0012]
[0013] in, Embed for predefined source nodes, Embedded for predefined target nodes, The basic spatial features extracted through static graph convolution. It is a linear rectified activation function. It is a normalized exponential function.
[0014] As a further preferred embodiment, in step S30, the traffic perception sparsification module performs sparsification processing on the dynamic adjacency matrix, including: For dynamic adjacency matrix Each row of elements is sorted by its numerical value; Set a threshold The threshold For dynamic adjacency matrix Middle row in The element values of 1 bit; the sparsity calculation formula is as follows:
[0015] in, It is a sparse matrix.
[0016] As a further preferred embodiment, the traffic perception sparsification module generates the sparse matrix... Next, perform the following steps: Traffic dynamics features are extracted from traffic state data at the current time step using a multilayer perceptron. ; The traffic dynamics characteristics With the sparse matrix The components are merged to generate the final dynamic adjacency matrix. The calculation formula is: ,in, It is a linear rectified activation function. It is a normalized exponential function.
[0017] As a further preferred embodiment, in step S40, the dual-path Mamba hidden state update module performs bidirectional temporal modeling of the spatial features, including: Extracted spatial features Input the forward Mamba path to obtain the forward features. The calculation formula is: ; The spatial features After reversing along the time dimension, the backward Mamba path is input to obtain the backward features. The calculation formula is: ,in This represents a sequence reversal operation along the time dimension.
[0018] As a further preferred embodiment, the dual-path Mamba hidden state update module also performs: The forward features With backward features The features are then stitched together and fused through a linear fusion layer to obtain bidirectional fused features. The calculation formula is: ,in and These are the learnable weight matrix and bias vector of the linear fusion layer, respectively. This indicates a feature splicing operation.
[0019] As a further preferred embodiment, the dual-path Mamba hidden state update module updates the hidden state through a gating mechanism, including: Based on the aforementioned bidirectional fusion features Compared to the previous hidden state Calculate the update gate The calculation formula is: ,in To update the learnable weight parameters of the gate, Use the Sigmoid activation function; Using the update gate The bidirectional fusion feature is integrated. Compared to the previous hidden state Get the global hidden state at the current moment. The calculation formula is: .
[0020] In a second aspect, this application provides an electronic device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement the steps of the method as described in any one of the above descriptions.
[0021] The beneficial effects of this application are as follows: 1. Achieved spatiotemporally dependent dynamic adaptive capture: By fusing historical states, real-time observations, and fine-grained weather features (temperature, humidity, wind speed, precipitation), this application can generate a dynamic graph structure that evolves over time, overcoming the shortcomings of traditional static adjacency matrices that cannot reflect real-time traffic changes, and significantly enhancing the model's responsiveness to complex dynamic environments.
[0022] 2. Balancing computational efficiency and prediction robustness: The traffic perception sparsification module can dynamically prune non-critical connections based on real-time traffic flow, significantly reducing computational complexity while minimizing parameter redundancy and noise interference, thus improving the model's efficiency in processing large-scale road network data.
[0023] 3. Improved modeling accuracy of long-distance temporal features: The dual-path Mamba hidden state update mechanism leverages the linear complexity advantage of the state space model and processes forward causal relationships and backward periodic relationships in parallel, enabling a more comprehensive mining of the long-range dependency characteristics of traffic flow and demonstrating excellent performance in long-term prediction tasks.
[0024] 4. Optimized design for two-way road networks: By explicitly constructing a two-way road network map and modeling the dynamics of two-way traffic flow, this application more realistically reproduces the asymmetric propagation characteristics of urban traffic flow. Experimental results show that it outperforms existing advanced baseline models in multiple evaluation indicators. Attached Figure Description
[0025] Figure 1 This is a block diagram of the overall architecture of the MDSTG-Mamba model provided in this application embodiment; the model consists of an encoder on the left and a decoder on the right, both of which contain stacked multi-layer networks. Each core layer contains a dynamic graph generator and a dual-path Mamba hidden state update module; Figure 2 This is an overall flowchart of the traffic flow prediction method based on multi-source dynamic spatiotemporal graphs and Mamba provided in the embodiments of this application; Figure 3 This is a flowchart illustrating the training process of the traffic flow prediction method based on multi-source dynamic spatiotemporal graphs and Mamba, as provided in this application embodiment. Detailed Implementation
[0026] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.
[0027] To address the problems of static road network graph structures, difficulty in real-time response to environmental changes, and the trade-off between efficiency and accuracy in long-sequence prediction in existing technologies, this application provides a traffic flow prediction method based on multi-source dynamic spatiotemporal graphs and Mamba. It utilizes a multi-source state fusion mechanism to construct a time-step-level dynamic adjacency matrix, enabling adaptive capture of spatiotemporal dependencies modulated by weather factors. A traffic perception sparsification module is used to eliminate redundant connections, enhancing model robustness and reducing computational overhead. A dual-path Mamba hidden state update mechanism is employed to capture temporal causal dependencies and inverse periodic dependencies in parallel, improving long-sequence modeling capabilities.
[0028] Specifically, the traffic flow prediction method based on multi-source dynamic spatiotemporal maps and Mamba provided in this application is implemented by constructing a traffic flow prediction model, such as... Figure 1 As shown, the model includes at least a dynamic graph generation module, a traffic perception sparsification module, and a dual-path Mamba hidden state update module. The method provided in this application includes the following steps: Step S10: Acquire and preprocess historical traffic status data, real-time traffic flow data, and fine-grained weather feature data of the target area road network.
[0029] In this application, step S10 can specifically be: acquiring historical traffic status data, real-time traffic flow data, and fine-grained weather feature data of the target area road network; the fine-grained weather feature data includes at least temperature, humidity, wind speed, and precipitation; cleaning, normalizing, and time-aligning the data to construct the model input sequence.
[0030] Step S20: The dynamic graph generation module generates a dynamic adjacency matrix that evolves over time based on the preprocessed data and integrates weather features and traffic status features, thereby adaptively capturing the spatiotemporal dependencies modulated by weather factors.
[0031] In this application, step S20 can specifically be: inputting the preprocessed data into the dynamic graph generation module; converting fine-grained weather features into weather embedding vectors through the weather perception embedding layer, and combining traffic state features and time features to calculate the dynamic correlation between nodes and generate a time-step dynamic adjacency matrix containing weather modulation effects.
[0032] Step S30: The dynamic adjacency matrix is sparsified using the traffic perception sparsification module, and spatial features are extracted using the processed dynamic adjacency matrix.
[0033] In this application, step S30 can specifically be: inputting the dynamic adjacency matrix into the traffic perception sparsification module; using the Top-K strategy to retain key node connections and prune redundant connections, thereby reducing computational overhead and suppressing noise interference, and combining real-time traffic dynamics features to generate the final sparsified dynamic adjacency matrix; and using the sparsified dynamic adjacency matrix to perform graph convolution operations on the input features to extract spatial dependency features.
[0034] Step S40: Through the dual-path Mamba hidden state update module, bidirectional temporal modeling of spatial features is performed, the forward and backward temporal dependencies are fused, and the hidden state is updated in combination with historical information.
[0035] In this application, step S40 can specifically be: inputting the spatial features extracted by graph convolution into a dual-path Mamba hidden state update module; the module includes a forward Mamba path and a backward Mamba path set in parallel, which respectively capture the temporal causal dependency and the reverse periodic dependency of traffic flow; and updating the global hidden state at the current moment by fusing the forward and backward features and the hidden state of the previous moment through a gating mechanism.
[0036] Step S50: Based on the updated hidden state, output the traffic flow prediction value for the future time step.
[0037] The beneficial effects of this application are as follows: 1. Achieved spatiotemporally dependent dynamic adaptive capture: By fusing historical states, real-time observations, and fine-grained weather features (temperature, humidity, wind speed, precipitation), this application can generate a dynamic graph structure that evolves over time, overcoming the shortcomings of traditional static adjacency matrices that cannot reflect real-time traffic changes, and significantly enhancing the model's responsiveness to complex dynamic environments.
[0038] 2. Balancing computational efficiency and prediction robustness: The traffic perception sparsification module can dynamically prune non-critical connections based on real-time traffic flow, significantly reducing computational complexity while minimizing parameter redundancy and noise interference, thus improving the model's efficiency in processing large-scale road network data.
[0039] 3. Improved modeling accuracy of long-distance temporal features: The dual-path Mamba hidden state update mechanism leverages the linear complexity advantage of the state space model and processes forward causal relationships and backward periodic relationships in parallel, enabling a more comprehensive mining of the long-range dependency characteristics of traffic flow and demonstrating excellent performance in long-term prediction tasks.
[0040] 4. Optimized design for two-way road networks: By explicitly constructing a two-way road network map and modeling the dynamics of two-way traffic flow, this application more realistically reproduces the asymmetric propagation characteristics of urban traffic flow. Experimental results show that it outperforms existing advanced baseline models in multiple evaluation indicators.
[0041] In one embodiment, the technical solution for achieving the above objective can be specifically as follows: Figure 2 and Figure 3 As shown, this embodiment provides a traffic flow prediction method based on multi-source dynamic spatiotemporal maps and Mamba, including the following steps: Step S1: Data acquisition and preprocessing; This step aims to construct a standard dataset suitable for bidirectional road network prediction, and specifically includes the following sub-steps: Constructing a bidirectional road network model: First, define the urban road network as a directed graph. .in, Indicates by A set consisting of road segment nodes; This represents the set of edges connecting these nodes, which not only includes the physical connections of the roads, but also explicitly encodes the turning behaviors of the intersection (such as going straight, turning left, and making a U-turn) to reflect the asymmetric propagation characteristics of two-way traffic flow.
[0042] Traffic condition data collection: Time-series data is collected from various monitoring points in the target road network, including traffic flow, average speed, and lane occupancy. The data is then aggregated into fixed time slices (e.g., 10 minutes) to form a historical traffic condition sequence. .
[0043] Fine-grained weather data acquisition: Simultaneously acquire fine-grained meteorological data for this area. Unlike existing technologies that only use weather category labels, this embodiment selects four numerical features related to traffic flow intensity: Temperature (°C): Affects residents' willingness to travel and the road surface friction coefficient; Relative Humidity (%): High humidity may cause fog and reduce visibility; Wind speed (m / s): Crosswinds can affect vehicle stability, especially for large vehicles; Precipitation (mm): directly causes slippery road surfaces, significantly reducing traffic efficiency.
[0044] Data Alignment and Normalization: Since the original sampling frequency of meteorological data (e.g., 1 hour) is usually lower than that of traffic data, this embodiment uses cubic spline interpolation to resample the meteorological data to the same time granularity as the traffic data (e.g., 10 minutes), ensuring that the traffic status at each time step has a unique corresponding fine-grained weather vector. Finally, all data are Z-score standardized to eliminate dimensional differences.
[0045] Step S2: Construct a multi-source dynamic spatiotemporal graph; This step aims to generate a dynamic adjacency matrix that evolves over time and reflects the impact of weather. The specific process is as follows: Weather perception embedding: To quantify the dynamic regulatory effect of weather on traffic patterns, a weather feature embedding matrix is constructed. For each time step... Weather feature vector It is mapped to weather embedding vectors through a learnable weather-aware embedding module. The calculation formula is as follows:
[0046] in, This represents a multilayer perceptron. and For learnable weights and bias parameters, This indicates element-wise multiplication. This vector encodes the potential impact weights of current weather conditions (such as "heavy rain" or "dense fog") on the road network's capacity.
[0047] Multi-source input feature aggregation: In order to comprehensively capture the current state of the traffic system, the current time... Node features (Flow rate, speed, etc.), temporal context features (e.g., time of day, day of the week) and the model's hidden state from the previous time step. The data is concatenated to form a unified input representation. :
[0048] This aggregated feature not only includes current observation data, but also incorporates historical memory and time period information.
[0049] Static topological feature extraction: utilizing a predefined static adjacency matrix For aggregated input Perform graph convolution operations to extract basic spatial features based on the physical connections of the road network. :
[0050] This step ensures that the model retains the most basic physical connectivity information of the road network.
[0051] Generating a dynamic adjacency matrix: This is the core of this embodiment. To simulate how weather and real-time traffic conditions change the dependencies between nodes (for example, in severe weather, the congestion propagation effect between adjacent nodes may be aggravated), this embodiment generates a dynamic graph by fusing static features with weather embeddings.
[0052] First, initialize two learnable node embedding matrices. (Source node embedding) and (Target node embedding). Then, the weather embedding vector is used. The representations of these nodes are dynamically modulated, and the calculation formula is as follows:
[0053]
[0054] in, and These represent the enhanced representations of the source and target nodes, respectively, after incorporating real-time status and weather effects.
[0055] Finally, time steps are generated by calculating the similarity between nodes. Dynamic adjacency matrix :
[0056] The matrix Each element in It dynamically reflects the nodes under current weather and traffic conditions. For nodes The influence intensity is determined, thereby enabling real-time adaptive evolution of the graph structure.
[0057] Step S3: Traffic perception sparsity processing; The generated fully connected dynamic adjacency matrix may contain noisy connections and has high computational complexity. This step utilizes a traffic-aware sparsity module to optimize the graph structure, as follows: Top-K based connection pruning: To remove redundant weak connections and retain the key neighbor nodes that have the greatest impact on traffic flow, this embodiment employs a direction-aware Top-K strategy. A threshold is set. Defined as a dynamic adjacency matrix Each row is in the first position. Large element values. Construct a sparse matrix. The calculation logic is as follows:
[0058] Through this step, each node retains only the previous... The most relevant neighbors are identified, which significantly reduces the computational cost of subsequent graph convolutions and suppresses noise.
[0059] Integrating traffic dynamics features: To further enhance the sensitivity of the graph structure to real-time traffic flow, a multilayer perceptron (MLP) is used to input from the current time step. Extracting traffic dynamics features This feature is injected into the sparse matrix to generate the final dynamic adjacency matrix used for graph convolution. :
[0060] This process ensures that the final graph structure is not only topologically sparse and efficient, but also deeply integrates the current traffic flow situation in terms of features.
[0061] Step S4: Dual-path Mamba time series modeling and prediction; This step utilizes a combination of static and dynamic graph convolution to extract spatial features and captures long-short-term spatiotemporal dependencies through a dual-path Mamba architecture, as detailed below: Dynamic-static combined graph convolution: To balance the physical connectivity stability of the road network and the dynamic changes in traffic flow, this embodiment simultaneously incorporates static graph convolution. and animated GIFs Perform graph convolution operations on the graph and fuse the results to obtain a spatial feature representation. :
[0062] in, The graph convolution operation enables multi-view spatial feature extraction.
[0063] Dual-path Mamba Hidden State Update (DMUB): To address the problem that traditional unidirectional models cannot simultaneously utilize past and future contexts, this embodiment designs a dual-path Mamba module.
[0064] Forward path: spatial features Input the forward Mamba module to capture causal dependencies from the past to the present (such as downstream propagation of congestion):
[0065] Backward path: The spatial feature sequence is reversed and input into the backward Mamba module to capture reverse dependencies from the present to the past (used to mine periodic patterns):
[0066] Bidirectional fusion: The forward and backward output features are concatenated and fused through a linear layer to obtain features $H_{fused}$ containing global temporal information. 4:
[0067] Gating mechanism update: To effectively update the global hidden state, an external update gate is introduced. To balance the weight of current observational information with historical memory:
[0068]
[0069] in It is the Sigmoid activation function. This refers to the updated global hidden state at the current moment.
[0070] Step S5: Prediction and Training; Updated hidden state Traffic flow forecasts are mapped to future time steps through a linear prediction layer. During the model training phase, the mean absolute error (MAE) is used as the loss function, and the model parameters are updated through backpropagation using the Adam optimizer.
[0071] Those skilled in the art will readily understand that the above description is merely a preferred embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, and improvements made within the spirit and principles of this application should be included within the protection scope of this application.
Claims
1. A traffic flow prediction method based on multi-source dynamic spatiotemporal graphs and Mamba, characterized in that, This is achieved by constructing a traffic flow prediction model, which includes at least a dynamic graph generation module, a traffic perception sparsification module, and a dual-path Mamba hidden state update module. The method includes the following steps: S10: Acquire and preprocess historical traffic status data, real-time traffic flow data, and fine-grained weather feature data of the target area's road network; S20, through the dynamic graph generation module, based on the preprocessed data, weather features and traffic status features are fused to generate a dynamic adjacency matrix that evolves with time step; S30, the traffic perception sparsification module performs sparsification processing on the dynamic adjacency matrix, and uses the processed dynamic adjacency matrix to extract spatial features. S40, through the dual-path Mamba hidden state update module, bidirectional temporal modeling of the spatial features is performed, the forward and backward temporal dependencies are fused, and the hidden state is updated in combination with historical information; S50, based on the updated hidden state, outputs traffic flow predictions for future time steps.
2. The traffic flow prediction method based on multi-source dynamic spatiotemporal graphs and Mamba as described in claim 1, characterized in that, In step S20, the operations performed by the dynamic graph generation module include: The fine-grained weather feature data is transformed into a weather embedding vector through a weather perception embedding layer; The weather embedding vector is fused with traffic state features, time features, and features extracted based on static road network topology to calculate the dynamic correlation between nodes and generate the dynamic adjacency matrix.
3. The traffic flow prediction method based on multi-source dynamic spatiotemporal graphs and Mamba as described in claim 2, characterized in that, The weather perception embedding layer processes the fine-grained weather feature vector at time t using a multilayer perceptron. Generate weather embedding vectors The calculation formula is: MLP stands for Multilayer Perceptron. and For learnable weight and bias parameters, This indicates element-wise multiplication.
4. The traffic flow prediction method based on multi-source dynamic spatiotemporal graphs and Mamba as described in claim 3, characterized in that, In step S20, a dynamic adjacency matrix is generated. The calculation formula is: in, Embed for predefined source nodes, Embedded for predefined target nodes, The basic spatial features extracted through static graph convolution. It is a linear rectified activation function. It is a normalized exponential function.
5. The traffic flow prediction method based on multi-source dynamic spatiotemporal graphs and Mamba as described in claim 1, characterized in that, In step S30, the traffic perception sparsification module performs sparsification processing on the dynamic adjacency matrix, including: For dynamic adjacency matrix Each row of elements is sorted by its numerical value; Set a threshold The threshold For dynamic adjacency matrix Middle row in The element values of 1 bit; the sparsity calculation formula is as follows: in, It is a sparse matrix.
6. The traffic flow prediction method based on multi-source dynamic spatiotemporal graphs and Mamba as described in claim 5, characterized in that, The traffic perception sparsification module generates the sparse matrix. Next, perform the following steps: Traffic dynamics features are extracted from traffic state data at the current time step using a multilayer perceptron. ; The traffic dynamics characteristics With the sparse matrix The components are merged to generate the final dynamic adjacency matrix. The calculation formula is: ,in, It is a linear rectified activation function. It is a normalized exponential function.
7. The traffic flow prediction method based on multi-source dynamic spatiotemporal graphs and Mamba as described in claim 1, characterized in that, In step S40, the dual-path Mamba hidden state update module performs bidirectional temporal modeling of the spatial features, including: Extracted spatial features Input the forward Mamba path to obtain the forward features. The calculation formula is: ; The spatial features After reversing along the time dimension, the backward Mamba path is input to obtain the backward features. The calculation formula is: ,in This represents a sequence reversal operation along the time dimension.
8. The traffic flow prediction method based on multi-source dynamic spatiotemporal graphs and Mamba as described in claim 7, characterized in that, The dual-path Mamba hidden state update module also performs: The forward features With backward features The features are then stitched together and fused through a linear fusion layer to obtain bidirectional fused features. The calculation formula is: ,in and These are the learnable weight matrix and bias vector of the linear fusion layer, respectively. This indicates a feature splicing operation.
9. The traffic flow prediction method based on multi-source dynamic spatiotemporal graphs and Mamba as described in claim 8, characterized in that, The dual-path Mamba hidden state update module updates the hidden state through a gating mechanism, including: Based on the aforementioned bidirectional fusion features Compared to the previous hidden state Calculate the update gate The calculation formula is: ,in To update the learnable weight parameters of the gate, Use the Sigmoid activation function; Using the update gate The bidirectional fusion feature is integrated. Compared to the previous hidden state Get the global hidden state at the current moment. The calculation formula is: .
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the steps of the method as described in any one of claims 1 to 9.