Mama-based traffic flow prediction method
By adopting a static graph convolution network and a dual-branch Mamba architecture in traffic flow prediction, combining the space-time dual-token mechanism and the cross-attention mechanism, the problem of limited traffic flow prediction accuracy in the existing technology is solved, and more efficient and robust traffic flow modeling and prediction effects are achieved.
Patent Information
- Application Number
- CN202510421465.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-04-07
- Publication Date
- 2025-05-06
- Estimated Expiration
- 2045-04-07
AI Technical Summary
Existing traffic flow prediction methods are difficult to capture complex features of high-dimensional, nonlinear and spatial-temporal correlation, resulting in limited prediction accuracy, especially in high dynamic road network environment, multivariable coupling scenarios, and long-sequence computing efficiency.
The traffic flow prediction method based on Mamba is adopted to extract the spatial correlation of the road network through a static graph convolution network. The dual-branch Mamba architecture captures the time dependence and variable correlation of traffic flow. The space-time dual-token mechanism decouples the boundaries of multi-source factors, and combines the cross attention mechanism and residual connection to realize multi-dimensional feature interaction and efficient computing resource utilization.
It significantly improves the modeling robustness and interpretability in multivariate coupled scenarios, improves the accuracy and efficiency of traffic flow prediction, and meets the needs of all-weather real-time monitoring and rapid response of urban-level road networks.
Smart Images

Figure CN119942813A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the technical field of intelligent transportation, and in particular relates to a traffic flow prediction method based on Mamba. Background Art
[0002] As the complexity and dynamics of urban transportation systems increase, accurate traffic flow prediction is crucial to smart transportation management. Traffic data at different stations show significant spatial heterogeneity due to their geographical locations and functional attributes, and traffic flow shows significant time dependence, such as periodic congestion during peak hours in the morning and evening, changes in travel patterns during holidays, and instantaneous traffic fluctuations caused by large-scale events or emergencies; at the same time, its changes are also affected by the complex influence of multi-dimensional variables, including weather conditions (such as rain, snow, and haze), traffic accidents, road construction, public transportation operation status, and the correlation between surrounding area functions (such as commercial areas and schools). These spatiotemporal dynamics and the nonlinear coupling of multi-source variables make it difficult to fully explore the patterns hidden in traffic flow data through traditional models. High-precision traffic flow prediction can not only optimize signal timing and alleviate road congestion, but also provide decision support for urban emergency response and public transportation scheduling, thereby improving urban operation efficiency and residents' travel experience.
[0003] Early traffic flow prediction mainly relied on traditional methods such as historical average algorithm and integrated moving average autoregressive model (ARIMA). These methods usually only consider the historical data of a single traffic collection point and make predictions through linear laws. However, real traffic flow has the characteristics of high dimension, nonlinearity and spatiotemporal correlation. Traditional methods are difficult to capture the complex characteristics of dynamic changes, resulting in limited prediction accuracy. With the development of intelligent transportation systems, machine learning methods such as long short-term memory network (LSTM) and diffuse convolutional recurrent neural network (DCRNN) extract temporal features through recurrent neural network and capture spatial correlation by combining graph convolution network. Deep learning methods such as spatiotemporal graph convolution network (ST-GCN) use a hybrid structure of temporal convolution network (TCN) and graph convolution network (GCN) to simultaneously model traffic flow and extract temporal features through recurrent neural network, which significantly improves the prediction effect. However, it relies on a lot of computing resources and is difficult to meet actual needs.
[0004] As the demand for dynamic spatiotemporal modeling in intelligent transportation systems increases, existing technologies have significant bottlenecks in high-dynamic road network environments, multivariable coupling scenarios, and long-sequence computing efficiency, which are specifically manifested in the following three core issues: insufficient capture of static graph convolution and dynamic spatiotemporal dependencies, inefficient multivariable coupling modeling and interaction, and imbalance between long-sequence computing efficiency and long-term dependency capture. Summary of the invention
[0005] In view of the technical problems existing in the above-mentioned traditional traffic flow prediction, the present invention provides a traffic flow prediction method based on Mamba.
[0006] In order to solve the above technical problems, the technical solution adopted by the present invention is: A traffic flow prediction method based on Mamba includes the following steps: S1. Dataset collection and preprocessing: Obtain traffic flow data and exogenous variables such as weather, holiday information, and road construction information, and then perform data preprocessing, including missing value filling, data cleaning, and the division and standardization of training sets, validation sets, and test sets; S2, static graph construction and spatial feature extraction: construct an adjacency matrix based on the physical connectivity of the road network, use the symmetric normalized Laplacian matrix to enhance the stability of graph convolution, aggregate multi-order neighborhood information through multi-layer GCN stacking, and extract the spatial correlation features of road sections; S3, spatiotemporal dual-token decoupling embedding: decouple spatial features into time tokens T-Token and variable tokens V-Token, which are fused with position encoding and node embedding through fully connected layers to achieve independent modeling of temporal continuity and cross-variable correlation; S4, Dual-branch Mamba modeling: Time series branch: bidirectional Mamba is used to capture the long-term periodic dependence of traffic flow, and the time series state is integrated through forward and backward scanning; variable branch: based on the nonlinear coupling relationship between speed and flow multivariables of unidirectional Mamba modeling, cross-variable interaction features are generated; S5, spatiotemporal-variable feature fusion: The dual-branch features are fused through the cross-attention mechanism, with time series features as query and variable features as key and value, combined with residual connection to retain the original spatial information and enhance multi-dimensional feature interaction; S6. Perform multi-step prediction and output the prediction results. Finally, output the predicted values of the multi-step sequence through projection mapping.
[0007] The data set collection and preprocessing method in S1 is as follows: the traffic flow data comes from 10,000 toroidal inductive sensors deployed by the California Highway Administration, which continuously record traffic flow, average speed and time occupancy at a sampling interval of 30 seconds; in terms of exogenous variables, the 5-minute granular meteorological data and real-time traffic accident annotation information provided by the National Oceanic and Atmospheric Administration (NOAA) of the United States are accessed to increase the impact of exogenous variables, and the granular meteorological data include wind speed, precipitation and visibility; For missing values, a dual-dimensional interpolation strategy of time and space is adopted: linear interpolation is performed on short-term missing values in the time dimension, and the spatial dimension is filled based on the weighted addition of three adjacent sensors in the same direction: , in: is the sensor spacing, For the time point to be filled, To control the time decay rate, is the timestamp of the data, , Dynamic calculation based on historical data for the same period, weight Reflection sensor Data time and current time The closer the time difference is, the higher the weight is. Indicates sensor In time The interpolated estimate of ; Indicates sensor In time Observed value of Display and Sensor Three sensors in the same direction and closest in space; Standardize and de-standardize the data according to the mean and standard deviation The original data is converted to standardized values, and the standardized data will have zero mean and unit variance; after the prediction is completed, the same mean and standard deviation are used for inverse transformation, and the prediction results are converted back to the scale of the original data for evaluation; finally, the training set, validation set, and test set are divided in a ratio of 7:1:2.
[0008] The method of static image construction and spatial feature extraction in S2 is: S2.1. Graph construction and adjacency matrix definition: Consider each road segment in the highway network as a node in the graph. If two nodes are directly connected physically, the adjacency matrix A The corresponding elements in A ij =1, otherwise A ij =0; S2.2, Laplace matrix normalization: using symmetric normalized Laplace matrix Enhanced stability, including D is the degree matrix, D The diagonal matrix , I It is the unit matrix, and the self-loop is introduced to ensure that the node’s own characteristics are preserved; S2.3, GCN propagation formula: The feature update formula of each GCN layer is ,in H (l) For the l The node feature matrix of the layer, the input layer , Nis the number of nodes, F is the total number of variables, W (l) For the l The trainable weight matrix of the layer, is the nonlinear activation function ReLU; by superposition K Layer GCN gradually aggregates multi-order neighborhood information. , For the The node feature matrix of the layer.
[0009] The method for decoupling and embedding the spatiotemporal dual tokens in S3 is: S3.1. Time token embedding module: In the time embedding module, data at the same time step is embedded into a token so that each token can represent the complete information at a time point. The embedding steps are: , Represents the characteristics of the time dimension, represents the fully connected layer designed for time features, represents the original spatial features, Represents time position coding, retains the continuity of the time dimension, encodes time order information, and outputs , N is the number of nodes, d is the feature dimension, T is the number of time steps; S3.2, variable token embedding module: The variable embedding module generates variable tokens by transposing the time tokens, and embeds the entire time series of each variable into a token independently to focus on the global features of the variables in the sequence; the embedding steps are , The characteristics representing the node dimension, represents a fully connected layer designed for node dimension features, represents the original spatial features, Represents the embedding vector of node i, aggregates node features, encodes variable correlations across variables, and outputs , N is the number of nodes, d is the feature dimension, F is the total number of variables. Since the order of the sequence is implicitly stored in each variable token, positional embedding is no longer required for variable embedding.
[0010] The method of double-branch Mamba modeling in S4 is: S4.1, bidirectional Mamba extracts temporal dependencies: extract temporal features from the temporal embedding vector obtained in S3.1, and apply bidirectional Mamba along the temporal dimension, including forward scanning and backward scanning , output fusion ,in They represent the discrete time series Mamba parameters respectively; in order to improve the computational efficiency, the continuous parameters are discretized by the zero-order hold rule. , represents the state vector of the system, represents the time derivative of the state vector, represents the system matrix, represents the input matrix, represents the zero-order hold form of a discrete input signal, represents the output signal of the system, Represents the output matrix; and captures historical information through forward propagation, captures future information through back propagation, and models the contextual dependencies between the past and the future to enhance the temporal expression capability; S4.2, One-way Mamba to extract variable correlation: Apply one-way Mamba along the variable dimension, from key variables to auxiliary variables, , output , the final hidden state represents the dependency between variables, where: Indicates The hidden state of the variable, Indicates The hidden state of the variable, Indicates f The input features of the variables, represents the total number of variables, are the state space parameters of the variable Mamba respectively.
[0011] The method of spatiotemporal-variable feature fusion in S5 is: S5.1. Cross-attention mechanism: Time series features are used as Query, and variable features are used as Key and Value. ,in: represents the variable feature matrix, represents the time series feature matrix, Indicates that the time series characteristics Projected into the Query matrix, Indicates that the time series characteristics Projection is the Key matrix, Indicates that the time series characteristics Projection is the Value matrix, represents the feature dimension, represents the normalized attention weight, Represents the fused spatiotemporal joint features; S5.2, residual connection: retain the original spatiotemporal features, ,in: Represents the final output, represents the convolution operation, Represents the original spatial characteristics.
[0012] The fusion features obtained in S5 are output as future multi-step sequences through linear projection to achieve short-term prediction of traffic flow.
[0013] The prediction method in S6 is evaluated using mean absolute error MAE, root mean square error RMSE, symmetric mean percentage error SMAPE and correlation coefficient.
[0014] Compared with the prior art, the present invention has the following beneficial effects: The static graph convolutional network of the present invention extracts spatial correlation from the inherent topology of the road network, while the dual-branch Mamba architecture captures the time dependence and variable correlation of traffic flow. The spatiotemporal dual token mechanism of the present invention decouples the action boundaries of multi-source factors such as traffic flow, environmental variables and event interference, explicitly distinguishes the independent influence and synergistic effect between variables, and significantly improves the modeling robustness and interpretability in multi-variable coupling scenarios. In addition, the lightweight design based on Mamba replaces the traditional Transformer architecture, and utilizes the compression characteristics of the state space and the selective feature transfer mechanism to achieve more efficient computing resource utilization in the processing of ultra-long sequence data, providing a feasible technical path for all-weather real-time monitoring and rapid response of urban-level road networks. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] In order to more clearly illustrate the implementation methods of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for the implementation methods or the description of the prior art. Obviously, the drawings in the following description are only exemplary, and for ordinary technicians in this field, other implementation drawings can be derived from the provided drawings without creative work.
[0016] The structures, proportions, sizes, etc. illustrated in this specification are only used to match the contents disclosed in the specification so as to facilitate understanding and reading by persons familiar with the technology. They are not used to limit the conditions under which the present invention can be implemented, and therefore have no substantial technical significance. Any structural modification, change in proportion or adjustment of size shall still fall within the scope of the technical contents disclosed in the present invention without affecting the effects and purposes that can be achieved by the present invention.
[0017] Figure 1 It is a schematic diagram of the method flow of the present invention; Figure 2 It is a module diagram of the present invention; Figure 3 It is the Mamba structure diagram of the present invention; Figure 4Schematic diagram of the cross-attention mechanism for feature fusion of the present invention. DETAILED DESCRIPTION
[0018] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below. Obviously, the described embodiments are only part of the embodiments of the present application, rather than all the embodiments. These descriptions are only to further illustrate the features and advantages of the present invention, rather than to limit the claims of the present invention. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without making creative work are within the scope of protection of this application.
[0019] The specific implementation of the present invention is further described in detail below in conjunction with the accompanying drawings and examples. The following examples are used to illustrate the present invention, but are not intended to limit the scope of the present invention.
[0020] This embodiment provides a traffic flow prediction method based on Mamba. Figure 1 , Figure 2 As shown, the following steps are included: Step 1: Dataset collection and preprocessing. Obtain traffic flow data and exogenous variables such as weather, holiday information, and road construction information. Then perform data preprocessing, including missing value filling, data cleaning, and the division and standardization of training sets, validation sets, and test sets.
[0021] In step 1, traffic flow data comes from 10,000 ring inductive sensors deployed by the California Highway Administration, which continuously record core indicators such as traffic flow, average speed, and time occupancy at a sampling interval of 30 seconds. In addition, in terms of exogenous variables, 5-minute granular meteorological data (wind speed, precipitation, visibility) and real-time traffic accident annotation information provided by the National Oceanic and Atmospheric Administration (NOAA) of the United States are connected to increase the impact of exogenous variables.
[0022] For missing values, a dual-dimensional interpolation strategy of time and space is adopted: linear interpolation is performed on short-term missing values (<1 hour) in the time dimension, and the spatial dimension is filled in based on the weighted method of three adjacent sensors in the same direction (the weight is inversely proportional to the square of the sensor spacing, and a Gaussian time decay factor is introduced).
[0023] , in: is the sensor spacing, It is the time point to be filled. To control the time decay rate, is the timestamp of the data, , Dynamic calculation based on historical data for the same period, weight Reflection sensor Data time and current time The closer the time difference is, the higher the weight is. Indicates sensor In time The interpolated estimate of ; Indicates at time sensor Observed value of Display and Sensor Three sensors with the same direction and closest spatial position.
[0024] In order to better train and converge the model, the data was standardized and de-standardized according to the mean and standard deviation The original data is converted to standardized values, and the standardized data will have zero mean and unit variance. After the prediction is completed, the same mean and standard deviation are used for inverse transformation to convert the prediction results back to the scale of the original data for evaluation. Finally, the training set, validation set, and test set are divided in a ratio of 7:1:2.
[0025] Step 2: Static graph construction and spatial feature extraction: Based on the physical connectivity of the road network, an adjacency matrix is constructed, and the symmetric normalized Laplacian matrix is used to enhance the stability of graph convolution. Multi-order neighborhood information is aggregated by stacking multiple layers of GCN to extract the spatial correlation features of road sections.
[0026] Step 2-1: Graph construction and adjacency matrix definition: Consider each road segment in the highway network as a node in the graph. If two nodes (road segments) are physically directly connected (such as upstream and downstream relationships or intersection connections), the adjacency matrix A The corresponding elements in A ij =1, otherwise A ij =0.
[0027] Step 2-2: Laplace matrix normalization: Use symmetric normalized Laplace matrix Enhanced stability, including D is the degree matrix (diagonal matrix, ), I It is the unit matrix, and the self-loop is introduced to ensure that the node’s own characteristics are preserved.
[0028] Step 2-3: GCN propagation formula: The feature update formula for each GCN layer is ,in H (l) For the l The node feature matrix of the layer, the input layer , Nis the number of nodes, F is the total number of variables, W (l) For the l The trainable weight matrix of the layer, is the nonlinear activation function ReLU. By superimposing K Layer GCN gradually aggregates multi-order neighborhood information. , For the The node feature matrix of the layer.
[0029] Step 3: Decoupled embedding of spatiotemporal dual tokens. Decouple the spatial features into time tokens (T-Token) and variable tokens (V-Token), which are fused with position encoding and node embedding through a fully connected layer to achieve independent modeling of temporal continuity and cross-variable correlation.
[0030] Step 3-1: Time token embedding module: In the time embedding module, the data of the same time step is embedded into a token, so that each token can represent the complete information of a time point. The embedding step is , Represents the characteristics of the time dimension, represents the fully connected layer designed for time features, represents the original spatial features, Represents time position coding, retains the continuity of the time dimension, encodes time order information, and outputs , N is the number of nodes, d is the feature dimension, T is the number of time steps.
[0031] Step 3-2: Variable Token Embedding Module: The variable embedding module generates variable tokens by transposing the time tokens, and embeds the entire time series of each variable into a token independently to focus on the global features of the variables in the sequence; the embedding step is , The characteristics representing the node dimension, represents a fully connected layer designed for node dimension features, represents the original spatial features, Represents the embedding vector of node i, aggregates node features, encodes variable correlations across variables, and outputs , N is the number of nodes, d is the feature dimension, F is the total number of variables. Since the order of the sequence is implicitly stored in each variable token, positional embedding is no longer required for variable embedding.
[0032] Step 4: Double-branch Mamba modeling. Figure 3As shown in the figure, the time series branch: bidirectional Mamba is used to capture the long-term periodic dependence of traffic flow, and the time series state is fused through forward and backward scanning. The variable branch: based on the unidirectional Mamba modeling, the nonlinear coupling relationship between multiple variables such as speed and flow is generated to generate cross-variable interaction features.
[0033] Step 4-1: Bidirectional Mamba Extracts Temporal Dependencies: Extract temporal features from the temporal embedding vector obtained in step 3-1 and apply bidirectional Mamba along the temporal dimension, including forward scanning. and backward scanning , output fusion ,in They represent the discretized time series Mamba parameters. In order to improve the computational efficiency, the continuous parameters are discretized by the zero-order hold rule. , represents the state vector of the system, represents the time derivative of the state vector, represents the system matrix, represents the input matrix, represents the zero-order hold form of a discrete input signal, represents the output signal of the system, Represents the output matrix. It captures historical information through forward propagation and future information through back propagation, while modeling the contextual dependencies between the past and the future to enhance the temporal expression capability.
[0034] Step 4-2: One-way Mamba to extract variable correlations: Method: Apply one-way Mamba along the variable dimension (from key variables → auxiliary variables), , output (The final hidden state represents the dependencies between variables), where: Indicates The hidden state of the variable, Indicates The hidden state of the variable, Indicates f The input features of the variables, represents the total number of variables, are the state space parameters of the variable Mamba respectively.
[0035] Step 5: Fusion of spatiotemporal-variable features. Figure 4 As shown in the figure, the dual-branch features are fused through the cross-attention mechanism, with time series features as queries and variable features as keys and values. The residual connection is combined to retain the original spatial information and enhance the multi-dimensional feature interaction.
[0036] Step 5-1: Cross-attention mechanism: Time series features are used as Query and variable features are used as Key / Value. ,in: represents the variable feature matrix, represents the time series feature matrix, Indicates that the time series characteristics Projected into the Query matrix, Indicates that the time series characteristics Projection is the Key matrix, Indicates that the time series characteristics Projection is the Value matrix, represents the feature dimension, represents the normalized attention weight, Represents the fused spatiotemporal joint features.
[0037] Step 5-2: Residual connection: retain the original spatiotemporal features, ,in: Represents the final output, represents the convolution operation, Represents the original spatial features. The obtained fusion features are output as future multi-step sequences through linear projection to achieve short-term prediction of traffic flow.
[0038] Step 6: Perform multi-step prediction and output the prediction results. Finally, output the predicted values of the multi-step sequence through projection mapping.
[0039] The prediction method of the present invention is evaluated by using mean absolute error MAE, root mean square error RMSE, symmetric mean percentage error SMAPE and correlation coefficient.
[0040] The loss function used is cross entropy loss, and the formula is:
[0041] The method is implemented using Pytorch and trained using the Adam optimizer. After multiple experiments to adjust the parameters, the present invention sets the learning rate to 0.0001, the batch size to 32, and each experiment runs 100 cycles, allowing early stopping when the effect is good.
[0042] The static graph convolutional network of the present invention extracts spatial correlation (such as intersection hierarchical relationship, road traffic direction) from the inherent topology of the road network, while the dual-branch Mamba architecture captures the time dependence and variable correlation of traffic flow. Furthermore, the spatiotemporal dual token mechanism explicitly distinguishes the independent influence and synergistic effect between variables (for example, the differential inhibition of the traffic capacity of main roads and branch roads by heavy rain, or the coupled propagation law of traffic accidents and surrounding road network density) by decoupling the action boundaries of multi-source factors such as traffic flow, environmental variables and event interference, significantly improving the modeling robustness and interpretability in multi-variable coupling scenarios. In addition, the lightweight design based on Mamba replaces the traditional Transformer architecture, and utilizes the compression characteristics of the state space and the selective feature transfer mechanism to achieve more efficient computing resource utilization in the processing of ultra-long sequence data (such as traffic flow collected at a high frequency for many consecutive days), providing a feasible technical path for all-weather real-time monitoring and rapid response of urban-level road networks.
[0043] Only the preferred embodiments of the present invention are described in detail above, but the present invention is not limited to the above embodiments. Various changes can be made within the knowledge scope of ordinary technicians in this field without departing from the purpose of the present invention, and various changes should be included in the protection scope of the present invention.
Claims
1. A traffic flow prediction method based on Mamba, characterized in that: The following steps are involved: S1. Dataset collection and preprocessing: Obtain traffic flow data and exogenous variables such as weather, holiday information, and road construction information, and then perform data preprocessing, including missing value filling, data cleaning, and the division and standardization of training sets, validation sets, and test sets; S2, static graph construction and spatial feature extraction: construct an adjacency matrix based on the physical connectivity of the road network, use the symmetric normalized Laplacian matrix to enhance the stability of graph convolution, aggregate multi-order neighborhood information through multi-layer GCN stacking, and extract the spatial correlation features of road sections; S3, spatiotemporal dual-token decoupling embedding: decouple spatial features into time tokens T-Token and variable tokens V-Token, which are fused with position encoding and node embedding through fully connected layers to achieve independent modeling of temporal continuity and cross-variable correlation; S4, Dual-branch Mamba modeling: Time series branch: bidirectional Mamba is used to capture the long-term periodic dependence of traffic flow, and the time series state is integrated through forward and backward scanning; variable branch: based on the nonlinear coupling relationship between speed and flow multivariables of unidirectional Mamba modeling, cross-variable interaction features are generated; S5, spatiotemporal-variable feature fusion: The dual-branch features are fused through the cross-attention mechanism, with time series features as query and variable features as key and value, combined with residual connection to retain the original spatial information and enhance multi-dimensional feature interaction; S6. Perform multi-step prediction and output the prediction results. Finally, output the predicted values of the multi-step sequence through projection mapping.
2. A traffic flow prediction method based on Mamba according to claim 1, characterized in that: The data set collection and preprocessing method in S1 is as follows: the traffic flow data comes from 10,000 ring inductive sensors deployed by the California Highway Administration, which continuously record traffic flow, average speed and time occupancy at a sampling interval of 30 seconds; In terms of exogenous variables, the 5-minute granular meteorological data and real-time traffic accident annotation information provided by the National Oceanic and Atmospheric Administration (NOAA) of the United States are connected to increase the impact of exogenous variables. The granular meteorological data include wind speed, precipitation and visibility. For missing values, a dual-dimensional interpolation strategy of time and space is adopted: linear interpolation is performed on short-term missing values in the time dimension, and the spatial dimension is filled based on the weighted addition of three adjacent sensors in the same direction: , in: is the sensor spacing, For the time point to be filled, To control the time decay rate, is the timestamp of the data, , The weight is calculated dynamically based on historical data of the same period. Reflection sensor Data time and current time The closer the time difference is, the higher the weight is. Indicates sensor In time The interpolated estimate of ; Indicates sensor In time Observed value of Display and Sensor Three sensors in the same direction and closest in spatial position; Standardize and de-standardize the data according to the mean and standard deviation The original data is converted to standardized values, and the standardized data will have zero mean and unit variance; after the prediction is completed, the same mean and standard deviation are used for inverse transformation, and the prediction results are converted back to the scale of the original data for evaluation; finally, the training set, validation set, and test set are divided in a ratio of 7:1:
2.
3. A traffic flow prediction method based on Mamba according to claim 1, characterized in that: The method of static image construction and spatial feature extraction in S2 is: S2.
1. Graph construction and adjacency matrix definition: Consider each road segment in the highway network as a node in the graph. If two nodes are directly connected physically, the adjacency matrix A The corresponding elements in A ij =1, otherwise A ij =0; S2.2, Laplace matrix normalization: using symmetric normalized Laplace matrix Enhanced stability, including D is the degree matrix, D The diagonal matrix , I It is the unit matrix, and the self-loop is introduced to ensure that the node’s own characteristics are preserved; S2.3, GCN propagation formula: The feature update formula of each GCN layer is ,in H (l) For the l The node feature matrix of the layer, the input layer , N is the number of nodes, F is the total number of variables, W (l) For the l The trainable weight matrix of the layer, is the nonlinear activation function ReLU; by superposition K Layer GCN gradually aggregates multi-order neighborhood information. , For the The node feature matrix of the layer.
4. A Mamba-based traffic flow prediction method according to claim 1, characterized in that: The method for decoupling and embedding the spatiotemporal dual tokens in S3 is: S3.
1. Time token embedding module: In the time embedding module, data at the same time step is embedded into a token so that each token can represent the complete information at a time point. The embedding steps are: , Represents the characteristics of the time dimension, represents the fully connected layer designed for time features, represents the original spatial features, Represents time position coding, retains the continuity of the time dimension, encodes time order information, and outputs , N is the number of nodes, d is the feature dimension, T is the number of time steps; S3.2, variable token embedding module: The variable embedding module generates variable tokens by transposing the time tokens, and embeds the entire time series of each variable into a token independently to focus on the global features of the variables in the sequence; embedding Steps , represents the characteristics of the node dimension, represents a fully connected layer designed for node dimension features, represents the original spatial features, Represents the embedding vector of node i, aggregates node features, encodes variable correlations across variables, and outputs , N is the number of nodes, d is the feature dimension, F is the total number of variables. Since the order of the sequence is implicitly stored in each variable token, positional embedding is no longer required for variable embedding.
5. A Mamba-based traffic flow prediction method according to claim 4, characterized in that: The method of double-branch Mamba modeling in S4 is: S4.1, bidirectional Mamba extracts temporal dependencies: extract temporal features from the temporal embedding vector obtained in S3.1, and apply bidirectional Mamba along the temporal dimension, including forward scanning and backward scanning , output fusion ,in They represent the discrete time series Mamba parameters respectively; in order to improve the computational efficiency, the continuous parameters are discretized by the zero-order hold rule. , represents the state vector of the system, represents the time derivative of the state vector, represents the system matrix, represents the input matrix, represents the zero-order hold form of a discrete input signal, represents the output signal of the system, represents the output matrix; It also captures historical information through forward propagation and future information through back propagation, while modeling the contextual dependencies between the past and the future to enhance the temporal expression capability; S4.2, One-way Mamba to extract variable correlation: Apply one-way Mamba along the variable dimension, from key variables to auxiliary variables, , output , the final hidden state represents the dependency between variables, where: Indicates The hidden state of the variable, Indicates The hidden state of the variable, Indicates f The input features of the variables, represents the total number of variables, are the state space parameters of the variable Mamba respectively.
6. A Mamba-based traffic flow prediction method according to claim 5, characterized in that: The method of spatiotemporal-variable feature fusion in S5 is: S5.
1. Cross-attention mechanism: Time series features are used as Query, and variable features are used as Key and Value. ,in: represents the variable feature matrix, represents the time series feature matrix, Indicates that the time series characteristics Projected into the Query matrix, Indicates that the time series characteristics Projection is the Key matrix, Indicates that the time series characteristics Projection is the Value matrix, represents the feature dimension, represents the normalized attention weight, Represents the fused spatiotemporal joint features; S5.2, residual connection: retain the original spatiotemporal features, ,in: Represents the final output, represents the convolution operation, Represents the original spatial characteristics.
7. The Mamba-based traffic flow prediction method according to claim 1, characterized in that: The fusion features obtained in S5 are output as future multi-step sequences through linear projection to achieve short-term prediction of traffic flow.
8. The Mamba-based traffic flow prediction method according to claim 1, characterized in that: The prediction method in S6 is evaluated using mean absolute error MAE, root mean square error RMSE, symmetric mean percentage error SMAPE and correlation coefficient.
Citation Information
Patent Citations
Unmanned surface ship cluster trajectory prediction method and system in uncertain environment
CN119179863A
Cellular base station network flow prediction method based on Mama and graph neural network
CN119232600A
Ultrasonic image few-sample target detection method and system based on Mangbar model
CN119251470A
Long-term time sequence prediction method of double-path Mama for data processing
CN119557605A
Lightweight space-time traffic flow prediction method based on GAT and Mama
CN119625981A
Cited By
Geographic multi-factor classification and fusion modeling method based on state space model
CN120336444A
Traffic flow detection and prediction method based on unmanned aerial vehicle feedback collaborative optimization
CN120449100A
Time-varying graph neural network traffic flow prediction method based on dynamic memory bank
CN121171043A
A Time-Varying Graph Neural Network-Based Traffic Flow Prediction Method Based on Dynamic Memory
CN121171043B
Long-term traffic flow prediction method and system based on frequency domain decomposition and time sequence modeling
CN121354357A