Traffic flow prediction method and system based on Bayesian method and graph convolution

Through Bayesian method and graph convolution combined with variational inference, a traffic network is built to optimize time and spatial uncertainty, and the accuracy and robustness of the existing traffic flow prediction model are solved, and efficient space-time dependence capture and real-time prediction are achieved.

CN115660135BActive Publication Date: 2025-08-29TIANJIN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211072087.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-09-02
Publication Date
2025-08-29
Estimated Expiration
2042-09-02

AI Technical Summary

Technical Problem

Existing traffic flow prediction models are difficult to effectively model the uncertainty of time and space, resulting in low prediction accuracy and poor robustness, large calculation amounts and excessive parameters, making it difficult to effectively capture space-time dependence.

Method used

Using the traffic flow prediction method based on Bayesian method and graph convolution, the traffic network is constructed, and the uncertainty of time and space is optimized by using variational inference, combined with diffusion graph convolution and expansion causal convolution, the time and spatial characteristics of traffic flow are extracted, and the model parameters are optimized to achieve real-time prediction.

Benefits of technology

It improves the accuracy and robustness of traffic flow prediction, reduces the number of model parameters, effectively captures the space-time dependence, and enhances the prediction ability of the model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN115660135B_ABST
    Figure CN115660135B_ABST
Patent Text Reader

Abstract

The present invention proposes a traffic flow prediction method and system based on Bayesian methods and graph convolution. A traffic network is constructed based on the spatial relationships between roads. Traffic flow data from the constructed traffic network is sampled and preprocessed to obtain traffic flow information at intersections and construct a data set of a road traffic flow matrix. A Bayesian and graph convolution model is constructed, and the road traffic flow matrix is ​​used as input to the Bayesian and graph convolution model to extract the temporal uncertainty characteristics and spatial uncertainty relationship characteristics of the traffic flow data. A model loss function is defined through variational inference, and the model parameters are continuously optimized using a backpropagation algorithm based on the loss function. Finally, real-time traffic flow data is obtained as input to the model to achieve real-time road traffic flow prediction. The present invention uses variational inference to optimize the variational posteriors of temporal uncertainty and spatial uncertainty, modeling epistemic uncertainty, reducing errors, and improving the accuracy of traffic flow prediction.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the field of intelligent transportation systems, and in particular relates to a traffic flow prediction method and system based on Bayesian method and graph convolution. Background Art

[0002] Traffic forecasting plays a crucial role in intelligent transportation systems and has extensive applications in traffic management and planning. In recent years, various deep learning methods, such as convolutional neural networks (CNNs) and graph convolutional networks (GCNs), have demonstrated promising performance in traffic forecasting. With the advancement of graph neural networks, spatiotemporal graph modeling has garnered increasing attention. Spatiotemporal graph modeling has broad applications in solving complex system problems such as traffic speed prediction, taxi demand forecasting, and human behavior recognition. Unlike traditional convolutional neural networks (CNNs), CNNs rely on input data in a relatively regular matrix structure (Euclidean data). However, in reality, graph data structures such as social networks and traffic networks are not in a regular matrix format. This type of data is called non-Euclidean data. In non-Euclidean topological graphs, the number of neighbors for each node is variable, making it impossible to perform aggregation using fixed convolution kernels like in CNNs. GCNs address this problem by performing convolutions on non-Euclidean data and aiming to model dynamic node inputs by assuming interdependencies between connected nodes.

[0003] GCN uses spatial graph relationships to fuse information. It represents nodes in the graph as low-dimensional, real-valued, dense vectors. This vector representation enables representation and reasoning in vector space, allowing it to be used in downstream tasks. For example, a node representation in a user social network is a representation vector for each user, which can then be used for node classification.

[0004] However, common methods cannot automatically model spatial dependencies and dynamic spatiotemporal states, and they place no constraints on the distribution of outputs. Most spatiotemporal series prediction models face challenges in effectively modeling spatiotemporal dependencies. Furthermore, most models suffer from common training flaws common in neural network training, including excessively large model parameters leading to exponentially increased computational effort, increased generalization error, and limited robustness. Furthermore, there are challenges in effectively improving prediction accuracy and reducing discrepancies with real data.

[0005] A patent has been proposed in the prior art: a traffic flow prediction method based on RGCN (CN111862592 A). This method uses the road traffic network and road traffic state matrix as the input of a graph convolution layer based on Gaussian distribution, and then extracts the node features of the road traffic network. Finally, the features sampled by the graph convolution layer based on Gaussian distribution are used as the input of the regression prediction layer to calculate the prediction results corresponding to the input. The model can improve the robustness of the graph convolution network, but it does not model temporal uncertainty, and faces the problem of missing time-dependent information while completing the prediction task. Summary of the Invention

[0006] To address the above problems, the present invention proposes a traffic flow prediction method and system based on Bayesian methods and graph convolution, which uses variational inference to optimize the variational posteriori of temporal uncertainty and spatial uncertainty, models cognitive uncertainty, reduces errors, and improves the prediction accuracy of traffic flow.

[0007] In order to achieve the above object, the technical solution of the present invention is implemented as follows:

[0008] A traffic flow prediction method based on Bayesian method and graph convolution, including:

[0009] S1. Construct a transportation network based on the spatial relationship between roads, where road intersections or road sections represent nodes and the spatial relationship between nodes represents edges;

[0010] S2. Sampling and preprocessing traffic flow data on the constructed traffic network to obtain traffic flow information at intersections and construct a data set of road traffic flow matrix;

[0011] S3. Constructing a Bayesian and graph convolution model, using the road traffic flow matrix as input to the Bayesian and graph convolution model, and extracting temporal uncertainty features and spatial uncertainty relationship features of the traffic flow data;

[0012] S4. After variational inference, the model loss function is defined, and the model parameters are continuously optimized using the back propagation algorithm based on the loss function; finally, real-time traffic flow data is obtained as the input of the model to achieve real-time road traffic flow prediction.

[0013] Furthermore, in step S1, the spatial information of the transportation network is represented by an adjacency matrix Indicates; Hedi If there is a spatial connection between the nodes, the adjacency matrix element is 1 if the value is set, otherwise it is 0.

[0014] Furthermore, step S2 specifically includes:

[0015] S201, sampling at fixed time according to the traffic flow at the intersection;

[0016] S202. Preprocess the sampled data and normalize the data using the Z-score standardization method. The calculation expression is as follows: ,in, is the mean of the original traffic data, is the standard deviation of the original flow data;

[0017] S203, dividing the data set obtained after preprocessing, using 70% of the data for training the model, 20% of the data for testing, and the remaining 10% of the data for verification;

[0018] S204, constructing a road traffic flow matrix, for The traffic network of nodes is sampled every several minutes, with a total of samples, for a node , then the corresponding The transportation network of nodes is obtained by matrix:

[0019]

[0020] The matrix row vector represents a node The sampling results are historical traffic flow data; the column vector represents the total nodes.

[0021] Furthermore, step S3 specifically includes:

[0022] S301, build graph convolution layer, define ; Indicates output; Represents the road traffic flow matrix as input signal; is the adjacency matrix, represents the normalized adjacency matrix with self-loops; Represents the model parameter matrix; the diffusion process of the graph signal is modeled using diffusion graph convolution, that is,

[0023] ;

[0024] in Represents the power series of the transfer matrix, k is the kth layer of graph convolution, in the case of undirected graphs, ; In the case of a directed graph, the diffusion process has two directions, forward and backward, where the forward transfer matrix and the backward transfer matrix ; Represents the transposed matrix of A; with the forward and backward transfer matrices, the diffusion graph convolution model is

[0025] ;

[0026] S302, in order to obtain the uncertainty of spatial relations, assume that spatiotemporal traffic data is represented as random embedding , where N is the number of spatial traffic detection nodes, D is the embedding dimension of spatial traffic detection nodes; R represents the real number space, Represents the matrix of the real number field N*D, and the potential attribute random variable is , then the uncertain spatial relationship can be expressed as ,in Obey the prior mixed Gaussian distribution; A is the adjacency matrix;

[0027] The overall calculation formula of the graph convolution part is

[0028] ;

[0029] S303, Construction on the Time Convolution Module, Given a One-Dimensional Sequence Input and filter , dilated causal convolution operation and In step The causal convolution operation is expressed as

[0030] ;

[0031] in is the expansion factor that controls the jump distance; s is the sliding step size, Indicates the location of a certain historical information;

[0032] Gated TCN module, given input , where S represents the time dimension of the 3D tensor; the form is:

[0033] ;

[0034] in 、 、 and are model parameters, are element-wise products, is the output activation function, is a sigmoid function; at the same time, in order to obtain the uncertainty of the time part, a Bayesian convolutional neural network is used in the time dimension. ;in, Represents the model parameter matrix, using variational distribution parameters.

[0035] Furthermore, step S4 specifically includes:

[0036] S401. A sampling process is performed based on the randomly initialized adjacency matrix A and the model parameter matrix W. There is an error between the sampling result and the true value. Through the variational inference method, the loss function of the variational loss is as follows:

[0037] ;

[0038] where KL is the divergence, which represents the difference between two distributions and is defined as KL(p||q)=sum(x)(logq(x)log(q(x) / p(x))); is the variational posterior distribution The control parameters, represents all random variables, is the prior distribution, is the divergence distance between the two distributions, and the last term represents the likelihood of the data distribution;

[0039] S402. Based on the loss function, the model parameters are continuously optimized using the back propagation method. The test set data is used as the model input, and the predicted values ​​are compared with the actual observed values ​​to obtain the prediction accuracy.

[0040] S403: Acquire real-time traffic flow data as input to the model to achieve real-time road traffic flow prediction.

[0041] On the other hand, the present invention also proposes a traffic flow prediction system based on Bayesian method and graph convolution, comprising:

[0042] Traffic network construction module, which constructs a traffic network based on the spatial relationship between roads, where road intersections or road sections represent nodes and the spatial relationship between nodes represents edges;

[0043] The dataset construction module samples and preprocesses traffic flow data of the constructed traffic network, obtains traffic flow information at intersections, and constructs a dataset of the road traffic flow matrix;

[0044] A model building module is used to build a Bayesian and graph convolution model, using the road traffic flow matrix as input to the Bayesian and graph convolution model to extract the temporal uncertainty features and spatial uncertainty relationship features of the traffic flow data;

[0045] The model optimization and prediction module defines the model loss function through variational inference, and continuously optimizes the model parameters using the back propagation algorithm based on the loss function; finally, real-time traffic flow data is obtained as the input of the model to realize the prediction of real-time road traffic flow.

[0046] Furthermore, in the traffic network construction module, the spatial information of the traffic network is represented by an adjacency matrix Indicates; Hedi If there is a spatial connection between the nodes, the adjacency matrix element is 1 if the value is set, otherwise it is 0.

[0047] Furthermore, the dataset construction module includes:

[0048] The sampling unit takes samples at fixed times according to the traffic flow at the intersection;

[0049] The preprocessing unit preprocesses the sampled data and normalizes the data using the Z-score standardization method. The calculation expression is as follows: ,in, is the mean of the original traffic data, is the standard deviation of the original flow data;

[0050] The dataset partitioning unit divides the dataset obtained after preprocessing, using 70% of the data for model training, 20% for testing, and the remaining 10% for validation;

[0051] Matrix construction unit, constructs road traffic flow matrix, for The traffic network of nodes is sampled every several minutes, with a total of samples, for a node , then the corresponding The transportation network of nodes is obtained by matrix:

[0052]

[0053] The matrix row vector represents a node The sampling results are historical traffic flow data; the column vector represents the total nodes; then Indicates the The node in Traffic flow data within a certain time period.

[0054] Furthermore, the model building module includes:

[0055] The first unit is used to build the graph convolution layer and define , Indicates output, Represents the road traffic flow matrix as input signal; is the adjacency matrix, represents the normalized adjacency matrix with self-loops; Represents the model parameter matrix; the diffusion process of the graph signal is modeled using diffusion graph convolution, that is,

[0056] ;

[0057] in Represents the power series of the transfer matrix, k is the kth layer of graph convolution, in the case of undirected graphs, ; In the case of a directed graph, the diffusion process has two directions, forward and backward, where the forward transfer matrix and the backward transfer matrix ; Represents the transposed matrix of A; with the forward and backward transfer matrices, the diffusion graph convolution model is

[0058] ;

[0059] The second unit is used to obtain the uncertainty of spatial relationships. Assume that the spatiotemporal traffic data is represented as a random embedding , where N is the number of spatial traffic detection nodes, D is the embedding dimension of spatial traffic detection nodes; R represents the real number space, Represents the matrix of the real number field N*D, and the potential attribute random variable is , then the uncertain spatial relationship can be expressed as ,in Obey the prior mixed Gaussian distribution; A is the adjacency matrix;

[0060] The overall calculation formula of the graph convolution model is:

[0061] ;

[0062] The third unit, building on the time convolution module, given a one-dimensional sequence input and filter , dilated causal convolution operation and In step The causal convolution operation is expressed as

[0063] ;

[0064] in is the expansion factor that controls the jump distance; s is the sliding step size, Indicates the location of a certain historical information;

[0065] Gated TCN module, given input , where S represents the time dimension of the 3D tensor; the form is:

[0066] ;

[0067] in 、 、 and are model parameters, are element-wise products, is the output activation function, is a sigmoid function; at the same time, in order to obtain the uncertainty of the time part, a Bayesian convolutional neural network is used in the time dimension. ;in, Represents the model parameter matrix, using variational distribution parameters.

[0068] Furthermore, the model optimization and prediction module includes:

[0069] The loss function unit is used to perform a sampling process based on the randomly initialized adjacency matrix A and the model parameter matrix W. There is an error between the sampling result and the true value. After the variational inference method, the loss function of the variational loss is as follows:

[0070] ;

[0071] where KL is the divergence, which represents the difference between two distributions and is defined as KL(p||q)=sum(x)(logq(x)log(q(x) / p(x))); is the variational posterior distribution The control parameters of , which represent all random variables, is the prior distribution, is the divergence distance between the two distributions, and the last term represents the likelihood of the data distribution;

[0072] The optimization unit uses the back-propagation method to continuously optimize the model parameters based on the loss function, takes the test set data as the model input, and compares the predicted value with the actual observation value to obtain the prediction accuracy;

[0073] The prediction unit obtains real-time traffic flow data as the input of the model to realize the prediction of real-time road traffic flow.

[0074] Compared with the prior art, the present invention has the following beneficial effects:

[0075] (1) This invention proposes a spatiotemporal prediction model that obtains a spatial relationship adjacency matrix by operating two feature matrices, thereby reducing the number of model parameters and fitting the spatial dependence of spatiotemporal sequence data; that is, it constructs deterministic spatial relationships in traffic with very few parameters;

[0076] (2) This paper uses variational inference to model the uncertain spatial relationships in traffic, learns the hidden spatial dependency features, and discovers the unknown dependency structure in the system.

[0077] (3) The present invention integrates deterministic spatial relationships and uncertain spatial relationships in traffic, making the model more accurate and enhancing the robustness of the model. BRIEF DESCRIPTION OF THE DRAWINGS

[0078] Figure 1 Schematic diagram of the model structure of an embodiment of the present invention;

[0079] Figure 2 Schematic diagram of a gated TCN module according to an embodiment of the present invention;

[0080] Figure 3 is a flow chart of model training according to an embodiment of the present invention;

[0081] Figure 4 2 is a comparison chart of model prediction performance of embodiments of the present invention. DETAILED DESCRIPTION

[0082] The present invention will be described in detail below with reference to the accompanying drawings and in conjunction with embodiments.

[0083] Existing methods primarily capture spatial dependencies within a fixed graph structure, as most models assume that the underlying relationships between entities are predetermined. A fundamental assumption behind spatiotemporal graph modeling is that the future information of a node depends on its past information and that of its neighbors. Therefore, capturing both spatial and temporal dependencies simultaneously becomes a major challenge. Furthermore, existing traffic flow prediction methods do not adequately model spatiotemporal uncertainty, and due to their large number of parameters, existing models suffer from severe overfitting. Research assumes that the graph structure of the data reflects the true dependencies between nodes. However, there are cases where connections do not capture the interdependencies between two nodes, or where two nodes have interdependencies but lack connections. Furthermore, current research on spatiotemporal graph modeling is ineffective for learning temporal dependencies. RNN-based methods suffer from time-consuming iterative propagation and exploding / vanishing gradient problems when capturing long sequences. CNN-based methods enjoy the advantages of parallel computing, stable gradients, and low memory requirements, but require many layers to capture very long sequences.

[0084] In order to make up for the shortcomings of existing methods and improve the prediction accuracy of traffic flow data, the present invention proposes a traffic flow prediction method and system based on Bayesian method and graph convolution, which integrates GCN and variational inference methods. By incorporating modeling of uncertain factors into the model, it can simultaneously capture spatiotemporal dependencies.

[0085] The method proposed by the present invention includes the following contents:

[0086] 1. Define Bayesian and graph convolution models:

[0087] Use graph structure data Indicates that Is a node set , It is an edge set The adjacency matrix derived from the graph is Indicates, where N represents the number of spatial traffic detection nodes. and ,but is 1, otherwise it is 0. At each time step ,picture There is a dynamic feature matrix ,in is the embedding dimension of the spatial traffic detection node. In this invention, the feature matrix and the graph signal are used alternately. Given a graph and its history Step graph signal, the model is to learn a function , the function can predict its next Step diagram signal. The mapping relationship is expressed as: .

[0088] 1.1、Construction of graph convolution layer:

[0089] Graph convolution is a basic operation to extract node features based on the structural information of the nodes. represents the normalized adjacency matrix with self-loops, Represents the input signal, Z represents the output, and W represents the model parameter matrix, then the graph convolution layer is defined as: The present invention uses diffusion graph convolution to model the diffusion process of graph signals, namely

[0090]

[0091] in represents the power series of the transfer matrix. In the case of an undirected graph, In the case of a directed graph, the diffusion process has two directions, forward and backward, where the forward transfer matrix and the backward transfer matrix . represents the transposed matrix of A; with the forward and backward transfer matrices, the diffusion graph convolution layer is written as

[0092]

[0093] 1.2. Construction of temporal convolutional layers (TCN-a, TCN-b):

[0094] Dilated causal convolution is used as the temporal convolution layer (TCN) to capture the temporal trend of nodes. The dilated causal convolution network has an exponentially large receptive field by increasing the layer depth. In contrast to RNN-based methods, the dilated temporary convolution network can correctly process long-distance sequences in a non-recursive manner, which helps parallel computing and alleviates the gradient explosion problem. The dilated causal convolution maintains the temporal causal order by padding the input with zeros so that the prediction of the current time step only involves historical information. As a special case of the standard one-dimensional convolution, the dilated causal convolution operation slides the input by skipping the value of a certain step. Mathematically, given a one-dimensional sequence input and filter , dilated causal convolution operation and In step The causal convolution operation is expressed as

[0095]

[0096] in is the expansion factor that controls the jump distance; s is the sliding step size, Indicates the localization of a certain piece of historical information. By stacking dilated causal convolutional layers with increasing dilation factors, the receptive field of the model increases exponentially. This enables the dilated causal convolutional network to capture longer sequences with fewer layers, thus saving computational resources.

[0097] Gated TCN module: Figure 2 The figure shows a schematic diagram of a gated TCN module. The gate mechanism is crucial in recurrent neural networks. A simple gated TCN only contains one output gate. , of the form:

[0098]

[0099] in 、 、 and are model parameters, are element-wise products, is the output activation function, is a sigmoid function that determines the ratio of information passed to the next layer. Gated TCN is used in the model to learn complex time dependencies. At the same time, in order to obtain the uncertainty of the time part, the model uses a Bayesian convolutional neural network in the time dimension. in, is the variational distribution parameter, and finally the cross entropy is used as the loss function of the temporal convolutional layer module.

[0100] 1.3. Spatial Dependency Modeling:

[0101] 1.3.1、Deterministic spatial dependencies:

[0102] In order to obtain the certainty of spatial relationships, it is assumed that spatiotemporal traffic data can be represented as random embeddings ,in is the number of spatial traffic detection points, and D is the embedding dimension of the detection points. The latent attribute random variable is , then the deterministic spatial dependency can be expressed as .

[0103] Through the above operations, optimizing A can reduce the number of parameters, making it easier for the model to learn the deterministic dependencies of the space.

[0104] 1.3.2 Variational Inference with Uncertain Spatial Dependence

[0105] Traffic data has a strong uncertainty factor, especially in space, and it is difficult to express it in a deterministic space.

[0106] Assume that spatiotemporal traffic data can be represented as random embedding , where N is the number of spatial traffic detection points and D is the embedding dimension of the detection points. The latent attribute random variable is , then the non-deterministic spatial dependency can be expressed as ,in Obey the prior mixed Gaussian distribution.

[0107] To learn The posterior distribution of , after the variational inference method, its variational loss is as follows:

[0108]

[0109] in is the variational posterior distribution The control parameters, represents all random variables, is the prior distribution, is the divergence distance between the two distributions, and the last term Represents the likelihood of the data distribution.

[0110] By learning the uncertainty relationships in space, the model can absorb the characteristics of the uncertainty relationships between traffic monitoring points. This is essentially modeling the cognitive uncertainty in space. Cognitive uncertainty means that it is difficult to fully model the spatial relationships in the real environment. Generally, it is difficult for the established models to take all factors in the real traffic environment into account.

[0111] 2. Construction of the entire Bayesian and graph convolution model:

[0112] like Figure 1As shown, first build spatiotemporal layers and global variable space modules, where each spatiotemporal layer includes a gated TCN module (Gated TCN), a Bayesian convolutional neural network (BBCNN), and a global variable space module consisting of , Composition, of which Responsible for learning the temporal dependencies of data, Responsible for learning the spatial dependency of data. Through the known spatiotemporal data information, the data is parsed and the data for a period of time in the future is calculated, and missing values ​​can be filled. The specific operation includes the following steps: First, the input data is converted through the convolutional neural network (CNN) layer, and then passed to the gated TCN module (Gated TCN) and the Bayesian convolutional neural network (BBCNN) module respectively. Secondly, the output results of these two modules are fused and then passed to the Bayesian graph convolution module, including the graph convolution layer (GCN) and the Bayesian graph convolution layer (BGCN), to integrate the temporal dependency learned in the global variable space component ( ) and spatial dependence ( ) are fused and then applied to k spatiotemporal layers. Finally, each spatiotemporal layer has a residual connection and skip connections to the output layer (CNN). Experiments using multiple public traffic datasets show that the new model significantly outperforms the Gated Recurrent Unit (GRU) model and the Spatiotemporal Graph Convolutional Network (T-GCN) model.

[0113] Through the above operations, the evaluation indicators selected for this model include mean absolute error (MSE), root mean square error (RMSE) and mean absolute percentage error (MAPE). Figure 4 The figure shows the comparison results of the proposed model on the public datasets SZ-taxi and los-loop with other benchmark models in terms of various evaluation indicators. In the comparison result table for each dataset, the last row contains the data of the proposed model. The results show that the proposed model achieves the best prediction accuracy.

[0114] 2.1. The following are examples of the prediction accuracy evaluation method:

[0115] 1) Mean Squared Error(MSE):

[0116] ;in is the true value, is the predicted value, which is the actual value minus the predicted value, squared, and then summed and averaged.

[0117] 2) Root Mean Squared Error(RMSE):

[0118] ;in is the true value, is the predicted value, which is the actual value minus the predicted value and then the absolute value is taken and the average is calculated.

[0119] 3) Accuracy:

[0120] ;in It represents the total number of predicted samples minus the number of samples predicted correctly, that is, the number of wrong samples. The number of samples in the total sample. The accuracy is 1 minus the error rate.

[0121] The benchmark models compared in 2.2 include:

[0122] The basic time-gated models GRU[1] and T-GCN[1], the basic GCN with only spatial modeling, and the existing traditional statistical-based models: HA, ARIMA and SVR.

[0123] Analysis Conclusion: It can be seen that the accuracy of the model of the present invention on both datasets far exceeds that of the aforementioned benchmark model, which fully demonstrates the advantages of each module proposed in the present invention.

[0124] 3. Algorithm process:

[0125] like Figure 3 The figure shows the flow chart of the model training of the present invention. In the learning process, the Adam optimizer is used to train the model with an initial learning rate of 0.001. Step data, predict the next Data for a time period.

[0126] The specific application process of the present invention is described as follows:

[0127] Step 1) Construct a road traffic network based on the spatial relationship between roads, where road intersections or road sections represent nodes and the spatial relationship between nodes represents edges;

[0128] Traffic network map The spatial information can be represented by an adjacency matrix Indicates. Hedi If there is a spatial connection between the nodes, the adjacency matrix element is 1 if the value is set, otherwise it is 0.

[0129] Step 2) Sampling and preprocessing traffic flow data of the constructed traffic network to obtain traffic flow information at intersections and constructing a data set of road traffic flow matrix;

[0130] For a local traffic network in a certain area, obtain the traffic flow data of each intersection in a certain time period, that is, time series data. The time series data is obtained by sampling the traffic flow at the intersection at a fixed time. For example: for an intersection, you can get a time series data .

[0131] Traffic flow data of multiple nodes and multiple days are preprocessed and normalized using the Z-score standardization method. The calculation expression is as follows: ,in, is the mean of the original traffic data, is the standard deviation of the original flow data.

[0132] The dataset is divided into 70% of the data for training the model, 20% of the data for testing, and the remaining 10% of the data for validation.

[0133] Construct a traffic flow matrix. The traffic network diagram of each node Sampling once every minute, total sampling samples, for a node we can get , then the corresponding The road traffic network of nodes can get the matrix:

[0134]

[0135] The row vector of the matrix represents a node in The sampling results, that is, historical traffic flow data, the column vector represents the total nodes. Indicates the The node in Traffic flow data within a time period.

[0136] Step 3) Based on the road traffic flow matrix data, the Bayesian and graph convolution models proposed in this invention are used to extract traffic information features: the traffic flow state matrix is ​​used as input based on the Bayesian and graph convolution methods to extract the temporal uncertainty features and spatial uncertainty relationship features of the traffic flow data;

[0137] After the graph convolution layer, node information can be extracted, which is defined as follows , Indicates output, represents the input signal, is the adjacency matrix, Represents the model parameter matrix. The present invention uses diffusion graph convolution to model the diffusion process of graph signals, that is,

[0138]

[0139] In the case of a directed graph, the diffusion process has two directions, forward and backward, where the forward transfer matrix and the backward transfer matrix With the forward and backward transfer matrices, the diffusion graph convolution layer is written as

[0140]

[0141] In order to allow the model to discover hidden spatial dependencies, this embodiment uses learnable parameters. ,in is the number of spatial traffic detection nodes, and D is the embedding dimension of spatial traffic detection nodes. The latent attribute random variable is , then the uncertain spatial relationship can be expressed as .in Obey the prior mixed Gaussian distribution, use This is achieved by randomly initializing two node embedding dictionaries.

[0142] Therefore, the adjacency matrix is .

[0143] The overall calculation formula of the graph convolution part is

[0144]

[0145] Building on the temporal convolution module, given a one-dimensional sequence input and filter , dilated causal convolution operation and In step The causal convolution operation is expressed as

[0146]

[0147] in is the expansion factor that controls the jump distance.

[0148] Gated TCN module, given input , which has the form:

[0149]

[0150] in 、 、 and are model parameters, are element-wise products, is the output activation function, is a sigmoid function that determines the ratio of information passed to the next layer. The present invention uses Gated TCN in the model to learn complex time dependencies. At the same time, in order to obtain the uncertainty of the time part, the model uses Bayesian convolutional neural network in the time dimension. in, is the variational distribution parameter.

[0151] Step 4) Traffic flow prediction based on Bayesian and graph convolution models: The sampling results of the layer based on Bayesian and graph convolution models are used as the input of the regression prediction layer, the current input and the corresponding prediction results are calculated, the model loss function is defined, and the model parameters are continuously optimized using the back propagation algorithm according to the loss function; finally, real-time traffic flow data is obtained as the input of the model to realize real-time road traffic flow prediction.

[0152] Based on the randomly initialized adjacency matrix A and the model parameter matrix W, a sampling process can be performed. There is an error between the sampling result and the true value. After the variational inference method, the variational loss is as follows:

[0153]

[0154] in is the variational posterior distribution The control parameters, represents all random variables, is the prior distribution, is the divergence distance between the two distributions, and the last term Represents the likelihood of the data distribution.

[0155] Then, the back propagation method is used to continuously optimize the model parameters. Finally, the test set data is used as the model input, and the predicted values ​​are compared with the actual observation values ​​to obtain the prediction accuracy.

[0156] The evaluation metrics of the model performance are as follows:

[0157] Mean Absolute Error (MAE): The result is the average of the absolute errors between the actual value and the predicted value. The formula is as follows:

[0158]

[0159] Mean Absolute Percentage Error (MAPE): The result is the average of the absolute percentage errors between the actual value and the predicted value. The formula is as follows:

[0160]

[0161] Root Mean Square Error (RMSE): The result is the square difference between the actual value and the predicted value.

[0162] The arithmetic square root of the error is as follows:

[0163]

[0164] After the model obtained three evaluation indicators, it was compared with the current mainstream models, proving that its performance is in the leading position.

[0165] After the prediction accuracy meets the requirements, real-time traffic flow data is obtained as the input of the model to realize the prediction of real-time road traffic flow.

[0166] The above is a detailed introduction to the technical solution disclosed in the present invention, and the principles of the present invention are explained using specific implementation methods. The description of the above implementation methods is only applicable to help understand the principles of the present invention and is not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the principles of the present invention should be included in the scope of protection of the present invention.

Claims

1. A traffic flow prediction method based on Bayesian method and graph convolution, characterized by: include: S1. Construct a transportation network based on the spatial relationship between roads, where road intersections or road sections represent nodes and the spatial relationship between nodes represents edges; S2. Sampling and preprocessing traffic flow data on the constructed traffic network to obtain traffic flow information at intersections and construct a data set of road traffic flow matrix; S3. Constructing a Bayesian and graph convolution model, using the road traffic flow matrix as input to the Bayesian and graph convolution model, and extracting temporal uncertainty features and spatial uncertainty relationship features of the traffic flow data; S4. Through variational inference, the model loss function is defined, and the model parameters are continuously optimized using the back-propagation algorithm based on the loss function. Finally, real-time traffic flow data is obtained as input to the model to achieve real-time road traffic flow prediction; Step S3 specifically includes: S301, build graph convolution layer, define ; Indicates output; Represents the road traffic flow matrix as input signal; is the adjacency matrix, represents the normalized adjacency matrix with self-loops; Represents the model parameter matrix; the diffusion process of the graph signal is modeled using diffusion graph convolution, that is, ; in Represents the power series of the transfer matrix, k is the kth layer of graph convolution, in the case of undirected graphs ; In the case of a directed graph, the diffusion process has two directions, forward and backward, where the forward transfer matrix and the backward transfer matrix ; Represents the transposed matrix of A; with the forward and backward transfer matrices, the diffusion graph convolution model is ; S302, in order to obtain the uncertainty of spatial relations, assume that spatiotemporal traffic data is represented as random embedding , where N is the number of spatial traffic detection nodes, D is the embedding dimension of spatial traffic detection nodes; R represents the real number space, Represents the matrix of the real number field N*D, and the potential attribute random variable is , then the uncertain spatial relationship can be expressed as ,in Obey the prior mixed Gaussian distribution; A is the adjacency matrix; The overall calculation formula of the graph convolution part is ; S303, the construction on the time convolution module, given a one-dimensional sequence input and filter , dilated causal convolution operation and In step The causal convolution operation is expressed as ; in is the expansion factor that controls the jump distance; s is the sliding step size, Indicates the location of a certain historical information; Gated TCN module, given input , where S represents the time dimension of the 3D tensor; the form is: ; in 、 、 and are model parameters, are element-wise products, is the output activation function, is a sigmoid function; at the same time, in order to obtain the uncertainty of the time part, a Bayesian convolutional neural network is used in the time dimension. ;in, Represents the model parameter matrix, using variational distribution parameters.

2. The traffic flow prediction method based on Bayesian method and graph convolution according to claim 1 is characterized in that: In step S1, the spatial information of the transportation network is represented by an adjacency matrix Indicates; Hedi If there is a spatial connection between the nodes, the adjacency matrix element is 1 if the value is set, otherwise it is 0.

3. The traffic flow prediction method based on Bayesian method and graph convolution according to claim 1 is characterized in that: Step S2 specifically includes: S201, sampling at fixed time according to the traffic flow at the intersection; S202. Preprocess the sampled data and normalize the data using the Z-score standardization method. The calculation expression is as follows: ,in, is the mean of the original traffic data, is the standard deviation of the original flow data; S203, dividing the data set obtained after preprocessing, using 70% of the data for training the model, 20% of the data for testing, and the remaining 10% of the data for verification; S204, constructing a road traffic flow matrix, for The traffic network of nodes is sampled every several minutes, with a total of samples, for a node we get , then the corresponding The transportation network of nodes is obtained by matrix: , The matrix row vector represents a node The sampling results are historical traffic flow data; the column vector represents the total nodes.

4. The traffic flow prediction method based on Bayesian method and graph convolution according to claim 1 is characterized in that: Step S4 specifically includes: S401. A sampling process is performed based on the randomly initialized adjacency matrix A and the model parameter matrix W. There is an error between the sampling result and the true value. Through the variational inference method, the loss function of the variational loss is as follows: ; where KL is the divergence, which represents the difference between two distributions and is defined as KL(p||q)=sum(x)(logq(x)log(q(x) / p(x))); is the variational posterior distribution The control parameters, represents all random variables, is the prior distribution, is the divergence distance between the two distributions, and the last term represents the likelihood of the data distribution; S402. Based on the loss function, the model parameters are continuously optimized using the back propagation method. The test set data is used as the model input, and the predicted values ​​are compared with the actual observed values ​​to obtain the prediction accuracy. S403: Acquire real-time traffic flow data as input to the model to achieve real-time road traffic flow prediction.

5. A traffic flow prediction system based on Bayesian method and graph convolution, characterized by: include: Traffic network construction module, which constructs a traffic network based on the spatial relationship between roads, where road intersections or road sections represent nodes and the spatial relationship between nodes represents edges; The dataset construction module samples and preprocesses traffic flow data of the constructed traffic network, obtains traffic flow information at intersections, and constructs a dataset of the road traffic flow matrix; A model building module is used to build a Bayesian and graph convolution model, using the road traffic flow matrix as input to the Bayesian and graph convolution model to extract the temporal uncertainty features and spatial uncertainty relationship features of the traffic flow data; The model optimization and prediction module uses variational inference to define the model loss function and continuously optimizes the model parameters using the back propagation algorithm based on the loss function. Finally, real-time traffic flow data is obtained as input to the model to achieve real-time road traffic flow prediction. The model building module includes: The first unit is used to build the graph convolution layer and define , Indicates output, Represents the road traffic flow matrix as input signal; is the adjacency matrix, represents the normalized adjacency matrix with self-loops; Represents the model parameter matrix; the diffusion process of the graph signal is modeled using diffusion graph convolution, that is, ; in Represents the power series of the transfer matrix, k is the kth layer of graph convolution, in the case of undirected graphs, ; In the case of a directed graph, the diffusion process has two directions, forward and backward, where the forward transfer matrix and backward transfer moment ; Represents the transposed matrix of A; with the forward and backward transfer matrices, the diffusion graph convolution model is ; The second unit is used to obtain the uncertainty of spatial relationships. Assume that the spatiotemporal traffic data is represented as a random embedding , where N is the number of spatial traffic detection nodes, D is the embedding dimension of spatial traffic detection nodes; R represents the real number space, Represents the matrix of the real number field N*D, and the potential attribute random variable is , then the uncertain spatial relationship can be expressed as ,in Obey the prior mixed Gaussian distribution; A is the adjacency matrix; The overall calculation formula of the graph convolution model is: ; The third unit, building on the time convolution module, given a one-dimensional sequence input and filter , dilated causal convolution operation and In step The causal convolution operation is expressed as ; in is the expansion factor that controls the jump distance; s is the sliding step size, Indicates the location of a certain historical information; Gated TCN module, given input , where S represents the time dimension of the 3D tensor; the form is: ; in 、 、 and are model parameters, are element-wise products, is the output activation function, is a sigmoid function; at the same time, in order to obtain the uncertainty of the time part, a Bayesian convolutional neural network is used in the time dimension. ;in, Represents the model parameter matrix, using variational distribution parameters.

6. The traffic flow prediction system based on Bayesian method and graph convolution according to claim 5 is characterized in that: In the traffic network construction module, the spatial information of the traffic network is represented by an adjacency matrix Indicates; Hedi If there is a spatial connection between the nodes, the adjacency matrix element is 1 if the value is set, otherwise it is 0.

7. The traffic flow prediction system based on Bayesian method and graph convolution according to claim 5, characterized in that: The dataset construction module includes: The sampling unit takes samples at fixed times according to the traffic flow at the intersection; The preprocessing unit preprocesses the sampled data and normalizes the data using the Z-score standardization method. The calculation expression is as follows: ,in, is the mean of the original traffic data, is the standard deviation of the original flow data; The dataset partitioning unit divides the dataset obtained after preprocessing, using 70% of the data for model training, 20% for testing, and the remaining 10% for validation; Matrix construction unit, constructs road traffic flow matrix, for The traffic network of nodes is sampled every several minutes, with a total of samples, for a node we get , then the corresponding The transportation network of nodes is obtained by matrix: , The matrix row vector represents a node The sampling results are historical traffic flow data; the column vector represents the total nodes; then Indicates the The node in Traffic flow data within a certain time period.

8. The traffic flow prediction system based on Bayesian method and graph convolution according to claim 6, characterized in that: The model optimization and prediction module includes: The loss function unit is used to perform a sampling process based on the randomly initialized adjacency matrix A and the model parameter matrix W. There is an error between the sampling result and the true value. After the variational inference method, the loss function of the variational loss is as follows: ; where KL is the divergence, which represents the difference between two distributions and is defined as KL(p||q)=sum(x)(logq(x)log(q(x) / p(x))); is the variational posterior distribution The control parameters, represents all random variables, is the prior distribution, is the divergence distance between the two distributions, and the last term represents the likelihood of the data distribution; The optimization unit uses the back-propagation method to continuously optimize the model parameters based on the loss function, takes the test set data as the model input, and compares the predicted value with the actual observation value to obtain the prediction accuracy; The prediction unit obtains real-time traffic flow data as the input of the model to realize the prediction of real-time road traffic flow.

Citation Information

Patent Citations

  • Traffic flow prediction method based on RGCN

    CN111862592A

  • Road condition assessment method of short-term traffic prediction map convolutional network

    CN113313947A