A traffic prediction method based on continuous evolution graph neural controlled differential equation

CN117556949BActive Publication Date: 2026-09-04ZHEJIANG UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202311505245.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-11-13
Publication Date
2026-09-04
Estimated Expiration
2043-11-13

AI Technical Summary

Technical Problem

但是,这些方法在捕获空间依赖时使用静态图,依旧无法捕获连续演化的空间依赖

Benefits of technology

[0072] Compared with the prior art, the beneficial effects of the present invention include at least the following:

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117556949B_ABST
    Figure CN117556949B_ABST
Patent Text Reader

Abstract

The application discloses a traffic prediction method based on a continuous evolution graph neural controlled differential equation, and comprises the following steps: preprocessing a given traffic data sequence to construct a training sample; constructing a traffic prediction model to generate randomly initialized node embedding and a time-continuous control path, generating a space-dependent evolution component based on the control path, generating a space-dependent static component based on the node embedding, fusing the two components to obtain a continuous evolution graph, constructing a graph neural controlled differential equation based on the continuous evolution graph and solving the graph neural controlled differential equation to obtain a traffic data prediction value; training the traffic prediction model by using the training sample; and performing traffic prediction by using the trained traffic prediction model. The method can simultaneously capture the continuous time dependence and the space dependence continuously evolving over time of the traffic data, effectively improves the traffic prediction precision, and has a wide application prospect in the fields of logistics transportation, smart city and intelligent transportation system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention belongs to the field of traffic prediction technology, specifically relating to a traffic prediction method based on continuously evolving graph neural controlled differential equations. Background Technology

[0002] Traffic forecasting is a key technology for smart city construction and an important component of intelligent transportation systems, significantly impacting people's daily lives. For decades, traffic forecasting has been a research hotspot in academia and industry. Accurate traffic forecasts can help citizens avoid road congestion and peak hours, saving time and money; simultaneously, they can provide reliable guidance for traffic management and public safety early warning, improving road efficiency.

[0003] Traffic forecasting is a task that involves predicting future traffic conditions, including traffic flow and speed data, based on historical traffic conditions and networks. Traffic forecasting is extremely challenging due to the complex and dynamic spatiotemporal dependencies of traffic data. In recent years, deep learning has seen significant advancements, providing efficient methods for solving traffic forecasting problems. Early methods used recurrent neural networks (RNNs) and temporal convolutional networks (TCNs) to capture the temporal dependencies of traffic data. Additionally, these methods utilized convolutional neural networks (CNNs) to capture the spatial dependencies. However, these methods neglected non-Euclidean spatial dependencies based on graph structures. Naturally, graph neural networks (GNNs) have been extensively explored in traffic forecasting because of their suitability for modeling graph-based data. In these GNN-based models, each node represents a traffic monitoring station, and each edge represents the spatial dependency between stations. Recently, spatio-temporal graph neural networks (STGNNs) have combined graph neural networks used to capture spatial dependencies with networks used to capture temporal dependencies, achieving state-of-the-art performance in traffic forecasting.

[0004] Despite the significant success of STGNNs, two limitations remain. First, the data they use is essentially a discrete observation sequence of continuous processes in the real world. This means that when using RNNs or TCNs to capture temporal dependencies, they cannot reflect the impact of all historical traffic conditions on future traffic conditions over a continuous time process. Second, in the real world, spatial dependencies evolve continuously over time, but STGNNs cannot capture this continuously evolving spatial dependency. Neural controlled differential equations (NCDEs) offer a solution to the first limitation of STGNNs. Recent methods apply NCDEs to the STGNN network for capturing temporal dependencies, and the captured temporal dependencies can reflect the impact of all historical traffic conditions on future traffic conditions over a continuous time process. However, these methods use static graphs to capture spatial dependencies, still failing to capture continuously evolving spatial dependencies. Summary of the Invention

[0005] In view of the above, the purpose of this invention is to provide a traffic prediction method based on a continuously evolving graph neural controlled differential equation. By constructing a traffic prediction model, the traffic data sequence is converted into a control path that is continuous in time. Spatial dependency evolutionary components are constructed using neural controlled differential equations, and spatial dependency static components are constructed through node embedding representation. The spatial dependency evolutionary components and spatial dependency static components are fused and optimized using a masking mechanism to obtain a continuously evolving graph. Finally, the graph neural controlled differential equation is constructed and solved to obtain the traffic data prediction value. This method can simultaneously capture the continuous temporal dependency and the spatial dependency that evolves continuously over time, effectively improving the accuracy of traffic prediction.

[0006] To achieve the above-mentioned objectives, the present invention provides the following technical solution:

[0007] This invention provides a traffic prediction method based on continuously evolving graph neural controlled differential equations, comprising the following steps:

[0008] Preprocess the given traffic data sequence to construct training samples;

[0009] A traffic prediction model is constructed, comprising an input module, a neural controlled differential equation module, a graph generation and fusion module, a graph neural controlled differential equation module, and an output module. Traffic monitoring stations are considered as nodes. The input module generates randomly initialized node embeddings and generates temporally continuous control paths based on each training sample. The neural controlled differential equation module generates continuous hidden states of nodes based on the control paths using neural controlled differential equations. The graph generation and fusion module generates spatially dependent evolutionary components based on the continuous hidden states of nodes and spatially dependent static components based on randomly initialized node embeddings, fusing the spatially dependent evolutionary components and spatially dependent static components to obtain a continuous evolution graph. The graph neural controlled differential equation module solves the graph neural controlled differential equations based on the continuous evolution graph to obtain a traffic data prediction representation after capturing spatiotemporal dependencies. The output module converts the traffic data prediction representation after capturing spatiotemporal dependencies into traffic data prediction values.

[0010] The traffic prediction model is trained using training samples;

[0011] Traffic prediction is performed using a trained traffic prediction model.

[0012] Preferably, the preprocessing of the given traffic data sequence to construct training samples includes:

[0013] Traffic data sequences are constructed based on traffic data collected by traffic sensors. After preprocessing the traffic data sequences, a sliding window is used to divide them into training datasets. The training datasets are then divided into batches of a fixed batch size M, with a total batch size of B. A batch of training samples with index b is selected from the training dataset, where b∈{1,2,...,B}.

[0014] Preferably, the input module is used to generate randomly initialized node embeddings and generate temporally continuous control paths based on each training sample, including:

[0015] Using cubic spline interpolation, each training sample is transformed into a time-continuous control path X(t), as follows:

[0016] X(t)=X t , t∈[t1, t2, ..., t T ]

[0017] In the formula, X t Let be the observation at time step t, where T is the total number of time steps;

[0018] Randomly initialize the learnable embedding representation E of all nodes, representing the static features of the nodes.

[0019] Preferably, the neural controlled differential equation module is used to generate continuous hidden states of nodes based on control paths using neural controlled differential equations, including:

[0020] Given the control path X of node i i (t), using neural controlled differential equations to generate the continuous hidden state H of node i. i (t), represented as follows:

[0021]

[0022] In the formula, H i (t1) represents the initial hidden state of node i at time t1, f μ (H i (t) is the vector field function fitted by a neural network;

[0023] The hidden states of all nodes are stacked into a matrix representation, and the calculation process of the continuous hidden states H(t) of all nodes is as follows:

[0024]

[0025] In the formula, the initial hidden state H(t1) is obtained by linear transformation of the control path starting point value X(t1), and the calculation process is expressed as follows:

[0026] H(t1)=ReLU(X(t1)W H )

[0027] In the formula, W H Here is the learnable parameter matrix, and ReLU is the activation function;

[0028] Fitting vector field function f μ The neural network (H(t)) consists of L fully connected layers and 1 dimension transformation layer, as shown below:

[0029]

[0030] In the formula, W1, ..., W L Let B1, ..., B be the learnable parameter matrix for each fully connected layer. L Let f be the output of each fully connected layer, and ψ be the dimension transformation layer to facilitate f μ (H(t)) and Perform dot product calculation.

[0031] Preferably, the graph generation and fusion module is used to generate spatially dependent evolutionary components based on the continuous hidden states of nodes and spatially dependent static components based on randomly initialized node embeddings, and to fuse the spatially dependent evolutionary components and the spatially dependent static components to obtain a continuous evolutionary graph, including:

[0032] The query Q(t) and key K(t) in the self-attention mechanism are generated by linear transformation based on the continuous hidden states H(t) of the nodes. Both the query and the key are continuous over time, as shown below:

[0033] Q(t)=H(t)W Q

[0034] K(t)=H(t)W K

[0035] In the formula, W Q and W K The learnable parameter matrix;

[0036] Using a self-attention mechanism to obtain the spatial dependency evolution component A between nodes E (t), represented as follows:

[0037]

[0038] In the formula, D represents the dimensions of Q(t) and K(t), T is the transpose, and A... E (t) is a function of time, indicating that the spatially dependent evolutionary components are continuous with time;

[0039] Using a node embedding mechanism, static components A representing spatial dependencies between nodes are generated based on randomly initialized node embeddings E. S , means as follows:

[0040] A S =Softmax(ReLU(EE) T ))

[0041] In the formula, Softmax is the adaptive adjacency matrix learned using the Softmax function for normalization, and ReLU is the activation function;

[0042] Spatial dependency evolution component A E (t) and spatially dependent static component A S The fusion is represented by a continuous evolution graph A(t) that represents the optimal spatial dependence, as follows:

[0043] A(t)=(1-β)A E (t)+βA S

[0044] In the formula, β is a hyperparameter that controls the ratio of the two components.

[0045] Preferably, in the graph generation and fusion module, the continuously evolving graph is optimized through a masking mechanism, including:

[0046] Based on the semantic masking mechanism based on functional similarity, time series similarity is used to represent the functional similarity between two nodes. The DTW algorithm is used to calculate the similarity between nodes, and the node with the highest similarity to each node is taken as its semantic neighbor.

[0047] Based on the distance-based geographic masking mechanism, Euclidean distance is used to represent the geographic similarity between two nodes. The shorter the distance, the greater the geographic similarity. For each node, the node with the closest distance is taken as its geographic neighbor.

[0048] The mask matrix M is obtained based on semantic masking and geographic masking mechanisms. This matrix is ​​then used to optimize the continuous evolution graph, as shown below:

[0049]

[0050] In the formula, Softmax is the adaptive adjacency matrix learned using the Softmax function for normalization, ReLU is the activation function, and A(t) is the continuous evolution graph before optimization. This is the optimized continuous evolution diagram. This refers to the matrix cross product operation.

[0051] Preferably, the graph neural controlled differential equation module is used to obtain a traffic data prediction representation after capturing spatiotemporal dependencies by solving graph neural controlled differential equations based on a continuous evolution graph, including:

[0052] Based on the optimized continuous evolution diagram Construct a vector field function, represented as follows:

[0053]

[0054]

[0055]

[0056]

[0057] In the formula, W z b z W r b r , and Let be the learnable parameter matrix, tanh be the hyperbolic tangent function, ⊙ be the matrix dot product operation, and h(t) be the output of the vector field function;

[0058] Two parallel vector field functions are constructed based on semantic masking and geographic masking mechanisms, namely the semantic vector field function and the geographic vector field function. The outputs of these two vector field functions are represented as h. sem (t) and hgeo (t), the total vector field function f is constructed by connecting two vector field functions. ε (H(t)) is represented as follows:

[0059] f ε (H(t))=Cat(h sem (t), h geo (t))

[0060] In the formula, h sem (t) is the output of the semantic vector field function, h geo (t) is the output of the geographic vector field function, Cat is the join operation, and H(t) is the continuous hidden state of all nodes;

[0061] The graph neural controlled differential equation is constructed based on the total vector field function, as follows:

[0062]

[0063] In the formula, Z(t) is the solution of the graph neural controlled differential equation, that is, the traffic data prediction representation after capturing the spatiotemporal dependence, Z(t1) is the initial traffic data prediction representation at time t1, and X(t) is the temporally continuous control path X(t).

[0064] Preferably, the output module is used to convert the traffic data prediction representation after capturing spatiotemporal dependencies into traffic data prediction values, including:

[0065] The traffic data prediction representation Z(t) output by the graph neural controlled differential equation module, after capturing the spatiotemporal dependence, is transformed into traffic data prediction values. It is expressed as follows:

[0066]

[0067] In the formula, t∈[t T+1 , t T+2 , ..., t T+T′ ], where T is the total time step of historical traffic data, and T′ is the total time step of future traffic data prediction.

[0068] Preferably, training the traffic prediction model using training samples includes:

[0069] The prediction loss is calculated based on the error between the actual values ​​corresponding to the training samples and the predicted values ​​output by the traffic prediction model. Based on the loss of all samples in each batch The network parameters in the traffic prediction model are adjusted until all training samples have participated in the model training and a specified number of iterations have been reached, resulting in the trained traffic prediction model.

[0070] Preferably, the step of using a trained traffic prediction model to perform traffic prediction includes:

[0071] The traffic data sequence to be predicted is input into the trained traffic prediction model. Based on historical data from N traffic monitoring stations over the past T time steps, the model predicts the future traffic data over the next T time steps. ′ Traffic data at each time step enables traffic prediction.

[0072] Compared with the prior art, the beneficial effects of the present invention include at least the following:

[0073] (1) The method of the present invention uses self-attention mechanism and node embedding mechanism to explicitly model spatial dependency evolution component and spatial dependency static component, and integrates the two components into optimal spatial dependency, which can capture complex and constantly evolving spatial dependency in traffic data.

[0074] (2) The method of the present invention optimizes the continuous evolution graph through semantic masking mechanism and geographic masking mechanism in the graph generation and fusion module, which can further increase the expressive power of the traffic prediction model.

[0075] (3) The method of the present invention uses the graph neural controlled differential equation module based on continuous evolution graph to obtain traffic data prediction representation, which can not only capture continuous temporal dependence, but also capture continuous evolution spatial dependence, effectively improving prediction accuracy. Attached Figure Description

[0076] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0077] Figure 1 This is a flowchart of the traffic prediction method based on continuously evolving graph neural controlled differential equations provided in this embodiment of the invention.

[0078] Figure 2 This is a general framework diagram of the traffic prediction method based on continuously evolving graph neural controlled differential equations provided in the embodiments of the present invention;

[0079] Figure 3 This is a schematic diagram of a control path that is continuous in generation time, provided in an embodiment of the present invention;

[0080] Figure 4 This is a schematic diagram of generating spatially dependent evolutionary components using a self-attention mechanism, provided in an embodiment of the present invention. Detailed Implementation

[0081] To make the objectives, technical solutions, and advantages of this invention clearer, the invention will be further described in detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the invention and do not limit the scope of protection of this invention.

[0082] The inventive concept of this invention is as follows: Addressing the problem that existing technologies cannot capture continuously evolving spatial dependencies, this invention provides a traffic prediction method based on continuously evolving graph neural controlled differential equations. By constructing a traffic prediction model including an input module, a neural controlled differential equation module, a graph generation and fusion module, a graph neural controlled differential equation module, and an output module, it models the spatial dependency evolution components and spatial dependency static components of traffic data. Based on the traffic data sequence, it generates temporally continuous control paths and utilizes neural controlled differential equations and a self-attention mechanism to generate spatial dependency evolution components. The operation of capturing continuously evolving spatial dependencies is embedded into the operation of capturing continuous temporal dependencies. Finally, the graph neural controlled differential equations are used to solve for the traffic data prediction representation after capturing spatiotemporal dependencies, thereby effectively improving the accuracy of traffic prediction.

[0083] Figure 1 This is a flowchart illustrating the overall process of the traffic prediction method based on continuously evolving graph neural controlled differential equations provided in this embodiment of the invention. Figure 2 This is a general framework diagram of the traffic prediction method based on continuously evolving graph neural controlled differential equations provided in this embodiment of the invention. Figure 1 and Figure 2 As shown in the embodiment, a traffic prediction method based on continuously evolving graph neural controlled differential equations is provided, including the following steps:

[0084] The traffic prediction task is defined as follows: treating traffic monitoring stations as nodes, and using historical data from N traffic monitoring stations over the past T time steps... Predict traffic data at the next T′ time step Where C represents the dimension of traffic data.

[0085] Step 1: Construct a traffic data time series based on traffic data collected by traffic sensors, then preprocess the data, and use a sliding window to divide the preprocessed data to obtain a training dataset.

[0086] Specifically, given traffic data time series, data preprocessing is performed to remove values ​​that are significantly outside the reasonable range and to fill in missing values. Z-score normalization is then applied to all values ​​to ensure the processed data conforms to a standard normal distribution, i.e., a mean of 0 and a standard deviation of 1. The transformed representation is as follows:

[0087]

[0088] In the formula, Let X be the value at time step t in the traffic data time series, μ be the mean of the traffic data time series, σ be the standard deviation of the traffic data time series, and X be the value at time step t. t This refers to the normalized value at time step t in the traffic data time series.

[0089] Based on experience, the time window size T is manually set, and the normalized data is divided into training datasets using a fixed-length sliding step.

[0090] Step 2: Divide the training dataset into batches of a fixed batch size, with a total batch size of B.

[0091] Specifically, the training dataset is divided into batches based on an empirically set batch size M, with a total batch size of B, as shown below:

[0092]

[0093] In the formula, N Samples This represents the total number of samples in the training dataset.

[0094] Step 3: Select a batch of training samples with index b sequentially from the training dataset, where b∈{1,2,...,B}. Repeat steps 4-12 for each training sample in this batch.

[0095] Step 4: In the input module, the sample sequence X is converted into a time-continuous control path X(t) using cubic spline interpolation, and a randomly initialized node embedding E is generated.

[0096] Specifically, such as Figure 3 As shown, when each time series is processed individually, the control path between adjacent observations is only affected by those two observations. Furthermore, the value of the control path at the time point with the observed value is equal to the observed value, as shown below:

[0097] X(t)=X t , t∈[t1, t2, ..., t T ]

[0098] In the formula, X t Let be the observation at time step t, where T is the total number of time steps.

[0099] Randomly initialize the learnable embedding representation E of all nodes, representing the static features of the nodes.

[0100] Step 5: In the neural controlled differential equations (NCDE) module, generate the continuous hidden state H(t) of the sample sequence X based on the continuous control path X(t).

[0101] Specifically, given the control path X of node i i (t), using NCDE to generate the continuous hidden state H of node i. i (t), represented as follows:

[0102]

[0103] In the formula, H i (t1) represents the initial hidden state of node i at time t1, f μ (H i (t) is the vector field function fitted by a neural network.

[0104] To simplify the calculation, the hidden states of all nodes are stacked into a matrix representation. The calculation process of the continuous hidden states H(t) of all nodes is as follows:

[0105]

[0106] In the formula, the initial hidden state H(t1) is obtained by linear transformation of the control path starting point value X(t1), and the calculation process is expressed as follows:

[0107] H(t1)=ReLU(X(t1)W H )

[0108] In the formula, W H Let be the learnable parameter matrix, and ReLU be the activation function.

[0109] Fitting vector field function f μ The neural network (H(t)) consists of L fully connected layers and 1 dimension transformation layer, as shown below:

[0110]

[0111] In the formula, W1, ..., W L Let B1, ..., B be the learnable parameter matrix for each fully connected layer. L Let f be the output of each fully connected layer, and ψ be the dimension transformation layer to facilitate f μ (H(t)) and Perform dot product calculation.

[0112] Step 6: In the graph generation and fusion module, a self-attention mechanism is introduced to model the evolutionary components of spatial dependencies between nodes, and spatial dependency evolutionary components A are generated based on the continuous hidden states H(t). E (t).

[0113] Specifically, such as Figure 4As shown, using a linear transformation, the query Q(t) and key K(t) in the self-attention mechanism are generated from the continuous hidden states H(t) of the node, respectively. Correspondingly, both the query and the key are continuous with time. The linear transformation is expressed as follows:

[0114] Q(t)=H(t)W Q

[0115] K(t)=H(t)W K

[0116] In the formula, W Q and W K This is the learnable parameter matrix.

[0117] Next, the spatially dependent evolutionary component A is obtained through self-attention operations. E (t), represented as follows:

[0118]

[0119] In the formula, D represents the dimensions of Q(t) and K(t), T is the transpose, and A... E (t) is a function of time, which means that the spatially dependent component it represents evolves continuously over time.

[0120] Step 7: In the graph generation and fusion module, a node embedding mechanism is introduced to model the static components of spatial dependencies between nodes, and to generate the spatial dependency static components A based on the node embeddings E. S .

[0121] Specifically, embed the node into E and its transpose E. T Multiplying them yields the static spatial dependency components between nodes, represented as follows:

[0122] A S =Softmax(ReLU(EE) T ))

[0123] In the formula, Softmax is the adaptive adjacency matrix learned using the Softmax function, and ReLU is the activation function.

[0124] Step 8, in the graph generation and fusion module, the spatial dependency evolution component A is... E (t) and spatially dependent static component A S The fusion is represented by a continuous evolution graph A(t) that represents the optimal spatial dependence.

[0125] Specifically, the spatial dependency between nodes consists of two components: one that evolves continuously over time and the other that is static. In the graph generation and fusion module, these two modeled components are fused into the optimal spatial dependency A(t), as follows:

[0126] A(t)=(1-β)A E (t)+βA S

[0127] In the formula, A(t) represents the continuous evolution graph of the optimal spatial dependency, and β is the control spatial dependency evolution component A. E (t) and spatially dependent static component A S The hyperparameter of the scale.

[0128] Step 9: In the graph generation and fusion module, two graph masking mechanisms are used to further optimize the continuously evolving graph A(t): one is a semantic masking mechanism based on functional similarity, and the other is a geographical masking mechanism based on distance.

[0129] Specifically, based on the semantic masking mechanism, time-series similarity is used to represent the functional similarity between two nodes. First, the DTW algorithm is used to calculate the similarity between nodes. Then, for each node, the five nodes with the highest similarity are selected as its semantic neighbors.

[0130] Based on the geographic masking mechanism, Euclidean distance is used to represent the geographic similarity between two nodes; the shorter the distance, the greater the geographic similarity. For each node, the five closest nodes are selected as its geographic neighbors.

[0131] The mask matrix M can be obtained through the above two methods. Then, the continuous evolution graph A(t) can be optimized. The optimization process is as follows:

[0132]

[0133] In the formula, Softmax is the adaptive adjacency matrix learned using the Softmax function for normalization, ReLU is the activation function, and A(t) is the continuous evolution graph before optimization. This is the optimized continuous evolution diagram. This refers to the matrix cross product operation.

[0134] Step 10: In the graph neural controlled differential equations (GNCDE) module, based on the optimized continuous evolution graph... Simultaneously, it captures continuous temporal and spatial dependencies, and outputs traffic data predictions for the next T′ time points.

[0135] Specifically, a graph neural controlled differential equation is constructed, based on the optimized continuous evolution graph. The graph convolution process is embedded into the vector field function of the neural controlled differential equation to simultaneously capture continuous temporal and spatial dependencies.

[0136] The specific construction process of the vector field function is as follows:

[0137]

[0138]

[0139]

[0140]

[0141] In the formula, W z b z W r b r , and Let be the learnable parameter matrix, tanh be the hyperbolic tangent function, ⊙ be the matrix dot product operation, and h(t) be the output of the vector field function.

[0142] Two parallel vector field functions are constructed based on semantic masking and geographic masking mechanisms, namely the semantic vector field function and the geographic vector field function. The outputs of these two vector field functions are represented as h. sem (t) and h geo (t), the total vector field function f is constructed by connecting two vector field functions. ε (H(t)) is represented as follows:

[0143] f ε (H(t))=Cat(h sem (t), h geo (t))

[0144] In the formula, h sem (t) is the output of the semantic vector field function, h geo (t) is the output of the geographic vector field function, Cat is the connection operation, and H(t) is the continuous hidden state of all nodes.

[0145] The graph neural controlled differential equation is constructed based on the total vector field function, as follows:

[0146]

[0147] In the formula, Z(t) is the solution of the graph neural controlled differential equation, that is, the traffic data prediction representation after capturing the spatiotemporal dependence, Z(t1) is the initial traffic data prediction representation at time t1, and X(t) is the temporally continuous control path X(t).

[0148] Step 11: In the output module, the traffic data prediction representation Z(t) after capturing the spatiotemporal dependencies is transformed into traffic data prediction values.

[0149] Specifically, the traffic data prediction representation Z(t) output by the GNCDE module after capturing spatiotemporal dependencies is transformed into traffic data prediction values. It is expressed as follows:

[0150]

[0151] In the formula, t∈[t T+1 , t T+2 , ..., t T+T′ ], where T is the total time step of historical traffic data, and T′ is the total time step of future traffic data prediction.

[0152] Step 12, Calculate the prediction loss That is, the true value X corresponding to the training sample. t and the predicted values ​​output by the model The error between them.

[0153] Specifically, the mean absolute error is used as the prediction loss. The true value X corresponding to the training sample t and the predicted values ​​output by the model Mean of the error between:

[0154]

[0155] In the formula, t∈[t T+1 , t T+2 , ..., t T+T′ ].

[0156] Step 13, based on the loss of all samples in the batch Adjust the network parameters throughout the model.

[0157] Specifically, the loss of all samples in the batch.

[0158]

[0159] In the formula, Let M be the loss for the m-th sample in a batch, where M is the number of samples in each batch.

[0160] According to the loss Adjust the network parameters in the entire model and update the formula as follows:

[0161]

[0162] In the formula, η is the learning rate, and θ is all the network parameters in the model.

[0163] Step 14: Repeat steps 3-13 until all batches of the training dataset have been used in model training.

[0164] Step 15: Repeat steps 3-14 until the specified number of iterations is reached.

[0165] Step 16: Input the traffic data sequence to be predicted into the trained model to obtain the prediction result.

[0166] Specifically, the traffic data sequence to be predicted is input into the trained traffic prediction model, and the traffic data for the next T′ time steps is predicted based on the historical data of N traffic monitoring stations over the past T time steps, thus achieving traffic prediction.

[0167] In summary, the traffic prediction method based on continuously evolving graph neural controlled differential equations provided in this embodiment solves the technical problem of how to effectively capture the continuous temporal and spatial dependencies in traffic data. In traffic prediction, it can capture both the continuous temporal dependencies of traffic data and the spatial dependencies that evolve continuously over time, which can effectively improve prediction accuracy and has broad application prospects in logistics transportation, smart cities and intelligent transportation systems.

[0168] The specific embodiments described above illustrate the technical solution and beneficial effects of the present invention in detail. It should be understood that the above description is only the most preferred embodiment of the present invention and is not intended to limit the present invention. Any modifications, additions, and equivalent substitutions made within the scope of the principles of the present invention should be included within the protection scope of the present invention.

Claims

1. A traffic prediction method based on continuously evolving graph neural controlled differential equations, characterized in that, Includes the following steps: Preprocess the given traffic data sequence to construct training samples; A traffic prediction model is constructed, comprising an input module, a neurally controlled differential equation module, a graph generation and fusion module, a graph neurally controlled differential equation module, and an output module, where traffic monitoring stations are considered as nodes. The input module is used to generate randomly initialized node embeddings and generate temporally continuous control paths based on each training sample; The neural controlled differential equation module is used to generate the continuous hidden states of nodes based on control paths using neural controlled differential equations. The graph generation and fusion module is used to generate spatially dependent evolutionary components based on the continuous hidden states of nodes and spatially dependent static components based on randomly initialized node embeddings. It then fuses these spatially dependent evolutionary components and spatially dependent static components to obtain a continuous evolutionary graph, including: Based on the continuous hidden states of the nodes through linear transformation Generate queries in the self-attention mechanism respectively Both the query and the key are sequential over time, as shown below: , , In the formula, and The learnable parameter matrix; Using self-attention mechanism to obtain spatial dependency evolution components between nodes , means as follows: , In the formula, for and Dimensions For transpose, The fact that it is a function of time indicates that the spatially dependent evolutionary components are continuous over time; Using a node embedding mechanism based on randomly initialized node embeddings Spatial dependency static components between generated nodes , means as follows: , In the formula, For use A function is used to normalize the learned adaptive adjacency matrix. ; Spatial dependency evolutionary components and space-dependent static components The fusion is represented as a continuous evolution graph indicating optimal spatial dependence. , means as follows: , In the formula, Hyperparameters for controlling the ratio of the two components; And the continuous evolution graph is optimized through a masking mechanism, including: Based on the semantic masking mechanism based on functional similarity, time series similarity is used to represent the functional similarity between two nodes. The DTW algorithm is used to calculate the similarity between nodes, and the node with the highest similarity to each node is taken as its semantic neighbor. Based on the distance-based geographic masking mechanism, Euclidean distance is used to represent the geographic similarity between two nodes. The shorter the distance, the greater the geographic similarity. For each node, the node with the closest distance is taken as its geographic neighbor. The mask matrix is ​​obtained based on semantic masking and geographic masking mechanisms. The continuous evolution graph is optimized as follows: , In the formula, For use The function is used to normalize the learned adaptive adjacency matrix. , This is the continuous evolution diagram before optimization. This is the optimized continuous evolution diagram. For matrix cross product operation The graph neural controlled differential equation module is used to solve graph neural controlled differential equations based on a continuous evolution graph to obtain a traffic data prediction representation after capturing spatiotemporal dependencies; The output module is used to convert the traffic data prediction representation after capturing spatiotemporal dependencies into traffic data prediction values; The traffic prediction model is trained using training samples; Traffic prediction is performed using a trained traffic prediction model.

2. The traffic prediction method based on continuously evolving graph neural controlled differential equations according to claim 1, characterized in that, The preprocessing of the given traffic data sequence to construct training samples includes: Traffic data sequences are constructed based on traffic data collected by traffic sensors. After preprocessing, the traffic data sequences are divided using a sliding window to obtain a training dataset. The training dataset is then divided into batches with a fixed batch size. The process will be carried out in batches, with a total number of batches being [number missing]. Select index from the training dataset. A batch of training samples, among which .

3. The traffic prediction method based on continuously evolving graph neural controlled differential equations according to claim 1, characterized in that, The input module is used to generate randomly initialized node embeddings and generate temporally continuous control paths based on each training sample, including: Using cubic spline interpolation, each training sample is transformed into a time-continuous control path. , means as follows: , In the formula, In time step Observations at that location This represents the total time step; Randomly initialize the learnable embedding representation of all nodes , represents the static characteristics of a node.

4. The traffic prediction method based on continuously evolving graph neural controlled differential equations according to claim 1, characterized in that, The neural controlled differential equation module is used to generate continuous hidden states of nodes based on control paths using neural controlled differential equations, including: Given a node control path Node generation using neural controlled differential equations Continuous hidden states , means as follows: , In the formula, For nodes exist The initial hidden state at time t. This is the vector field function fitted using a neural network; Stack all the hidden states of the nodes into a matrix representation, and all nodes have consecutive hidden states. The calculation process is as follows: , In the formula, the initial hidden state From the control path start value The result is obtained through linear transformation, and the calculation process is shown below: , In the formula, For learnable parameter matrix, For activation functions; Fitting vector field function The neural network is composed of It consists of one fully connected layer and one dimension transformation layer, as shown below: , , , , In the formula, For each fully connected layer, there is a learnable parameter matrix. For the output of each fully connected layer, For dimension transformation layer, so as to facilitate and Perform dot product calculation.

5. The traffic prediction method based on continuously evolving graph neural controlled differential equations according to claim 1, characterized in that, The graph neural controlled differential equation module is used to solve graph neural controlled differential equations based on a continuous evolution graph to obtain a traffic data prediction representation that captures spatiotemporal dependencies, including: Based on the optimized continuous evolution diagram Construct a vector field function, represented as follows: , , , , In the formula, For learnable parameter matrix, It is the hyperbolic tangent function. This refers to the matrix dot product operation. This is the output of the vector field function; Two parallel vector field functions are constructed based on semantic masking and geographic masking mechanisms, namely the semantic vector field function and the geographic vector field function. The outputs of these two vector field functions are expressed as follows: and The total vector field function is constructed by connecting two vector field functions. , means as follows: , In the formula, The output of the semantic vector field function. The output of the geographic vector field function. For connection operations, The hidden state is continuous for all nodes; The graph neural controlled differential equation is constructed based on the total vector field function, as follows: , In the formula, The solution to the graph neural controlled differential equation is the traffic data prediction representation after capturing spatiotemporal dependencies. for Initial traffic data predictions at any given time indicate that, For control paths that are continuous in time .

6. The traffic prediction method based on continuously evolving graph neural controlled differential equations according to claim 1, characterized in that, The output module is used to convert the traffic data prediction representation after capturing spatiotemporal dependencies into traffic data prediction values, including: The traffic data prediction representation after capturing the spatiotemporal dependence of the output of the graph neural controlled differential equation module. Converted into traffic data prediction values , means as follows: , In the formula, , The total time step of historical traffic data. The total time step for future predictions of traffic data.

7. The traffic prediction method based on continuously evolving graph neural controlled differential equations according to claim 1, characterized in that, The process of training the traffic prediction model using training samples includes: The prediction loss is calculated based on the error between the actual values ​​corresponding to the training samples and the predicted values ​​output by the traffic prediction model. Based on the loss of all samples in each batch The network parameters in the traffic prediction model are adjusted until all training samples have participated in the model training and the specified number of iterations has been reached, resulting in the trained traffic prediction model.

8. The traffic prediction method based on continuously evolving graph neural controlled differential equations according to claim 1, characterized in that, The method of using a trained traffic prediction model for traffic prediction includes: The traffic data sequence to be predicted is input into the trained traffic prediction model, and based on... A traffic monitoring station in the past Historical data at each time step to predict the future Traffic data at each time step enables traffic prediction.

Citation Information

Patent Citations

  • Method and system for predicting state evolution trend of urban traffic road network under influence of activities

    CN113971496A

  • Continuous encoder-decoder method for traffic flow prediction task

    CN115700599A