A traffic flow spatiotemporal data prediction method, system, device and medium
Patent Information
- Application Number
- CN202310584157.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-05-23
- Publication Date
- 2026-10-13
- Estimated Expiration
- 2043-05-23
AI Technical Summary
然而,现有方法往往假设交通数据中各维度数据的空间关系是静态的,而现实中智能交通系统中的各节点关系往往也是随着时间变化的;此外,现有的方法没有考虑到噪声对于预测效果的影响,没有考虑到频域特征对于时空数据预测的作用
[0053]本发明公开一种交通流量时空数据预测方法、系统、设备及介质,使用时空图神经网络建模多个传感器的交通流量数据的动态空间关系,克服了现有方法无法建模动态空间关系的问题;利用两层神经随机偏微分方程建模交通流量数据的时间依赖关系,将噪声显式得建模出来,并在化简时,通过求解频域中的常微分方程,从而同时提取时域和时域的特征;融合动态空间关系、时域特征和时域特征三种信息,能够有效提高交通流量的预测准确率。
Smart Images

Figure CN116596145B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of spatiotemporal data prediction, and in particular to a method, system, device and medium for predicting spatiotemporal traffic flow data. Background Technology
[0002] With rapid societal development, the rapid growth of urban population and vehicles has placed immense pressure on transportation systems. Therefore, the need to establish an efficient and safe Intelligent Traffic System (ITS) is urgent. However, traditional statistical methods, due to their overly strong assumptions, cannot meet the requirements of complex systems. Fortunately, advancements in hardware and artificial intelligence have made real-time recording and analysis of traffic data possible. As a fundamental component of intelligent transportation systems, traffic flow prediction is crucial for the planning and construction of urban transportation infrastructure. It has attracted significant attention from both academia and industry.
[0003] Traffic flow data exhibits a clear temporal relationship. Firstly, data obtained from spatially close sensors are often similar, which means that better modeling the spatial relationships of traffic flow data is a key point. In addition, traffic flow data fluctuates throughout the day and has certain regularities, but it is also affected by holidays and sudden factors such as road maintenance, which can cause some sudden changes. Therefore, effectively modeling the temporal dependence is also very important.
[0004] Traffic flow prediction, aiming to forecast future traffic flow based on historical data, has been an active research topic in recent years. Some classic machine learning methods, such as Support Vector Regression (SVR), have been successfully applied in production. However, these methods cannot well simulate the spatial correlations of traffic data. Recently, spatiotemporal graph neural networks have attracted considerable attention due to their excellent performance. Specifically, spatial correlations are modeled by graph neural networks, while temporal dependencies are modeled by RNNs, Temporal Convolutional Networks (TCNs), attention mechanisms, or neural differential equations. To some extent, existing methods have achieved significant results in various traffic prediction tasks. However, existing methods often assume that the spatial relationships of different dimensions of traffic data are static, while the relationships between nodes in real-world intelligent transportation systems often change over time. Furthermore, existing methods do not consider the impact of noise on prediction performance, nor do they consider the role of frequency domain features in spatiotemporal data prediction. Summary of the Invention
[0005] The purpose of this invention is to provide a method, system, device, and medium for predicting traffic flow spatiotemporal data, which can improve the accuracy of traffic flow prediction.
[0006] To achieve the above objectives, the present invention provides the following solution:
[0007] A method for predicting traffic flow based on spatiotemporal data includes:
[0008] Collect historical traffic flow data from multiple sensors in the intelligent transportation system, and organize all historical traffic flow data into a training dataset.
[0009] The dynamic spatial relationships of traffic flow data from multiple sensors are modeled using a spatiotemporal graph neural network to obtain a continuous adaptive graph neural network layer.
[0010] Based on the continuous adaptive graph neural network layer, four neural network modules satisfying the global Lipschitz property are constructed;
[0011] Based on four neural network modules that satisfy the global Lipschitz property, the time dependency of traffic flow data is modeled using two-layer neural stochastic partial differential equations to obtain the two-layer neural stochastic partial differential equations.
[0012] The bilayer neural stochastic partial differential equation is simplified into a Fourier domain ordinary differential equation.
[0013] A traffic flow spatiotemporal data prediction model is constructed by using an ordinary differential equation in the Fourier domain and a convolutional layer, and the traffic flow spatiotemporal data prediction model is trained using the training dataset.
[0014] The real-time historical traffic flow data is input into the trained traffic flow spatiotemporal data prediction model, which outputs the predicted traffic flow value for future times.
[0015] Optionally, all historical traffic flow data can be compiled into a training dataset, specifically including:
[0016] Discard missing values from historical traffic flow data;
[0017] Historical traffic flow data with missing values were downsampled and then normalized.
[0018] A sliding window is applied to the normalized historical traffic flow data, taking 24 points in each window. The first 12 points are used as training data, and the last 12 points are used as prediction data. The sliding window step size is 1, and all the data taken by the sliding window constitute the training dataset.
[0019] Optionally, the step of using a spatiotemporal graph neural network to model the dynamic spatial relationships of traffic flow data from multiple sensors to obtain a continuous adaptive graph neural network layer specifically includes:
[0020] Construct learnable and trainable continuous adaptive graph embedding encoding as in, Let w1 and w2 be the first and second weights, respectively, of the i-th row of the continuously adaptive graph embedding encoding that can be learned and trained at time t. g E is an embedding encoding used to represent global spatial relationships. g ∈R N×d R N×d For an N×d matrix, E g i For E g The i-th row; E t (t) is the embedding encoding used to model the dynamic changes of spatial dependencies at time t, E t (t)=MLP(t∈R d MLP stands for a fully connected layer, R d It is a d-order matrix;
[0021] Based on learnable and trainable continuous adaptive graph embedding encoding, the adjacency matrix is constructed as follows: In the formula, A i,j This represents the value of the element in the i-th row and j-th column of the adjacency matrix, where <*,*> represent the inner product, Softmax represents the softmax function, and ReLU represents the ReLU function.
[0022] Based on the adjacency matrix, a continuous adaptive graph neural network layer is constructed as follows: In the formula, Z(t) is the output of the continuous adaptive graph neural network layer, x t As the input to a continuous adaptive graph neural network layer, x t ∈R N×l R N ×l Let be an N×l matrix; Ω and B are the first and second trainable parameters, respectively, Ω∈R. N×k×l R N×k×l Let B be an N×k×l matrix, where B∈R N×l K is the total number of terms in the Chebyshev polynomial, and C is the total number of terms in the polynomial. k (t) represents the k-th term of the Chebyshev polynomial. I N Let A(t) be an N-order identity matrix, and C be the adjacency matrix at time t. k-1 (t), C k-2 (t) represents the (k-1)th and (k-2)th terms of the Chebyshev polynomial.
[0023] Optionally, the neural network module that satisfies the global Lipschitz property includes: a first fully connected layer, a continuous adaptive graph neural network layer, a second fully connected layer, and a TanH activation function;
[0024] The outputs of the first fully connected layer and the continuous adaptive graph neural network layer are both connected to the input of the second fully connected layer, and the output of the second fully connected layer is connected to the TanH activation function.
[0025] The first fully connected layer is used to extract data features;
[0026] Continuous adaptive graph neural network layers are used to extract dynamic spatial features;
[0027] The second fully connected layer and the TanH activation function are used to output data of a preset dimension based on the data features extracted by the first fully connected layer and the dynamic spatial features extracted by the continuous adaptive graph neural network layer.
[0028] Optionally, the method based on four neural network modules satisfying the global Lipschitz property, using two-layer neural stochastic partial differential equations to model the time dependency of traffic flow data, and obtaining a two-layer neural stochastic partial differential equation, specifically includes:
[0029] The historical traffic flow data of all sensors corresponding to the first time step in the training dataset are input into the third and fourth fully connected layers for feature extraction, and the initial values z0 and s0 of the two layers of neural stochastic partial differential equations are obtained; where z0 is the initial value of the first layer of stochastic partial differential equations and s0 is the initial value of the second layer of stochastic partial differential equations.
[0030] Based on four neural network modules that satisfy the global Lipschitz property, the architecture of the first layer of stochastic partial differential equations is determined as follows: The framework of the second-level stochastic partial differential equations is as follows: In the formula, z t Let be the value of the first-level stochastic partial differential equation at time t. F1 and G1 are linear operators for the first layer of stochastic partial differential equations, respectively, and are two neural network modules that satisfy the global Lipschitz property. t 1 For the standard Brownian motion of the first-level stochastic partial differential equation, s t Let be the value of the second-level stochastic partial differential equation at time t. F2 and G2 are linear operators for the second layer of stochastic partial differential equations, and F2 and G2 are two other neural network modules that satisfy the global Lipschitz property. t 2 For the standard Brownian motion of the second-level stochastic partial differential equation;
[0031] Solving the first-level stochastic partial differential equation using the initial value z0 yields the following solution form: In the formula, The variable in the kernel function takes the value corresponding to time t, which is used to represent The value of the variable in the kernel function at time ts; The first noise term at time t; * represents the convolution operator; z s Let be the value of the first-level stochastic partial differential equation at time s;
[0032] When the linear operator of the first-level stochastic partial differential equation When the operator is a differentiable polynomial, the solution of the first-level stochastic partial differential equation simplifies to: In the formula, F is the Fourier transform; H 1,ξ (z s H is the first intermediate variable. 1,ξ (z s )=F1(z s )+G1(z s )ξ t 1 ;
[0033] Introduce a first variable v such that its initial value v0 satisfies... The solution form of the simplified first-level stochastic partial differential equation can then be further simplified to: In the formula, v t Let A1 be the first variable value at time t; let A1 be the first mapping, satisfying...
[0034] Based on the further simplified solution form of the first-level stochastic partial differential equation, a second variable h is introduced, such that h0 = F(s0), s t =F -1 (h t The second-level stochastic partial differential equation is simplified to: In the formula, h t Let A2 be the value of the second variable at time t; let A2 be the second mapping, satisfying... h s Let be the value of the second-level stochastic partial differential equation at time s; As the second intermediate variable, This is the second noise term corresponding to time t;
[0035] Will and This constitutes a two-layer neural stochastic partial differential equation.
[0036] Optionally, the ordinary differential equation of the Fourier domain is:
[0037]
[0038] In the formula, a(t) is a trainable vector.
[0039] Optionally, the convolutional layer is in the form of:
[0040]
[0041] In the formula, L represents the predicted traffic flow from time t to time t+11, output by the convolutional layer. θ This is a convolution operation.
[0042] A traffic flow spatiotemporal data prediction system, comprising:
[0043] The data collection module is used to collect historical traffic flow data from multiple sensors in the intelligent transportation system and organize all historical traffic flow data into a training dataset.
[0044] The dynamic spatial relationship modeling module is used to model the dynamic spatial relationships of traffic flow data from multiple sensors using a spatiotemporal graph neural network, and obtain a continuous adaptive graph neural network layer.
[0045] A neural network construction module is used to construct four neural network modules that satisfy the global Lipschitz property based on the continuous adaptive graph neural network layer.
[0046] The time dependency modeling module is used to model the time dependency of traffic flow data based on four neural network modules that satisfy the global Lipschitz property, using two-layer neural stochastic partial differential equations to obtain the two-layer neural stochastic partial differential equations.
[0047] The simplification module is used to simplify the bilayer neural stochastic partial differential equation into a Fourier domain ordinary differential equation.
[0048] The training module is used to construct a traffic flow spatiotemporal data prediction model by combining an ordinary differential equation in the Fourier domain and a convolutional layer, and to train the traffic flow spatiotemporal data prediction model using the training dataset.
[0049] The prediction module is used to input real-time acquired historical traffic flow data into the trained traffic flow spatiotemporal data prediction model and output the predicted value of traffic flow at future times.
[0050] An electronic device includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the aforementioned method for predicting spatiotemporal traffic flow data.
[0051] A computer-readable storage medium having a computer program stored thereon, which, when executed, implements the aforementioned method for predicting spatiotemporal traffic flow data.
[0052] According to specific embodiments provided by the present invention, the present invention discloses the following technical effects:
[0053] This invention discloses a method, system, device, and medium for predicting traffic flow spatiotemporal data. It uses a spatiotemporal graph neural network to model the dynamic spatial relationships of traffic flow data from multiple sensors, overcoming the problem that existing methods cannot model dynamic spatial relationships. It utilizes two layers of neural stochastic partial differential equations to model the time dependence of traffic flow data, explicitly modeling noise. During simplification, it extracts both time-domain and time-domain features by solving ordinary differential equations in the frequency domain. By fusing dynamic spatial relationships, time-domain features, and time-domain characteristics, it effectively improves the accuracy of traffic flow prediction. Attached Figure Description
[0054] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the drawings used in the embodiments 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.
[0055] Figure 1 A flowchart of a traffic flow spatiotemporal data prediction method provided in an embodiment of the present invention;
[0056] Figure 2 A schematic diagram illustrating a traffic flow spatiotemporal data prediction method provided in an embodiment of the present invention;
[0057] Figure 3 This is a schematic diagram comparing the indicators of various algorithms provided in the embodiments of the present invention for predicting future points on two datasets.
[0058] Figure 4 A schematic diagram showing the comparison of predictions between the method of the present invention and the current state-of-the-art prediction algorithms on a dataset, provided for embodiments of the present invention.
[0059] Figure 5 The method of the present invention provided for embodiments of the present invention and the comparison of training curves when there is only one layer of stochastic partial differential equations.
[0060] Figure 6 This is a schematic diagram illustrating the impact of dimensional changes in the state of a stochastic partial differential equation on the prediction performance, provided in an embodiment of the present invention.
[0061] Figure 7 This diagram illustrates the impact of the node embedding encoding dimension on prediction performance, as provided in an embodiment of the present invention. Detailed Implementation
[0062] The technical solutions of the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of the present invention, and not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0063] This invention provides a method for predicting traffic flow spatiotemporal data based on continuous adaptive graph neural stochastic partial differential equations. The main idea is to model the dynamically changing spatial dependencies in spatiotemporal data through continuous adaptive graph embedding encoding; extract time-domain and frequency-domain information through a two-layer neural stochastic partial differential equation architecture, and fuse the three types of information to achieve better prediction results.
[0064] To make the above-mentioned objects, features and advantages of the present invention more apparent and understandable, the present invention will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0065] like Figure 1 and Figure 2 As shown, this embodiment of the invention provides a method for predicting traffic flow spatiotemporal data, including:
[0066] Step 1: Collect historical traffic flow data from multiple sensors in the intelligent transportation system, and organize all historical traffic flow data into a training dataset.
[0067] In intelligent transportation systems, multiple sensors collect traffic flow data simultaneously, with all sensors collecting traffic flow data every 5 minutes.
[0068] The collected traffic flow data needs to be preprocessed: missing values in the historical traffic flow data are discarded; the historical traffic flow data with missing values are downsampled and normalized; the normalized historical traffic flow data is subjected to a sliding window, with 24 points selected in each sliding window, the first 12 points used as training data and the last 12 points used as prediction data, and the sliding window step size is 1, so that all the data selected by the sliding window constitute the training dataset.
[0069] The specific preprocessing example is as follows:
[0070] Assume the obtained spatiotemporal data is x t ∈R T×N Where T is the data collection time and N is the number of sensors. If there are few missing values in the data, the corresponding missing values are discarded.
[0071] Because the sampling data has a high frequency and contains a lot of noise, it is necessary to downsample the data, recording one point every 5 minutes. Additionally, the collected data undergoes maximum-minimum normalization.
[0072]
[0073] The collected spatiotemporal data is segmented. In this example, the following task is used for testing: predict the spatiotemporal data of the next hour using spatiotemporal data of the past hour. Since the above aggregation time range is 5 minutes per point, the normalized data is windowed to take 24 points. The first 12 points are training data and the last 12 points are prediction data. The window step size is 1.
[0074] Step 2: Use a spatiotemporal graph neural network to model the dynamic spatial relationships of traffic flow data from multiple sensors to obtain a continuous adaptive graph neural network layer.
[0075] (1) Construct a learnable and trainable continuous adaptive graph embedding code, consisting of the following two parts: the first part is E g ∈R N×d The first part is used for global spatial relationships, where d is much smaller than N; the second part is:
[0076] E t (t)=MLP(t∈R d
[0077] Primarily used for modeling dynamic changes in spatial dependencies, where MLP represents a fully connected layer with the current time t as the input parameter. Ultimately, the i-th row of the learnable and trainable continuous adaptive graph embedding encoding can be represented as...
[0078]
[0079] Where E g i For E g In the i-th row, ω1 and ω2 are the weights of the two parts.
[0080] (2) Construct the adjacency matrix of the continuous graph:
[0081]
[0082] Where <*,*> denote the inner product, A i,j This represents the value of the element in the i-th row and j-th column of the adjacency matrix.
[0083] (3) Construct a continuous adaptive graph neural network layer, and let the input of the graph network layer be x. t ∈R N×l The output is Z. t ∈R N ×l Then the corresponding continuous adaptive graph neural network layer can be represented as:
[0084]
[0085] Where Ω∈R N×k×l and B∈R N×l C represents trainable parameters. k (t) represents the k-th term of the Chebyshev polynomial, satisfying
[0086]
[0087] Among them I N Let A(t) be an N-order identity matrix, and C be the adjacency matrix at time t. k-1 (t), C k-2 (t) represents the (k-1)th and (k-2)th terms of the Chebyshev polynomial.
[0088] The fact that d is much smaller than N greatly reduces the computational cost of graph neural network layers.
[0089] Step 3: Based on the continuous adaptive graph neural network layer, construct four neural network modules that satisfy the global Lipschitz property.
[0090] A neural network module that satisfies the global Lipschitz property includes: a first fully connected layer, a continuous adaptive graph neural network layer, a second fully connected layer, and a TanH activation function.
[0091] The outputs of the first fully connected layer and the continuous adaptive graph neural network layer are both connected to the input of the second fully connected layer, and the output of the second fully connected layer is connected to the TanH activation function.
[0092] The first fully connected layer is used to extract data features.
[0093] Continuous adaptive graph neural network layers are used to extract dynamic spatial features.
[0094] The second fully connected layer and the TanH activation function are used to output data of a preset dimension based on the data features extracted by the first fully connected layer and the dynamic spatial features extracted by the continuous adaptive graph neural network layer.
[0095] Step 4: Based on four neural network modules that satisfy the global Lipschitz property, the time dependency of traffic flow data is modeled using two-layer neural stochastic partial differential equations to obtain the two-layer neural stochastic partial differential equations.
[0096] The specific implementation process is as follows:
[0097] (1) First, the data corresponding to the first point in the training data is input into two fully connected layers for feature extraction, and the initial values z0, s0 of the two neural stochastic partial differential equations are obtained.
[0098] (2) Without loss of generality, given a random variable u tConsider a stochastic partial differential equation of the following form:
[0099]
[0100] Where L is a linear operator, F and G are two continuous functions, and W... t For standard Brownian motion, the framework of the two-layer stochastic partial differential equations corresponding to the two initial values in step (1) can be expressed as follows:
[0101]
[0102]
[0103] (3) Solving the first-level stochastic partial differential equation yields:
[0104]
[0105] in Let be the noise term corresponding to time t. A kernel function used to represent Let t be the value of the variable in the kernel function at time ts, and * denote the convolution operator. According to the convolution theorem, the corresponding product can be calculated in the frequency domain first, and then the inverse Fourier transform can be performed to solve it.
[0106] Further assume that if the linear operator If A is a differentiable operator of a polynomial, then there must exist a mapping A such that At this point, the stochastic partial differential equation can be simplified to
[0107]
[0108] in H represents the Fourier transform. 1,ξ (z)=F1(z)+G1(z)ξ t 1 If an additional variable v is introduced t , making The above solution can then be further simplified to:
[0109]
[0110] Similarly, for the second stochastic partial differential equation, an additional variable h is introduced. t , making Finally, the simplified form of the second stochastic partial differential equation can be obtained as follows:
[0111]
[0112] Where A1 and A2 satisfy...
[0113] Step 5: Simplify the bilayer neural stochastic partial differential equation into an ordinary differential equation in the Fourier domain.
[0114] Rewrite the simplified form from step 4 as a system of ordinary differential equations in the Fourier domain:
[0115]
[0116] We use cubic spline interpolation to fit the training data to obtain the underlying process X of the training data. Similarly, we set Where a(t) is a trainable vector. In addition, in order for this system of ordinary differential equations to have a solution, the four functions F1, F2, G1, and G2 are required to satisfy the global Lipschitz property.
[0117] Step 6: Construct a traffic flow spatiotemporal data prediction model by combining the ordinary differential equation in the Fourier domain with a convolutional layer, and train the traffic flow spatiotemporal data prediction model using the training dataset.
[0118] Step 5 obtains the state h corresponding to the last moment of the second layer. t At that time, through a convolutional layer, the predicted values for the next 12 points can be obtained directly, i.e.
[0119]
[0120] Using the mean absolute error as the loss function, the above model is trained and optimized. During the testing phase, the training data of the past hour can be input into the model, and the data of the next hour can be predicted through the model's output.
[0121] Step 7: Input the real-time historical traffic flow data into the trained traffic flow spatiotemporal data prediction model, and output the predicted traffic flow value for future times.
[0122] From the composition of the training dataset in step 1, when using the trained traffic flow spatiotemporal data prediction model for prediction, the input data to the trained traffic flow spatiotemporal data prediction model consists of 12 historical data points for one hour, and the output is 12 predicted values for the next hour.
[0123] Figure 3Part (a) in the figure represents a comparison of the prediction performance (MAE) of five methods on the PeMS03 dataset: CAG-NSPDE (abbreviation for the method of this invention), STG-NCDE (Spatiotemporal Graph Neural Control Differential Equation), AGCRN (Adaptive Graph Convolutional Recurrent Network), Z-GCNETs (Time-Aware Zigzag Topology Layer), and STGODE (Spatiotemporal Graph Ordinary Differential Equation Network). Figure 3 Part (b) in the figure shows a comparison of the prediction performance of the five methods on the PeMS03 dataset using the MAPE graph. Figure 3 Part (c) in the figure shows the RMSE comparison of the prediction performance of the five methods on the PeMS03 dataset. Figure 3 Part (d) in the figure represents a comparison of the prediction performance (MAE) of the five methods on the PeMS08 dataset. Figure 3 Part (e) in the figure represents a comparison of the prediction performance of the five methods on the PeMS08 dataset using the MAPE graph. Figure 3 Part (f) in the figure represents a comparison of the RMSE prediction performance of the five methods on the PeMS08 dataset. According to... Figure 3 It can be seen that, compared with some currently highly competitive algorithms, CAG-NSPDE has better prediction performance.
[0124] Figure 4 Part (a) in the figure represents a comparison of the prediction performance of CAG-NSPDE (the abbreviation of the method of this invention) and STG-NCDE (spatiotemporal graph neural control differential equation) on the PeMS03 57th node data. Figure 4 Part (b) in the figure shows a comparison of the prediction performance of CAG-NSPDE and STG-NCDE on the 145th node data of PeMS03. Figure 5 Part (a) in the figure represents a comparison of the training losses of CAG-NSPDE, CAG-NSPDE-1, and STG-NCDE on the PeMS03 dataset. Figure 5 Part (b) in the figure represents a comparison of the training losses of CAG-NSPDE, CAG-NSPDE-1, and STG-NCDE on the PeMS08 dataset. Figure 4 and Figure 5 It can be seen that CAG-NSPDE performs better on the PeMS03 dataset than STG-NCDE; and Figure 5 This also shows that compared to a single-layer stochastic partial differential equation architecture, CAG-NSPDE converges faster and can achieve lower training loss.
[0125] Figure 6 Part (a) in the figure represents the impact of dimensionality changes in the state of stochastic partial differential equations on the prediction performance on the PeMS03 dataset. Figure 6Part (b) shows the impact of dimensionality changes in the state of stochastic partial differential equations on the PeMS08 dataset on prediction performance. Figure 7 Part (a) in the figure represents the impact of the dimension of node embedding encoding on the prediction performance on the PeMS03 dataset. Figure 7 Part (b) shows the impact of the dimension of node embedding encoding on the prediction performance on the PeMS08 dataset. Figure 6 and Figure 7 The paper demonstrates the impact of some key parameters in CAG-NSPDE on model performance. It is clear that for the state dimension of stochastic partial differential equations, 64 should be selected; for the node embedding encoding dimension, 4 should be selected on the PeMS03 dataset and 7 should be selected on the PeMS08 dataset.
[0126] This invention overcomes the problem that existing methods in spatiotemporal data prediction tasks cannot model dynamic spatial relationships. Furthermore, by introducing stochastic partial differential equations, noise is explicitly modeled, and during simplification, ordinary differential equations in the frequency domain are solved, thereby simultaneously extracting features from both the time and frequency domains. This effectively improves prediction accuracy, is of great significance for the planning and construction of transportation facilities, and provides valuable reference for building intelligent transportation systems.
[0127] Specifically, this includes the following points:
[0128] 1. In order to efficiently and fully model the dynamic spatial dependencies in spatiotemporal data, a continuous adaptive graph embedding encoding is proposed, which models both global and dynamic spatial dependencies. Based on this, a graph neural network layer is constructed, which can model dynamic spatial dependencies with only a small number of parameters.
[0129] 2. A two-layer neural stochastic partial differential equation architecture is constructed to model temporal relationships. Noise in spatiotemporal data is explicitly modeled, and the frequency domain ordinary differential equation is obtained by simplification. This shows that this architecture can extract features in both the time and frequency domains.
[0130] This invention also provides a traffic flow spatiotemporal data prediction system, comprising:
[0131] The data collection module is used to collect historical traffic flow data from multiple sensors in the intelligent transportation system and organize all historical traffic flow data into a training dataset.
[0132] The dynamic spatial relationship modeling module is used to model the dynamic spatial relationships of traffic flow data from multiple sensors using a spatiotemporal graph neural network, and obtain a continuous adaptive graph neural network layer.
[0133] A neural network construction module is used to construct four neural network modules that satisfy the global Lipschitz property based on the continuous adaptive graph neural network layer.
[0134] The time dependency modeling module is used to model the time dependency of traffic flow data based on four neural network modules that satisfy the global Lipschitz property, using two-layer neural stochastic partial differential equations to obtain the two-layer neural stochastic partial differential equations.
[0135] The simplification module is used to simplify the bilayer neural stochastic partial differential equation into a Fourier domain ordinary differential equation.
[0136] The training module is used to construct a traffic flow spatiotemporal data prediction model by combining an ordinary differential equation in the Fourier domain and a convolutional layer, and to train the traffic flow spatiotemporal data prediction model using the training dataset.
[0137] The prediction module is used to input real-time acquired historical traffic flow data into the trained traffic flow spatiotemporal data prediction model and output the predicted value of traffic flow at future times.
[0138] The traffic flow spatiotemporal data prediction system provided in this embodiment of the invention has a similar working principle and beneficial effects to the traffic flow spatiotemporal data prediction method described in the above embodiments, so it will not be described in detail here. For details, please refer to the introduction of the above method embodiments.
[0139] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the traffic flow spatiotemporal data prediction method as described above.
[0140] Furthermore, when the computer program in the aforementioned memory is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory, random access memory, magnetic disks, or optical disks.
[0141] Furthermore, the present invention also provides a computer-readable storage medium having a computer program stored thereon, which, when executed, implements the traffic flow spatiotemporal data prediction method as described above.
[0142] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on the differences from other embodiments. The same or similar parts between the various embodiments can be referred to each other.
[0143] This document uses specific examples to illustrate the principles and implementation methods of the present invention. The descriptions of the above embodiments are only for the purpose of helping to understand the method and core ideas of the present invention. Furthermore, those skilled in the art will recognize that, based on the ideas of the present invention, there will be changes in the specific implementation methods and application scope. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A method for predicting traffic flow based on spatiotemporal data, characterized in that, include: Collect historical traffic flow data from multiple sensors in the intelligent transportation system, and organize all historical traffic flow data into a training dataset. The dynamic spatial relationships of traffic flow data from multiple sensors are modeled using a spatiotemporal graph neural network to obtain a continuous adaptive graph neural network layer. Based on the continuous adaptive graph neural network layer, four neural network modules satisfying the global Lipschitz property are constructed; Based on four neural network modules that satisfy the global Lipschitz property, the time dependency of traffic flow data is modeled using two-layer neural stochastic partial differential equations to obtain the two-layer neural stochastic partial differential equations. The bilayer neural stochastic partial differential equation is simplified into a Fourier domain ordinary differential equation. A traffic flow spatiotemporal data prediction model is constructed by using an ordinary differential equation in the Fourier domain and a convolutional layer, and the traffic flow spatiotemporal data prediction model is trained using the training dataset. The real-time historical traffic flow data is input into the trained traffic flow spatiotemporal data prediction model, and the predicted traffic flow value for future time is output. The neural network module that satisfies the global Lipschitz property includes: a first fully connected layer, a continuous adaptive graph neural network layer, a second fully connected layer, and a TanH activation function; The outputs of the first fully connected layer and the continuous adaptive graph neural network layer are both connected to the input of the second fully connected layer, and the output of the second fully connected layer is connected to the TanH activation function. The first fully connected layer is used to extract data features; Continuous adaptive graph neural network layers are used to extract dynamic spatial features; The second fully connected layer and the TanH activation function are used to output data of a preset dimension based on the data features extracted by the first fully connected layer and the dynamic spatial features extracted by the continuous adaptive graph neural network layer. The ordinary differential equation of the Fourier domain is: ; In the formula, , These are trainable vectors; for t The first variable value at time 1; for t The value of the second variable at time; For the first mapping, satisfying ; Fourier transform; The variable in the kernel function is set to t The value corresponding to the time is used to represent ; For a linear operator, express s The value of the first-level stochastic partial differential equation at time t; For the second mapping, satisfying ; for s The value of the second-level stochastic partial differential equation at time t; , For two neural network modules that satisfy the global Lipschitz property; , For the other two neural network modules that satisfy the global Lipschitz property; for t The first noise term corresponding to the given time; This is the second noise term corresponding to time t.
2. The traffic flow spatiotemporal data prediction method according to claim 1, characterized in that, All historical traffic flow data were compiled into a training dataset, specifically including: Discard missing values from historical traffic flow data; Historical traffic flow data with missing values were downsampled and then normalized. A sliding window is applied to the normalized historical traffic flow data, taking 24 points in each window. The first 12 points are used as training data, and the last 12 points are used as prediction data. The sliding window step size is 1, and all the data taken by the sliding window constitute the training dataset.
3. The traffic flow spatiotemporal data prediction method according to claim 1, characterized in that, The method of using a spatiotemporal graph neural network to model the dynamic spatial relationships of traffic flow data from multiple sensors to obtain a continuous adaptive graph neural network layer specifically includes: Construct learnable and trainable continuous adaptive graph embedding encoding as ;in, for t The first step of the continuously adaptive graph embedding encoding that can be learned and trained at any time i OK, , The first and second weights are respectively. For embedding encoding used to characterize global spatial relationships, , for N × d 1-th order matrix for The i OK; For modeling spatial dependencies t Dynamic changes in time are embedded in the encoding. MLP stands for a fully connected layer. for d 1-order matrix; Based on learnable and trainable continuous adaptive graph embedding encoding, the adjacency matrix is constructed as follows: In the formula, This represents the value of the element in the i-th row and j-th column of the adjacency matrix. denoted by , where Softmax represents the softmax function and ReLU represents the ReLU function; Based on the adjacency matrix, a continuous adaptive graph neural network layer is constructed as follows: In the formula, The output of a continuous adaptive graph neural network layer. This is the input to a continuous adaptive graph neural network layer. , for N × l 1-order matrix; , These are the first and second trainable parameters, respectively. , for N × k × l 1-th order matrix ; K Let be the total number of terms in the Chebyshev polynomial. The first polynomial of Chebyshev polynomial k item, , for N Unit matrix of order, for t The adjacency matrix at time 1, , The first polynomial of Chebyshev polynomial k -1、 k -2 items.
4. The traffic flow spatiotemporal data prediction method according to claim 1, characterized in that, The method, based on four neural network modules satisfying the global Lipschitz property, uses two-layer neural stochastic partial differential equations to model the time dependency of traffic flow data, obtaining a two-layer neural stochastic partial differential equation, specifically including: The historical traffic flow data from all sensors corresponding to the first time step in the training dataset are input into the third and fourth fully connected layers for feature extraction, thereby obtaining the initial values of the two-layer neural stochastic partial differential equations. ;in, The initial values are for the first-level stochastic partial differential equations. These are the initial values for the second-level stochastic partial differential equations; Based on four neural network modules that satisfy the global Lipschitz property, the architecture of the first layer of stochastic partial differential equations is determined as follows: The framework of the second-level stochastic partial differential equations is as follows: In the formula, for t The value of the first-level stochastic partial differential equation at time t. For linear operators of the first-level stochastic partial differential equations, For the standard Brownian motion of the first-level stochastic partial differential equation, for t The value of the second-level stochastic partial differential equation at time t. For linear operators of the second-level stochastic partial differential equations, For the standard Brownian motion of the second-level stochastic partial differential equation; Based on the initial values of the first-level stochastic partial differential equation Solving the first-level stochastic partial differential equation yields the following solution form: In the formula, In the kernel function t - s The value of the time variable; It is a convolution operator; for s The value of the first-level stochastic partial differential equation at time t; When the linear operator of the first-level stochastic partial differential equation When the operator is a differentiable polynomial, the solution of the first-level stochastic partial differential equation simplifies to: In the formula, As the first intermediate variable, ; Introducing the first variable , making the first variable initial value satisfy , The solution form of the simplified first-level stochastic partial differential equation can then be further simplified to: ; Based on the solution form of the further simplified first-level stochastic partial differential equation, a second variable is introduced. , making , The second-level stochastic partial differential equation is simplified to In the formula, As the second intermediate variable, ; Will and This constitutes a two-layer neural stochastic partial differential equation.
5. The traffic flow spatiotemporal data prediction method according to claim 4, characterized in that, The convolutional layer takes the following form: ; In the formula, This represents the predicted traffic flow from time t to time t+11, output by the convolutional layer. This is a convolution operation.
6. A traffic flow spatiotemporal data prediction system, characterized in that, include: The data collection module is used to collect historical traffic flow data from multiple sensors in the intelligent transportation system and organize all historical traffic flow data into a training dataset. The dynamic spatial relationship modeling module is used to model the dynamic spatial relationships of traffic flow data from multiple sensors using a spatiotemporal graph neural network, and obtain a continuous adaptive graph neural network layer. A neural network construction module is used to construct four neural network modules that satisfy the global Lipschitz property based on the continuous adaptive graph neural network layer. The time dependency modeling module is used to model the time dependency of traffic flow data based on four neural network modules that satisfy the global Lipschitz property, using two-layer neural stochastic partial differential equations to obtain the two-layer neural stochastic partial differential equations. The simplification module is used to simplify the bilayer neural stochastic partial differential equation into a Fourier domain ordinary differential equation. The training module is used to construct a traffic flow spatiotemporal data prediction model by combining an ordinary differential equation in the Fourier domain and a convolutional layer, and to train the traffic flow spatiotemporal data prediction model using the training dataset. The prediction module is used to input real-time acquired historical traffic flow data into the trained traffic flow spatiotemporal data prediction model and output the predicted value of traffic flow at future times. The neural network module that satisfies the global Lipschitz property includes: a first fully connected layer, a continuous adaptive graph neural network layer, a second fully connected layer, and a TanH activation function; The outputs of the first fully connected layer and the continuous adaptive graph neural network layer are both connected to the input of the second fully connected layer, and the output of the second fully connected layer is connected to the TanH activation function. The first fully connected layer is used to extract data features; Continuous adaptive graph neural network layers are used to extract dynamic spatial features; The second fully connected layer and the TanH activation function are used to output data of a preset dimension based on the data features extracted by the first fully connected layer and the dynamic spatial features extracted by the continuous adaptive graph neural network layer. The ordinary differential equation of the Fourier domain is: ; In the formula, , These are trainable vectors; for t The first variable value at time 1; for t The value of the second variable at time; For the first mapping, satisfying ; Fourier transform; The variable in the kernel function is set to t The value corresponding to the time is used to represent ; For a linear operator, express s The value of the first-level stochastic partial differential equation at time t; For the second mapping, satisfying ; for s The value of the second-level stochastic partial differential equation at time t; , For two neural network modules that satisfy the global Lipschitz property; , For the other two neural network modules that satisfy the global Lipschitz property; for t The first noise term corresponding to the given time; This is the second noise term corresponding to time t.
7. An electronic device, characterized in that, The method includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor, when executing the computer program, implements the traffic flow spatiotemporal data prediction method as described in any one of claims 1 to 5.
8. A computer-readable storage medium, characterized in that, It stores a computer program that, when executed, implements the traffic flow spatiotemporal data prediction method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Robust control method based on reinforcement learning and Lyapunov function
CN110928189A
Spatial-temporal data prediction method based on neural wavelet rough differential equation
CN115905779A