A Traffic Flow Prediction Method Based on Domain Adversarial and Multi-View Spatiotemporal Graph Neural Network
By constructing a multi-view spatiotemporal graph neural network and combining it with domain adversarial training methods, the problem of traffic flow prediction in data-scarce environments was solved, achieving high-precision traffic flow information prediction and enhancing the applicability of the model across different cities.
Patent Information
- Application Number
- CN202510224966.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2025-02-27
- Publication Date
- 2025-11-14
- Estimated Expiration
- 2045-02-27
AI Technical Summary
In environments with scarce data, existing traffic flow prediction methods struggle to achieve high-precision predictions. In particular, due to the lagging development of some cities or privacy issues leading to a scarcity of traffic data, deep learning methods are unable to obtain ideal prediction results.
A traffic flow prediction method based on domain adversarial and multi-view spatiotemporal graph neural networks is adopted. By constructing spatial distance graphs, functional similarity graphs and adaptive graphs, and combining spatiotemporal graph convolutional networks and temporal convolutional networks, the traffic flow characteristics are learned using domain adversarial training methods to mitigate the differences in traffic flow data distribution among different cities.
It improves the accuracy and precision of traffic flow information prediction in data-scarce environments, provides rich spatial topological information through multi-perspective complementarity, and learns transferable spatiotemporal features, reducing the impact of data distribution differences.
Smart Images

Figure CN120145229B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of traffic flow prediction, and in particular to a traffic flow prediction method based on domain adversarial and multi-view spatiotemporal graph neural networks. Background Technology
[0002] Traffic flow prediction is an important topic in modern traffic engineering and planning, aiming to predict traffic flow parameters for future periods using historical traffic data. Traffic flow prediction can be divided into long-term prediction and short-term prediction. Long-term prediction typically has a prediction step of one hour or longer and is often used in traffic planning and impact assessment; while short-term prediction generally has a prediction step of less than 15 minutes and is often used in real-time traffic management and guidance.
[0003] The commonly used methods and techniques for traffic flow prediction are as follows:
[0004] Model-driven approach:
[0005] Dynamic traffic flow simulation models, such as DynaMIT-P, DynaSmart-X, and Visum-online, make predictions by simulating the dynamic behavior of traffic systems.
[0006] Graph Neural Networks (GNNs): These technologies, such as Graph Convolutional Networks (GCNs), are used for accurate prediction of traffic flow and are suitable for processing complex traffic network data.
[0007] Data-driven approach:
[0008] Machine learning and deep learning: Using frameworks such as PyTorch, models are trained on historical traffic data for prediction. For example, models such as LSTM (Long Short-Term Memory) and GRU (Gated Recurrent Unit) perform well in traffic flow prediction.
[0009] Traffic flow prediction plays a crucial role in smart city development. Accurate traffic flow forecasting enables city managers to formulate efficient traffic management strategies, improve traffic efficiency, alleviate congestion, and reduce emissions. Thanks to the widespread deployment of sensors in cities and the prevalence of mobile computing devices, massive amounts of traffic data can be perceived and acquired in real time. Meanwhile, deep learning technology has been widely applied in traffic flow prediction, providing more accurate prediction results. Methods such as Convolutional Neural Networks (CNNs), Graph Neural Networks (GNNs), and Recurrent Neural Networks (RNNs) are commonly used in traffic flow prediction tasks to improve prediction accuracy.
[0010] In practical applications, traffic flow prediction can not only help optimize traffic management and improve travel efficiency, but also support the construction of smart cities. For example, by analyzing factors such as traffic flow density, flow feedback, and spatiotemporal characteristics, future traffic flow can be predicted more accurately, thereby enabling the formulation of more reasonable traffic management strategies. Although these methods have achieved significant results in traffic flow prediction tasks, they typically rely on large amounts of high-quality data for training. However, traffic flow prediction faces many challenges. In reality, due to the lagging development of some cities or the scarcity of traffic data caused by privacy issues, deep learning methods struggle to achieve ideal prediction results in such situations. Summary of the Invention
[0011] To address the aforementioned technical problems, this invention provides a traffic flow prediction method based on domain adversarial and multi-view spatiotemporal graph neural networks. This application combines domain adversarial and multi-view spatiotemporal graph neural networks to predict traffic flow information, greatly improving the accuracy and precision of traffic flow prediction in data-scarce environments.
[0012] This invention provides a traffic flow prediction method based on domain adversarial and multi-view spatiotemporal graph neural networks, employing the following technical solution:
[0013] A traffic flow prediction method based on domain adversarial and multi-view spatiotemporal graph neural networks includes the following steps:
[0014] S1. Construct three different spatiotemporal graphs based on three different perspectives. The three different spatiotemporal graphs include a spatial distance graph, a functional similarity graph, and an adaptive graph.
[0015] S2. Construct a spatiotemporal graph convolutional network, which includes multiple stacked graph convolutional networks and temporal convolutional networks. The graph convolutional network is used to extract the spatial features of nodes, and the temporal convolutional network is used to extract the temporal features of nodes.
[0016] S3. The spatiotemporal graph convolutional network is trained using a domain adversarial training method to obtain a traffic prediction model;
[0017] S4. Input the captured information source into the traffic prediction model to obtain the prediction results.
[0018] Preferably, the spatial distance map A dist Defined as:
[0019]
[0020] Where, d ij σ is the distance between node i and node j. 2 And ∈ are the control spatial distance graph A dist The threshold for scarcity rate.
[0021] Preferably, constructing a functional similarity graph involves given two time series X = (x1, x2, ..., x...). n ,) and Y = (y1, y2, ..., y m The similarity calculation formula for X and Y is:
[0022] S(i,j)=dist(x i y j )+min{S(i-1, j-1), S(i-1, j), S(i, j-1)};
[0023] Where S(i,j) is the cumulative distance, representing the cumulative distance from the starting point of the time series to point (i,j). After reaching the ending point (n,m), this cumulative distance is the similarity between time series X and Y. i y j () is a metric between two points, calculated using absolute distance;
[0024] Functional similarity diagram A calculated using the DTW algorithm func Defined as:
[0025]
[0026] Among them, X i Let ∈ be the time series of node i, and let A be the control function similarity graph. func The threshold for scarcity rate.
[0027] Preferably, constructing the adaptive graph involves randomly initializing two learned node embedding matrices. Where, d e The node embedding dimension is represented; spatial dependencies between nodes are generated through the dot product operation of the embedding matrices, as defined below:
[0028]
[0029] Where E1 and E2 represent node embedding matrices, A adpt The adaptive matrix A is obtained by sparsifying the matrix using the ReLU activation function and normalizing it using softmax. adpt .
[0030] Preferably, the temporal convolutional network employs dilated causal convolution, given an input sequence. The convolution operation F of dilated causal convolution d (t) is represented as:
[0031]
[0032] Where x is the input time series, t is the time step, and Fd w(t) is the output at time step t, r is the dilation factor that controls the spacing between kernel elements, k is the kernel size, and w(k) is the kernel size.
[0033] Gating mechanisms regulate the direction of information flow by introducing control signals. Introducing gating mechanisms into temporal convolutional networks allows for more precise control over the transmission and filtering of information.
[0034] Gated TCN is used to process the original spatiotemporal graph signal to capture the temporal characteristics of the nodes; given the spatiotemporal graph signal... Gated temporal convolution F t (χ) and the acquired time features H t Represented as:
[0035] H t =F t (χ)=tanh(w f *χ+b f )⊙σ(w g *χ+b g );
[0036] in, For the extracted temporal features, N is the number of nodes, and P is the number of nodes. f It is the prediction time step length, d t It is the dimension of time features, where χ is the spatiotemporal graph signal, and F t For temporal convolution operations, w f b f w g b g These are the learning parameters of Temporal Convolutional Network (TCN), where * represents the convolution operation, ⊙ represents the dot product operation, and tanh and σ are the activation functions.
[0037] Preferably, the graph convolutional network includes a given acquired temporal feature H t GCN operation F s (H t ) and the acquired spatiotemporal features H st Represented as:
[0038]
[0039] in, The extracted spatiotemporal features are N, where N is the number of nodes and P is the number of nodes. f It is the prediction time step length, d s F represents the dimension of spatiotemporal features. s For graph convolution operations, H t It is a temporal feature, and σ is the activation function. It is an adjacency matrix. Including spatial distance matrix A distFunctional similarity matrix A func and adaptive matrix A adpt W is the weight matrix for learning.
[0040] Preferably, S2 further includes a spatiotemporal feature stitching operation on the three perspectives, the stitching operation being expressed as:
[0041] H = H Dist ||H Func ||H adpt ;
[0042] Where H represents the fused spatiotemporal features, used for subsequent spatiotemporal modeling and prediction tasks. Dist H Func H Adpt represents the spatiotemporal features extracted from the perspectives of spatial distance, functional similarity, and data-driven approaches, respectively, and || represents the splicing operation.
[0043] Preferably, domain adversarial learning methods include feature extractors, domain classifiers, and predictors;
[0044] Feature Extractor F f Based on the spatiotemporal graph convolutional network proposed above, a method is constructed to map the input data χ to a unified feature space, defined as follows:
[0045] H st =F f (χ;θ f );
[0046] Among them, H st It is the spatiotemporal feature extracted by the feature extractor, F f This is a spatiotemporal feature extraction operation, where χ is the input data and θ is the input data. f These are the parameters for the feature extractor.
[0047] The fused spatiotemporal features H st Input to domain classifier F d and predictor F y In the middle, domain classification and prediction tasks are performed respectively, and the domain classifier F d and predictor F y All are composed of fully connected layers, defined as follows:
[0048]
[0049] Among them, H st These are the extracted spatiotemporal features. It is the output of the domain classifier, F d It is a domain classifier, softmax is the activation function, and w d and b d These are the learning parameters of the domain classifier. It is the output of the predictor, d out It is the output dimension, F y It's a predictor, ReLU is the activation function, w y and b y These are the learning parameters of the predictor;
[0050] Domain classifier F d and predictor F y We use cross-entropy and mean squared error (MSE) as loss functions, respectively, as defined below:
[0051]
[0052] in, It is the cross-entropy loss function of the domain classifier. and It is a predicted label, d S and d T It's a real label. N is the mean squared error loss function of the predictor. S and N T These represent the number of nodes in the source city and the target city, respectively. and It is the prediction result of the predictor, y S and y T It is the actual value;
[0053] In feature extractor F f Sum Domain Classifier F d A gradient inversion layer (GRL) is added between the feature extractor and the domain classifier to create an adversarial relationship. The gradient inversion layer multiplies the incoming error signal by a negative number, thereby making the optimization objectives of the feature extractor and the domain classifier opposite during model training, thus achieving an adversarial effect. The optimization process is defined as follows:
[0054]
[0055] Where, θ f It is the feature extractor F f The parameter, θ d and θ y These are the domain classifiers F d and predictor F y The parameters, By minimizing the loss function The obtained parameter θ f θ y θ d The optimal solution;
[0056] Given domain adversarial loss and predictor loss The final loss function of model MDAGCN Defined as:
[0057]
[0058] in, It is the final loss function. and These are the domain adversarial loss and the predictor loss, respectively. α is the weight parameter of the domain adversarial loss, and β is the weight parameter of the predictor loss.
[0059] In summary, the present invention has the following beneficial technical effects:
[0060] 1. This application combines domain adversarial and multi-view spatiotemporal graph neural networks to predict traffic flow information, which greatly improves the accuracy and precision of traffic flow prediction in data-scarce environments.
[0061] 2. This application performs spatial modeling of the traffic network from multiple perspectives, and provides rich spatial topological information for prediction tasks through the complementarity of different graph structures.
[0062] 3. This application employs a domain adversarial strategy for training, which mitigates the differences in traffic flow data distribution across different cities, thereby learning transferable spatiotemporal features. Attached Figure Description
[0063] Figure 1 This is a model framework diagram of MSTGCN in an embodiment of the present invention.
[0064] Figure 2 This is a spatial distance diagram in an embodiment of the present invention.
[0065] Figure 3 This is a functional similarity diagram in an embodiment of the present invention.
[0066] Figure 4 This is the adaptive graph in the embodiments of the present invention. Detailed Implementation
[0067] The present invention will be further described in detail below with reference to the accompanying drawings.
[0068] This invention discloses a traffic flow prediction method based on domain adversarial and multi-view spatiotemporal graph neural networks.
[0069] This prediction method proposes the overall architecture of the MSTGCN model, such as... Figure 1 As shown.
[0070] The traffic flow prediction method based on domain adversarial and multi-view spatiotemporal graph neural networks includes the following steps:
[0071] S1. Construct three different spatiotemporal diagrams based on three different perspectives to reflect the multidimensional spatial relationships of the transportation network.
[0072] Among them, the three different spatiotemporal graphs include a spatial distance graph, a functional similarity graph, and an adaptive graph.
[0073] Spatial distance maps are used to characterize the spatial proximity between traffic nodes, reflecting direct geographical adjacency. However, even if they are not spatially adjacent, some traffic nodes may still have similar traffic patterns. Therefore, functional similarity maps reveal the distribution characteristics of nodes with similar traffic patterns by exploring the functional consistency between nodes.
[0074] Furthermore, adaptive graphs constructed based on spatiotemporal graph signals can capture the hidden potential spatial dependencies between traffic nodes. In situations where data is scarce, spatiotemporal graphs from different perspectives can complement each other, thereby more comprehensively representing the diverse spatial relationships of urban transportation.
[0075] S1 includes the following steps:
[0076] S11, Spatial Distance Map;
[0077] The physical distance between transportation nodes can intuitively reflect the geographical location relationship between them, providing crucial geographic information support for subsequent spatial feature modeling. By constructing a spatial distance map, the spatial proximity of the transportation network can be represented by quantifying the physical distance between two transportation nodes. Figure 2 As shown in the spatial distance diagram A. dist Defined as:
[0078]
[0079] Where, d ij σ is the distance between node i and node j. 2 And ∈ are the control spatial distance graph A dist The threshold for scarcity rate.
[0080] S12, Functional Similarity Diagram;
[0081] Functional similarity maps are typically constructed based on the similarity of node data or spatial attributes to capture the similarity of traffic patterns between nodes. Using points of interest (POIs) around a region to characterize its function, the Pearson correlation coefficient is used to calculate the trend and seasonality matrix of traffic flow. However, these methods are inadequate when dealing with time series with local variations and temporal distortions. To address this issue, this paper employs the Dynamic Time Warping (DTW) algorithm to evaluate the similarity of node time series and constructs a functional similarity map based on this, such as... Figure 3 As shown.
[0082] Specifically, given two time series X = (x1, x2, ..., x... n ,) and Y = (y1, y2, ..., y m The similarity calculation formula for X and Y is:
[0083] S(i,j)=dist(x i y j )+min{S(i-1, j-1), S(i-1, j), S(i, j-1)};
[0084] Where S(i, j) is the cumulative distance, representing the cumulative distance from the starting point of the time series to point (i, j). After reaching the endpoint (n, m), this cumulative distance is the similarity between time series X and Y. dist(x i ,y j () is a metric between two points, and this paper uses absolute distance for calculation.
[0085] Functional similarity diagram A calculated using the DTW algorithm func It can be defined as:
[0086]
[0087] Among them, X i Let ∈ be the time series of node i, and let A be the control function similarity graph. func The threshold for scarcity rate.
[0088] S13, Adaptive graph;
[0089] In transportation networks, complex and ever-changing situations such as emergencies and weather changes frequently occur, which can significantly alter the network structure. However, static graphs built based on fixed connections struggle to adapt to rapid changes in dynamic environments. To address this issue, a data-driven adaptive graph is constructed. This method can learn the hidden dependencies between nodes without relying on prior knowledge, such as... Figure 4 As shown. This enables the model to dynamically capture the constantly changing traffic patterns and connections within the transportation network.
[0090] Specifically, firstly, two learnable node embedding matrices are randomly initialized. Where d e This represents the node embedding dimension. Subsequently, spatial dependencies between nodes are generated through the dot product operation of the embedding matrices, defined as follows:
[0091]
[0092] Where E1 and E2 represent node embedding matrices, A adptLet A represent the adaptive matrix. The matrix is sparsified using the ReLU activation function, and then normalized using softmax to obtain the final adaptive matrix A. adpt .
[0093] S2. Construct a spatiotemporal graph convolutional network;
[0094] Among them, the spatiotemporal graph convolutional network includes multiple stacked graph convolutional networks and temporal convolutional networks. The graph convolutional network is used to extract the spatial features of nodes, and the temporal convolutional network is used to extract the temporal features of nodes.
[0095] Spatiotemporal Graph Convolutional Networks (STGCNs) consist of multiple stacked GCN and TCN modules, used to extract spatial and temporal features from spatiotemporal graph signals, such as... Figure 2 As shown.
[0096] Specifically, STGCN first captures the temporal features in the node time series through a temporal convolutional network (TCN), and then aggregates the information of each node and its neighboring nodes through a graph convolutional network (GCN) to extract spatial features and achieve comprehensive modeling of the spatiotemporal relationship of nodes.
[0097] S21, Temporal Convolutional Neural Network;
[0098] To capture the temporal patterns of traffic flow, dilated causal convolution is introduced as the core operation of the Temporal Convolutional Network (TCN) to perform convolution operations over time. Compared to traditional RNNs, dilated causal convolution offers parallel computation capabilities, significantly improving processing speed. Furthermore, by introducing a dilation factor between the convolutional kernels, the receptive field is expanded, enabling it to capture dependencies over a longer time span.
[0099] Furthermore, because dilated causal convolution ensures that the current output depends only on past input data, strictly adhering to temporal causality, it avoids the problem of leaking future information. Given an input sequence... The convolution operation F of dilated causal convolution d (t) can be represented as:
[0100]
[0101] Where x is the input time series, t is the time step, and F d w(t) is the output at time step t, r is the dilation factor that controls the spacing between kernel elements, k is the kernel size, and w(k) is the kernel.
[0102] Gating mechanisms, which regulate the direction of information flow by introducing specific control signals, are widely used in RNNs. Inspired by this, gating mechanisms are introduced into Temporal Convolutional Networks (TCNs) to more finely control the transmission and filtering of information. Using gated TCNs to process raw spatiotemporal graph signals can effectively capture the temporal characteristics of nodes. Given a spatiotemporal graph signal... Gated temporal convolution F t (χ) and the acquired time features H t It can be represented as:
[0103] H t =F t (χ)=tanh(w f *χ+b f )⊙σ(w g *χ+b g );
[0104] in, For the extracted temporal features, N is the number of nodes, and P is the number of nodes. f It is the prediction time step length, d t It is the dimension of time characteristics. χ represents the spatiotemporal graph signal, and F... t For temporal convolution operations, w f b f w g b g These are the learnable parameters of Temporal Convolutional Network (TCN), where * represents the convolution operation, ⊙ represents the dot product operation, and tanh and σ are the activation functions.
[0105] S22, Graph Convolutional Neural Network;
[0106] Graph Convolutional Networks (GCNs) based on spatial domain theory are used to extract spatial features of nodes.
[0107] Specifically, based on capturing the temporal features of nodes through temporal convolution operations, graph convolution operations are used to further extract the spatial features of nodes, thereby comprehensively modeling the spatiotemporal relationships between nodes. Given the acquired temporal features H... t GCN operation F s (H t ) and the acquired spatiotemporal features H st It can be represented as:
[0108]
[0109] in, The extracted spatiotemporal features are N, where N is the number of nodes and P is the number of nodes. f It is the prediction time step length, d s F represents the dimension of spatiotemporal features. s For graph convolution operations, H tIt is a temporal feature, and σ is the activation function. It is an adjacency matrix. Including spatial distance matrix A dist Functional similarity matrix A func and adaptive matrix A adpt W is the weight matrix for learning.
[0110] S23, Spatiotemporal feature fusion;
[0111] In spatiotemporal graph convolutional neural networks, to more comprehensively capture the spatiotemporal features of traffic networks, spatiotemporal information at different levels and angles is extracted from multiple perspectives, including spatial distance graphs, functional similarity graphs, and adaptive graphs. The features extracted from each perspective focus on different spatial and temporal dependencies, and these features complement and reinforce each other's representations. To achieve comprehensive modeling of traffic flow, a feature fusion strategy is employed to integrate spatiotemporal features from different perspectives, thereby improving the overall expressive power of the model.
[0112] Specifically, a concatenation operation combines the spatiotemporal features from three perspectives. This concatenation operation effectively preserves the independence of each feature while integrating them into a unified feature space for subsequent spatiotemporal modeling and prediction tasks. The concatenation operation can be formalized as follows:
[0113] H = H Dist ||H Func ||H adpt ;
[0114] Here, H represents the fused spatiotemporal features, which are used for subsequent spatiotemporal modeling and prediction tasks. Dist H Func H adpt represents the spatiotemporal features extracted from the perspectives of spatial distance, functional similarity, and data-driven approaches, respectively, and || represents the splicing operation.
[0115] S3. The spatiotemporal graph convolutional network is trained using a domain adversarial training method to obtain a traffic prediction model;
[0116] The above research enables the extraction of spatiotemporal features from traffic flow data in both the source and target domains. However, due to significant differences in data distribution between the source and target domains, directly transferring models trained on source domain data to the target domain often yields poor results. To address this issue and mitigate the impact of data distribution differences between the source and target domains, a domain adversarial transfer learning method is introduced. This method comprises three parts: a feature extractor, a domain classifier, and a predictor.
[0117] Specifically, the feature extractor extracts spatiotemporal features from the input data and strives to generate domain-indistinguishable representations. The domain discriminator then attempts to determine whether a sample comes from the source or target domain based on these features. During training, the feature extractor learns domain-independent features by maximizing the error rate of the domain discriminator, while the domain discriminator improves its discriminative ability by minimizing the classification error.
[0118] Through this game-theoretic process, the feature extractor ultimately learns a shared representation that is effective for both the source and target domains. Feature Extractor F f Based on the spatiotemporal graph convolutional network proposed above, a method is constructed to map the input data χ to a unified feature space, defined as follows:
[0119] H st =F f (χ;θ f );
[0120] Among them, H st It is the spatiotemporal feature extracted by the feature extractor, F f This is a spatiotemporal feature extraction operation, where χ is the input data and θ is the input data. f These are the parameters for the feature extractor.
[0121] Next, the fused spatiotemporal features H st Input to domain classifier F d and predictor F y In this process, domain classification and prediction tasks are performed separately. Domain classifier F d and predictor F y All are composed of fully connected layers, as defined below:
[0122]
[0123] Among them, H st These are the extracted spatiotemporal features. It is the output of the domain classifier, F d It is a domain classifier, softmax is the activation function, and w d and b d These are the learnable parameters of the domain classifier. It is the output of the predictor, d out It is the output dimension, F y It's a predictor, ReLU is the activation function, w y and b y These are the learnable parameters of the predictor.
[0124] To optimize the model, the domain classifier F... d and predictor F y We use cross-entropy and mean squared error (MSE) as loss functions, respectively, as defined below:
[0125]
[0126] in, It is the cross-entropy loss function of the domain classifier. and It is a predicted label, d S and d T It's a real label. N is the mean squared error loss function of the predictor. S and N T These represent the number of nodes in the source city and the target city, respectively. and It is the prediction result of the predictor, y S and y T It is the actual value.
[0127] Finally, as Figure 1 As shown, in feature extractor F f Sum Domain Classifier F d Gradient inversion layer (GRL) is added between them to build an adversarial relationship.
[0128] Specifically, the gradient inversion layer multiplies the incoming error signal by a negative number, thus making the optimization objectives of the feature extractor and the domain classifier opposite during model training, thereby achieving an adversarial effect. The optimization process is defined as follows:
[0129]
[0130] Where, θ f It is the feature extractor F f The parameter, θ d and θ y These are the domain classifiers F d and predictor F y The parameters. By minimizing the loss function The obtained parameter θ f θ y θ d The optimal solution.
[0131] Given domain adversarial loss and predictor loss The final loss function of the proposed model MDAGCN in this paper Defined as:
[0132]
[0133] in, It is the final loss function. and These are the domain adversarial loss and the predictor loss, respectively. α is the weight parameter of the domain adversarial loss, and β is the weight parameter of the predictor loss. By optimizing the loss function, the feature extractor can achieve the goal of extracting domain-invariant features.
[0134] Through the above settings, a traffic prediction model is finally obtained.
[0135] S4. Input the captured traffic flow information sources into the traffic prediction model to obtain the prediction results.
[0136] Specifically, traffic flow information is captured using capture devices, and the captured traffic flow information is input into a traffic prediction model, which then outputs the prediction results of the traffic flow prediction information.
[0137] The above are all preferred embodiments of the present invention and are not intended to limit the scope of protection of the present invention. Therefore, all equivalent changes made in accordance with the structure, shape and principle of the present invention should be covered within the scope of protection of the present invention.
Claims
1. A traffic flow prediction method based on domain adversarial and multi-view spatiotemporal graph neural networks, characterized in that, Includes the following steps: S1. Construct three different spatiotemporal graphs based on three different perspectives. The three different spatiotemporal graphs include a spatial distance graph, a functional similarity graph, and an adaptive graph. The spatial distance map Defined as: ; in, It is the distance between node i and node j. and It is a control space distance map The threshold for scarcity rate; Constructing a functional similarity graph involves given two time series. and The formula for calculating the similarity between X and Y is: ; in, It is the cumulative distance, representing the distance from the start point of the time series to the end point. The cumulative distance to reach the destination. Then, this accumulated distance is the similarity between time series X and Y. It is a metric between two points, calculated using absolute distance; Functional similarity graph calculated using the DTW algorithm Defined as: ; in, Represents the time series of node i. It is a control function similarity diagram The threshold for scarcity rate; Constructing the adaptive graph involves randomly initializing two learned node embedding matrices. ,in The node embedding dimension is represented; spatial dependencies between nodes are generated through the dot product operation of the embedding matrices, as defined below: ; in, and Represents the node embedding matrix. The adaptive matrix is represented by the ReLU activation function, which is used to sparsify the matrix, and then the matrix is normalized using softmax to obtain the final adaptive matrix. ; S2. Construct a spatiotemporal graph convolutional network, which includes multiple stacked graph convolutional networks and temporal convolutional networks. The graph convolutional network is used to extract the spatial features of nodes, and the temporal convolutional network is used to extract the temporal features of nodes. Temporal convolutional networks employ dilated causal convolution, given an input sequence. The convolution operation of dilated causal convolution Represented as: ; in, The input is a time series. It is a time step. For time steps The output at that location, It is the dilation factor, which controls the spacing between elements in the convolution kernel, and k is the size of the convolution kernel. It is a convolution kernel; Gating mechanisms regulate the direction of information flow by introducing control signals. Introducing gating mechanisms into temporal convolutional networks allows for more precise control over the transmission and filtering of information. Gated TCN is used to process the original spatiotemporal graph signal to capture the temporal characteristics of the nodes; given the spatiotemporal graph signal... Gated temporal convolution and the acquired time features Represented as: ; in, The extracted time features, It is the number of nodes. It is the predicted time step length. It is a dimension of time characteristics. For spatiotemporal diagram signals, For temporal convolution operations, , , , These are the learning parameters of Temporal Convolutional Network (TCN), where * indicates the convolution operation. Represents the dot product operation, tanh and For activation functions; Graph convolutional networks include given acquired temporal features. GCN operation and the acquired spatiotemporal features Represented as: ; in, These are the extracted spatiotemporal features. It is the number of nodes. It is the predicted time step length. As a dimension of spatiotemporal features, For graph convolution operations, It is a time characteristic. It is an activation function. It is an adjacency matrix. Including spatial distance matrix Functional similarity matrix and adaptive matrix , The weight matrix is for learning. S2 also includes a spatiotemporal feature stitching operation on the three perspectives, which is represented as follows: ; in, This represents the fused spatiotemporal features, which are used for subsequent spatiotemporal modeling and prediction tasks. These represent the spatiotemporal features extracted from the perspectives of spatial distance, functional similarity, and data-driven approaches, respectively. Indicates a splicing operation; S3. The spatiotemporal graph convolutional network is trained using a domain adversarial training method to obtain a traffic prediction model; S4. Input the captured information source into the traffic prediction model to obtain the prediction results.
2. The traffic flow prediction method based on domain adversarial and multi-view spatiotemporal graph neural networks according to claim 1, characterized in that, Domain adversarial learning methods include feature extractors, domain classifiers, and predictors; Feature extractor Based on the spatiotemporal graph convolutional network proposed above, a method is constructed to process the input data. Mapped to a unified feature space, defined as follows: ; in, These are the spatiotemporal features extracted by the feature extractor. For spatiotemporal feature extraction operations, For input data, These are the parameters for the feature extractor. The fused spatiotemporal features Input to domain classifier and predictor In the middle, domain classification and prediction tasks are performed respectively, and the domain classifier is used. and predictor All are composed of fully connected layers, defined as follows: ; ; in, These are the extracted spatiotemporal features. It is the output of the domain classifier. It is a domain classifier. It is an activation function. and These are the learning parameters of the domain classifier. It is the output of the predictor. It is the output dimension. It is a predictor. It is an activation function. and These are the learning parameters of the predictor; Domain classifier and predictor We use cross-entropy and mean squared error (MSE) as loss functions, respectively, as defined below: ; ; in, It is the cross-entropy loss function of the domain classifier. and It is a predicted label. and It's a real label. It is the mean squared error loss function of the predictor. and These represent the number of nodes in the source city and the target city, respectively. and It is the prediction result of the predictor. and It is the actual value; In feature extractor Sum Domain Classifier A gradient inversion layer (GRL) is added between the feature extractor and the domain classifier to create an adversarial relationship. The gradient inversion layer multiplies the incoming error signal by a negative number, thereby making the optimization objectives of the feature extractor and the domain classifier opposite during model training, thus achieving an adversarial effect. The optimization process is defined as follows: ; ; in, It is a feature extractor The parameters, and These are domain classifiers and predictor The parameters, By minimizing the loss function The obtained parameters The optimal solution; Given domain adversarial loss and predictor loss The final loss function of the MDAGCN model Defined as: ; in, It is the final loss function. and These are domain adversarial loss and predictor loss, These are the weight parameters of the domain adversarial loss. These are the weight parameters of the predictor loss.
Citation Information
Patent Citations
Confrontation training method and device for space-time traffic prediction model, equipment and medium
CN116957058A
Method for predicting traffic flow by using dynamic multi-graph fusion
CN116975642A