Missing traffic flow data interpolation method of GAN network based on transmission periodicity

By introducing the transmission periodicity and dynamic missing rate reconstruction loss function in the GAN network, combined with the graph neural network, the problem of failure to effectively utilize the periodicity and dynamic missing rate in the existing technology is solved, and the interpolation of traffic flow data is improved Accuracy and robustness achieve better interpolation effect.

CN119007433APending Publication Date: 2024-11-22HEBEI UNIV OF TECH
View PDF 0 Cites 6 Cited by

Patent Information

Application Number
CN202411009465.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-26
Publication Date
2024-11-22

AI Technical Summary

Technical Problem

The existing traffic flow data interpolation methods fail to effectively utilize the periodicity and dynamic missing rates of traffic flow data, resulting in poor interpolation effects and the model is prone to gradient explosion and disappearance problems.

Method used

A GAN network based on transfer periodicity is designed. By constructing a dynamic missing rate reconstruction loss function and graph neural network model, the periodic pattern and dynamic spatial dependence of traffic flow data are learned to generate more accurate interpolated data.

Benefits of technology

Improve the accuracy and robustness of traffic flow data interpolation, adapt to the dynamics of different missing rates, smooth the model optimization process, and improve the feature extraction ability of the spatiotemporal correlation of traffic flow data, which is reflected in the PeMS04 data set The interpolation effect is better than that of the STGAN model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119007433A_ABST
    Figure CN119007433A_ABST
Patent Text Reader

Abstract

The invention discloses a missing traffic flow data interpolation method for a GAN network based on transmission periodicity, and the method proposes a new periodic data extraction mode, extracts the transmission periodicity of various periodic data, is used for the prediction of historical data on missing data, and improves the accuracy of missing data interpolation. A dynamic missing rate reconstruction loss function is designed, the function dynamically adapts to data with different missing rates in different time periods, the randomness and the dynamic nature of a real missing data set are better coped with, the optimization process of the loss function is smoothed, and the robustness and the generalization ability of an interpolation model are improved; according to the method, a dynamic adjacency matrix is constructed, a dynamic spatial relationship between nodes changing along with time is modeled, static spatial dependency and dynamic spatial dependency are considered, and the feature extraction capability of the model for the spatial-temporal correlation of traffic flow data is improved. Compared with the STGAN model, the data interpolation method has the advantage that the interpolation effect is better under the condition of different missing rates on the PeMS04 data set.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention belongs to the technical field of intelligent transportation and deep learning, and proposes a missing traffic flow data interpolation method based on a GAN network with transfer periodicity. Background Art

[0002] With the rapid development of intelligent transportation systems (ITS), traffic flow data collected by road sensors and other equipment are playing an increasingly important role in the field of smart transportation. High-quality traffic flow data can be applied to tasks such as traffic flow prediction, traffic light signal control, and highway event detection in the field of smart transportation, helping traffic management departments to optimize road planning, improve traffic conditions, and enhance traffic safety. However, during data collection and storage, traffic flow data is often incomplete due to various unpredictable interruptions and emergencies. If handled improperly, it will seriously hinder downstream tasks. Existing methods for completing missing traffic flow data can be roughly divided into three categories: prediction method, interpolation method, and data distribution learning method. Interpolation methods are to fill in damaged or missing data based on known data. Commonly used methods include historical average method, K nearest neighbor method, and local least squares. How to identify known data related to the missing location is the key point. The effect is better when daily traffic data fluctuates less, but complex real data often cannot achieve satisfactory results.

[0003] In recent years, people have gradually used deep learning-based methods to learn the probability distribution of input data using generative adversarial networks (GANs) to generate interpolated data that conforms to the data distribution. The GAN network consists of a generator and a discriminator. The generator is responsible for generating false data distributions, and the discriminator is responsible for distinguishing between the real data distribution and the generated data distribution. Generally, the generator learns the data distribution mapped from the latent space, while the discriminator distinguishes the data generated by the generator from the real data distribution. The training goal of the generator is to improve the error rate of the discriminator. Among the existing methods for interpolating missing traffic flow data using GAN networks, most of the construction of the generator considers the extraction of temporal and spatial correlations between data, but the problems faced are: (1) With the extensive use of traffic detectors and sensors on urban road networks, modern traffic systems have accumulated a large amount of historical data. The large amount of data generated by the dynamically changing traffic system contains rich information and regularity. The dynamic changes of traffic flow are periodic. Effectively learning and utilizing periodic patterns is very important for traffic flow data interpolation tasks, but existing interpolation methods rarely utilize periodic data. Even if periodic data is considered, the multi-periodicity is not fully utilized. (2) The missing rate in traffic flow data varies over time. For traffic flow data sets with missing data, although the overall missing rate is fixed, the missing rate in different time periods varies. Different learning optimization methods should be used for time periods with different missing rates. However, most existing models do not take into account the dynamics of the missing rate. At the same time, a missing rate that fluctuates too much will cause gradient explosion and gradient vanishing during model optimization. (3) The correlation between different detectors in traffic flow data is represented by graph construction. Most existing models only use static predefined graph structures to learn the spatial dependencies between nodes, i.e., detectors, while ignoring that the spatial dependencies between nodes will also change dynamically over time. Summary of the invention

[0004] In view of the shortcomings of the prior art, the present invention provides a missing traffic flow data interpolation method based on a GAN network with transfer periodicity.

[0005] The present invention solves the technical problem by adopting the following technical solution: designing a missing traffic flow data interpolation method based on a GAN network with transfer periodicity, characterized in that the method comprises the following steps:

[0006] Step 1: Obtain a complete traffic flow dataset D of a certain traffic network all , D all ∈R S×R×t×N , where S is the number of samples in the traffic flow dataset, that is, the number of detection time points; R is the feature dimension, e is the time step length, and N is the number of detectors, that is, the number of detection nodes;

[0007] Set n different missing rates to obtain the missing rate sequence P, P = {p1, p2, ..., p i ,...,p n}, where the missing rate p i The value of is between 0 and 1; construct different mask matrices for different missing rates, and get the matrix in is the missing rate at p i The mask matrix of the case; construct different missing data sets D according to the mask matrix of different missing rates P , in is used The missing data constructed

[0009] Then, a predefined adjacency matrix is ​​constructed based on the connectivity and distance parameters between the N detectors in the traffic network: First, the detectors in the traffic network are regarded as nodes, and a graph G is constructed, G = (V, E, A), where V is the set of nodes in the graph, i.e., detectors, v i is any node in the set V; E represents the set of adjacent relationships between nodes. If node v i and v j are adjacent, then e ij =1, otherwise e ij =0; A∈R N×N , is the predefined adjacency matrix of the transportation network, an element in the predefined adjacency matrix A Where distance is v i and v j The distance between two nodes, and a ij =a ji ;

[0010] Step 2: First, use the Z-Score method to and D all The feature data of each dimension are normalized respectively; then the sliding window method is used to normalize the normalized and D all The window size is set to w, and the data point sequence sampled with a step length of e is used to obtain S' w×e time segments; The divided data segment x db is the data segment to be interpolated, x db ∈R R×w×t×N , that is, x db ∈R R×T×N , T = w × e, All the divided data segments constitute the data segment set to be interpolated From the missing data set D P After the above processing, n sets of data segments to be interpolated with different missing rates are obtained;

[0011] After normalization, D all The divided data segment x realb is a complete data segment, x realb ∈R R×T×N , S' complete data segments constitute a complete data segment set D' all , D' all ={x real1 ,x real2 ,...,x realb ,...,x realS'}, data segment x realb For The data segment to be interpolated x db The corresponding complete data segment;

[0012] At the same time, the mask matrix Divide in the same way to form a new mask matrix set Among them, m b For data segment x db The corresponding mask matrix;

[0013] Treat the interpolation data segment set Extract training data samples on a daily basis and set the data segments to be interpolated For the T h The data segment of the H+3th time period of the day, H is an integer greater than 0, and the Tth time period is extracted. h The data segment R1p of the H+1th T-long data segment and the data segment R2p of the H+2th T-long data segment are extracted. h -1 day, the data segment D1p of the H+2T-th time period and the data segment D2p of the H+3T-th time period, extract the T-th h -7 days, the data segment W3p of the H+2th T-long and the data segment W4p of the H+3th T-long, extract the Tth h -14 days, the data segment W1p of the H+2th T duration and the data segment W2p of the H+3th T duration; data segment Data segment R1p, data segment R2p, data segment D1p, data segment D2p, data segment W3p, data segment W4p, data segment W1p, and data segment W2p are all from the data segment set according to time. The data segments extracted from the training data are combined to obtain a training data sample x. unnormp , xunnormp ∈R R×9×T×N ;

[0014] The data segment set to be interpolated All the extracted training data samples constitute a sample set From the missing data set D P n sample sets are obtained by using n data segments to be interpolated with different missing rates;

[0015] Step 3: For the training data samples of the n sample sets obtained in step 2, divide them into training sets and validation sets according to the same quantity ratio. From one sample set, a training data set including a training set and a validation set is obtained, and a total of n training data sets are obtained. Let The training set is divided into Training set

[0016] From the training set The set of data segments to be interpolated consists of the S'' data segments to be interpolated in Let D' all Zhongyu The corresponding complete data segment set is x realTf For x Tf The corresponding complete data segment;

[0018] right The missing rate of each data segment in is calculated to obtain the missing rate α of each data segment. f , the missing rates of all segments constitute the dynamic missing rate matrix M α ={α1,α2,...,α f ,...,α S”'};

[0019] Step 4: Build a data interpolation network model

[0020] 4.1 Building the Generator Network Model

[0021] The generator network model includes a first fully connected layer, a DMblock, a TPL module, a fourth fully connected layer and an STblock; the DMblock includes a spatial attention layer and a first bidirectional GRU layer; the TPL module includes a third fully connected layer, a first void causal convolution layer, a second void causal convolution layer and a normal convolution layer, a tanh activation function layer, a sigmoid activation function layer, a second Chebyshev graph convolution layer and a maximum pooling layer; the STblock is composed of an encoder and a decoder, wherein the encoder includes a first temporal attention layer, a first temporal convolution layer), a first Chebyshev graph convolution layer, a second bidirectional GRU layer, and the decoder includes a second temporal attention layer, a second temporal convolution layer, a third temporal convolution layer and a second fully connected layer;

[0022] The input data of the generator network model is a training data sample x unnormp , And the predefined adjacency matrix A constructed by the connectivity and distance parameters between N detectors; where, As the input of the first fully connected layer, the first fully connected layer performs high-dimensional projection on the input data, and the obtained output is input into DMblock and STblock respectively;

[0023] In DMblock, the input data is processed by the spatial attention layer and the first bidirectional GRU layer in turn to obtain the dynamic adjacency matrix M D In STblock, the input data is first processed by the first time attention layer and the first time convolution layer, and the results are compared with the predefined adjacency matrix A and the dynamic adjacency matrix M. D Together they serve as the input of the first Chebyshev graph convolutional layer, and the output of the first Chebyshev graph convolutional layer is input to the second bidirectional GRU layer;

[0024] A training data sample x unnormp [W1p, W2p], [W3p, W4p], [D1p, D2p], [R1p, R2p], The time dimension splicing forms are input into the TPL module respectively. The third fully connected layer in the TPL module performs high-dimensional projection on the five groups of input data respectively, and the results are input into the first void causal convolution layer, the second void causal convolution layer and the ordinary convolution layer respectively; the output of the first void causal convolution layer is processed by the tanh activation function layer to obtain the result and the output of the second void causal convolution layer is processed by the sigmoid activation function layer to perform a point multiplication operation, and the result is added to the output of the ordinary convolution layer. The result is input into the second Chebyshev graph convolution layer together with the predefined adjacency matrix A to extract the spatial dependency relationship; the output of the second Chebyshev graph convolution layer is input into the average pooling layer to downsample the time dimension, and then the five groups of periodic data are spliced ​​in the R dimension to obtain the generated data output by the TPL module; the output of the TPL module is processed by the fourth fully connected layer, and the output obtained is the transmission periodicity of the training data sample;

[0025] The output of the fourth fully connected layer and the output of the second bidirectional GRU layer are used as the input of the decoder of the STblock. The input is processed by the second temporal attention layer, the second temporal convolution layer, the third temporal convolution layer, and the second fully connected layer in sequence to obtain the output of the generator network model.

[0026] Specifically, the generator network model first uses the first fully connected layer to process the input data x TP Perform high-dimensional projection;

[0027]

[0028] Where W1 and b1 are the weight matrix and bias value of the first fully connected layer, x input is the output of the first fully connected layer;

[0029] DMblock’s spatial attention layer uses spatial multi-head dot product self-attention to the data x input Different weights in the spatial dimension are calculated. First, the result of single-head attention is calculated:

[0030]

[0031] Where Q, K, and V are respectively q x input , W k x input and W v x input The obtained W q ∈R T×N×R , W k ∈R T×N×R , W v ∈R T×N×R, is the learnable parameter matrix; Q represents the query, K represents the key, and V represents the value. The input in self-attention is the same, all x input ;d k is the scaling factor, which is the number of channels of Q; K in the formula T Indicates that K is transposed;

[0032] Then the model is divided into multiple heads to form multiple subspaces to focus on different aspects of information. That is, the number of channels R is evenly divided into F, and then single-head attention operations are performed on them respectively, and then the results are merged. The formula is as follows:

[0033]

[0034] in R2=R / F, are the learnable parameter matrices of Q, K, and V respectively; W O ∈R T×N×R is the learnable parameter matrix of the projection, head i is the output of each single-head attention, MultiHead S (Q,K,V) is x sa , is the output result of multiple single attention splicing, that is, the output of the spatial attention layer of DMblock, x sa ∈R R×T×N ;

[0035] The output of the spatial attention layer of DMblock is input to the first bidirectional GRU layer; GRU is a gated recurrent unit. The purpose of using bidirectional is to obtain the time dependency between the historical time and future time of the missing position. The following formula is the GRU calculation process:

[0036]

[0037] Among them, x sat For x sa The data at the tth time point in W z , W r , W t is the learnable parameter matrix, z t is the gate that controls the update, r t is the gate that controls the reset; h' t It contains the current input data, which is equivalent to remembering the current state; h t ∈R N×1×R , is a state that forgets some previous information and contains current information; the bidirectional GRU is divided into a forward state and a reverse state:

[0038]

[0039] For x sat After the output of the bidirectional GRU, BiGRU() means sending the data into the BiGRU layer; using Construct dynamic adjacency matrix M D ,

[0040] For the TPL module, first input data x unnormp Splicing by time dimension as input of TPL module:

[0041]

[0042] Then use the third fully connected layer to perform high-dimensional projection:

[0043]

[0044] Where W w1~w2 , W w3~w4 , W d1~d2 , W r1~r2 , and b w1~w2 , b w3~w4 , b d1~d2 , b r1~r2 , Corresponding to the parameter matrix and bias value;

[0045] Then use the dilated causal convolution to Convolution is performed in the time dimension and activated using Tanh and Sigmoid activation functions. The results are multiplied and added to the residual connection data. Since the residual connection requires the same dimension, a layer of ordinary convolution is used to align the number of channels. The formula is as follows:

[0046]

[0047] Then, the second Chebyshev graph convolution layer is used to extract the spatial dependency of multi-period data according to the predefined adjacency matrix A. The Chebyshev graph convolution operation pays more attention to the neighbor node characteristics of the node. The predefined adjacency matrix A needs to be Laplace normalized first. The formula is as follows:

[0048]

[0049] Where D is the degree matrix of A, D ii are the diagonal elements of the degree matrix D, I n is the identity matrix, A ij is the element of A, L is the normalized Laplace matrix of A, T k(L) is the Chebyshev polynomial calculated by L, K2 is the order of the Chebyshev polynomial; X is the input data, W a is a learnable parameter matrix, CGCN(X,L) represents the operation of feeding data X and matrix L into the Chebyshev graph convolution layer, O A is the output of the Chebyshev graph convolutional layer;

[0050] Therefore, the data that has passed through the dilated causal convolution and residual connection is fed into the second Chebyshev graph convolution layer, and the formula is as follows:

[0051]

[0052] Get the transfer characteristic data of each cycle data Then, the average pooling layer is used to downsample its time dimension, shrinking its time length from 2×T to T, and then splicing is performed in the channel dimension. Finally, the fourth fully connected layer is used to extract the transfer mode of each periodic data, and the obtained transfer periodicity parameters are used to interpolate the missing data.

[0053]

[0054] Where W2 and b2 are the weight matrix and bias value of the fourth fully connected layer, Transfer periodic parameters for the learned;

[0055] STblock uses the encoder and decoder structure to distribute the encoding and reconstruction of the data segments that need to be interpolated. The first time attention layer of the encoder firstly input The time multi-head dot product self-attention mechanism is used to calculate the different weights of the data in the time dimension. The calculation process is the same as formula (2) and (3). The difference between it and the spatial multi-head dot product attention mechanism is that for the input data, its time dimension and space dimension are first transposed, and multiple subspaces are formed in the time dimension. The calculation is performed according to formula (2) and (3), and the output of the first time attention layer is obtained.

[0056] x tb =MultiHead T (x input ) (13)

[0057] Among them, MultiHead T () represents the operation of the first time attention layer, x tb is the output processed by the first time attention layer;

[0058] Then x tb After the first time convolution layer performs convolution operation in the time dimension and uses Dropout and Relu activation functions for processing, the vector x is obtained.conv1 :

[0059] x conv1 = Dropout(Relu(Conv1(x tb ))) (14)

[0060] Conv1() represents the first convolution operation, Relu() represents the use of Relu activation function, Dropout() represents the use of random inactivation, and x conv1 is the output of the first time convolution layer;

[0061] Next, we obtain the vector x conv1 Input to the first Chebyshev graph convolution layer, using the dynamic adjacency matrix M D The normalized Laplacian matrix L of the predefined adjacency matrix A is used to learn the dynamic spatial dependency and the static spatial dependency;

[0062]

[0063] Among them, M D is the constructed dynamic adjacency matrix, O L is to use L and x conv1 The result fed into CGCN, O D Is to use M D With x conv1 The result of feeding into CGCN, x GCN1 is the output of the CGCN1 layer;

[0064] Then input it into the second bidirectional GRU:

[0065]

[0066] Among them, x GCN1t For x GCN1 The data at the tth time point in Indicates splicing according to the time dimension;

[0067] The output of the second bidirectional GRU is added to the periodic parameter passed BiGRU The input is sent to the decoder and processed by the second time attention layer, the second time convolution layer, the third time convolution layer, and the second full connection layer in turn. Finally, the generator is obtained based on the historical multi-cycle data and missing data. Generated fake data Calculation formula:

[0068]

[0069] Where W3 and b3 are the parameter matrix and bias value of the second fully connected layer, and Conv2() and Conv3() are both time convolution operations;

[0070] 4.2: Build a discriminator model to determine whether the input data is true or false;

[0071] The discriminator consists of a convolutional layer, a temporal attention layer, and a fully connected layer. The calculation formula is:

[0072]

[0073] Among them, W4 and b4 are the parameter matrix and bias value of the fully connected layer, Conv4() and Conv5() are both empty causal convolution operations, and m p The data segment to be interpolated The corresponding mask matrix; the discriminator finally gives the data segment completed by interpolation The truth or falsity of the value at each position;

[0074] Step 5: Design the loss function of the data interpolation network model

[0075] First, a dynamic missing rate reconstruction loss function is designed to cope with different missing rates in different time periods:

[0076]

[0077] Among them, Loss α is the designed dynamic missing rate reconstruction loss function, Loss1 is the reconstruction loss of non-missing values, Loss2 is the reconstruction loss of interpolated values, β1 and β2 are the weight hyperparameters of the two reconstruction losses; is the mean square error formula, Y i are two parameters in the mean square error formula, n is the number of data; m p The data segment to be interpolated The corresponding mask matrix, x realTp The data segment to be interpolated The corresponding complete data segment, for The interpolated data obtained after inputting the generator; α p for Missing rate;

[0078] Then construct the loss function Loss of the generator G And the loss function of the discriminator Loss D :

[0079]

[0080]

[0081] in In order to interpolate the generated false data into the data segment at the missing position, It is the result obtained by sending the completed data segment into the discriminator;

[0082] Step 6: Train the data interpolation network model

[0083] 6.1 Network Model Initialization

[0084] Use random initialization method to initialize model parameters, set training rounds and batch size; set the optimizer to Adam optimizer, the learning rate to 0.001, and the learning rate decay method to return the learning rate to the original 0.7 when the training steps reach [30, 50, 70, 90]; in the dynamic missing rate reconstruction loss function, β1 is set to 2 and β2 is set to 10; the number of heads h of all multi-head dot product self-attention in the model is set to 4, the number of layers of bidirectional GRU is 1, the convolution kernel size in all convolution operations is 3x1, and K2 of Chebyshev polynomial is set to 3;

[0085] 6.2 Training Model

[0086] Use the n training data sets in step 3 to train the model; input the training data samples in a training data set into the model in batches according to the batch size for training, and use a batch of Loss to compare the output of the model, that is, the fake data segment generated by the generator and the complete data segment corresponding to the data segment to be interpolated. G The loss value is calculated based on the mean of the Loss of a batch. G The mean of the generator is back-propagated using the Adam optimizer to update the different weights and bias values ​​of the generator; then the values ​​needed for interpolation in the fake data segment generated by the generator are inserted into the missing position of the missing data segment to obtain the completed data segment, which is then input into the discriminator, and the output obtained is used to calculate the Loss D ; According to the Loss of a batch D The mean of the discriminator is back-propagated and updated using the Adam optimizer to complete a batch of iterative training. The updated model parameters are used as the initial parameters to continue training the generator and discriminator for the next batch of iterative training until the last batch of iterative training is completed. A round of training is completed. The model parameters at the completion of the previous round of training are used as the initial parameters for the next round of training. After each round of iterative training, the validation set in the training data set is input into the model to calculate the training data sample Loss of the validation set. D The average of the validation set Loss for 8 consecutive rounds DIf the mean value of remains unchanged or the number of training rounds reaches the preset number, the training is stopped, the model parameters are saved for the last update, and a neural network model that completes the training of a training data set is obtained;

[0087] The model parameters of the neural network model that has completed the training of one training data set are used as the initial parameters for the training of the next training data set. The model training process is repeated until all n training data sets are trained to obtain a trained data interpolation network model. The loss calculation method of the generator and the discriminator is as shown in formulas (19) to (22), and the model parameters are updated using the back propagation method.

[0088] The training data samples in the validation set of the n training data sets are respectively input into the trained data interpolation network model, and the data interpolation performance evaluation indexes of the trained data interpolation network model under the corresponding n missing rates are calculated; when the data interpolation performance evaluation index values ​​of the trained data interpolation network model under the corresponding n missing rates are all lower than the data interpolation performance evaluation index values ​​achieved by the STGAN model trained on the n training data sets, the trained data interpolation network model is the optimal data interpolation network model; otherwise, the learning rate, batch size, and optimizer category are adjusted, and the training process of the data interpolation network model is repeated until the data interpolation performance evaluation index values ​​are all smaller than those of the STGAN model, and the optimal data interpolation network model is obtained;

[0089] Step 7: Use the optimal data interpolation network model for data interpolation

[0090] Get the data segment S of the mth time period T to be interpolated of the traffic network on the Uth day in step 1 U m , m is an integer greater than 2, and obtains data segment S U m-1 , S U m-2 , S U-1 m , S U-1 m-1 , S U-7 m , S U-7 m-1 , S U-14 m , S U-14 m-1 , where data segment S U m-1 represents the m-1th T-length data segment on the Uth day, S U-7 m represents the mth T-length data segment of the U-7th day, and the meanings of the remaining data segments are deduced accordingly; the Z-Score method is used to evaluate the data segment S Um , S U m-1 , S U m-2 , S U-1 m , S U-1 m-1 , S U-7 m , S U-7 m-1 , S U-14 m , S U-14 m-1 Normalization operation is performed, and the mean and standard deviation of each dimension feature are the same as the data set D all , get the input data sequence X U ; Among them, data segment S U m After normalization, we get data segment s U m ; Input data sequence X U and the predefined adjacency matrix A of the traffic network are input into the generator network model of the optimal data interpolation network model to obtain the generated data segment r U m ; According to the data segment to be interpolated S U m The missing rate of the mask matrix K is obtained U m , according to data segment r U m and the mask matrix K U m Fill in the missing positions to obtain the interpolated data segment R U m , R U m =K U m ×s U m +(1-K U m )×r U m ; Finally, the interpolated data segment R U m Perform denormalization processing to obtain the data segment S to be interpolated U m The corresponding complete data segment.

[0091] Compared with the prior art, the beneficial effects of the present invention are as follows: the method of the present invention proposes a new way to extract periodic data, which extracts the transmission periodicity of various periodic data by learning the transmission mode of periodic data, and is used for the prediction of missing data by historical data, thereby improving the accuracy of missing data interpolation; and designs a dynamic missing rate reconstruction loss function, through which the function dynamically adapts to data with different missing rates in different time periods, better copes with the randomness and dynamics of real missing data sets, smoothes the loss function optimization process, and improves the robustness and generalization ability of the interpolation model; constructs a dynamic adjacency matrix, models the dynamic spatial relationship between nodes that changes over time, and considers static spatial dependence and dynamic spatial dependence at the same time, so as to improve the model's ability to extract features of spatiotemporal correlation of traffic flow data. Performance test data show that the missing traffic flow data interpolation method of the present invention has better interpolation effects than the STGAN model under different missing rates on the PeMS04 data set. BRIEF DESCRIPTION OF THE DRAWINGS

[0092] Figure 1 A schematic diagram of the structure and principle of a generator network model of a data interpolation network model of an embodiment of a missing traffic flow data interpolation method based on a GAN network with transfer periodicity of the present invention.

[0093] Figure 2 A schematic diagram of a method for extracting a training data sample according to an embodiment of a missing traffic flow data interpolation method based on a GAN network with transfer periodicity of the present invention.

[0094] Figure 3 A schematic diagram of the structure and principle of a transfer periodicity learning module of a generator network model of a data interpolation network model of an embodiment of a missing traffic flow data interpolation method based on a transfer periodicity GAN network of the present invention. DETAILED DESCRIPTION

[0095] Specific embodiments are given below in conjunction with the accompanying drawings. The specific embodiments are only used to introduce the technical solutions of the present invention in detail and are not intended to limit the protection scope of the present application.

[0096] The present invention provides a missing traffic flow data interpolation method based on a GAN network with transfer periodicity. The method is a missing traffic flow data interpolation method based on a graph neural network and combining transfer periodicity with a dynamic missing rate reconstruction loss function. The method comprises the following steps:

[0097] Step 1: Obtain a complete traffic flow dataset D of a certain traffic network all , D all ∈R S×R×t×N, where S is the number of samples in the traffic flow dataset, that is, the number of detection time points; R is the feature dimension, e is the time step length. As an embodiment, e is five minutes, and N is the number of detectors, that is, the number of detection nodes.

[0098] Set n different missing rates to obtain the missing rate sequence P, P = {p1, p2, ..., p i ,...,p n}, where the missing rate p i The value of is between 0 and 1. Construct different mask matrices for different missing rates and get the matrix M P =

[0099] {M P1 ,M P2 ,...,M Pi ,...,M Pn}, where M Pi ∈R S×R×t×N , M Pi is the missing rate at p i The mask matrix of the case; construct different missing data sets D according to the mask matrix of different missing rates P , D P =

[0100] {D P1 ,D P2 ,...,D Pi ,...,D Pn}, where D Pi ∈R S×R×t×N , D Pi Is to use M Pi The missing data constructed, D Pi =M Pi ×D all .

[0101] The missing rate sequence is an array created. For example, if n is 8, then P is {0.1, 0.2, ..., 0.8}; the mask matrix is ​​a matrix with the same structure as the traffic flow dataset D all A matrix of all 1s of the same dimension, and then replace the random positions in this matrix with 0s, with a proportion of p i Therefore, we can construct mask matrices under different missing rates according to different missing rates. The mask matrices under different missing rates are compared with the traffic flow dataset D all Multiplying bit by bit can achieve the effect of constructing missing data, that is, constructing missing data sets with different missing rates.

[0102] Then, a predefined adjacency matrix is ​​constructed based on the connectivity and distance parameters between the N detectors in the traffic network: First, the detectors in the traffic network are regarded as nodes, and a graph G is constructed, G = (V, E, A), where V is the set of nodes in the graph, i.e., detectors, v i is any node in the set V. E represents the set of adjacent relationships between nodes. If node v i and v j are adjacent, then e ij =1, otherwise e ij = 0. A∈R N×N , is the predefined adjacency matrix of the transportation network, an element in the predefined adjacency matrix A Where distance is v i and v j The distance between two nodes, the present invention constructs an undirected graph, so a ij =a ji .

[0103] Step 2: First, use the Z-Score method to analyze D Pi and D all Each dimension of feature data is normalized separately. Normalization formula: Among them, x zre represents the e-th eigenvalue of the r-th dimension feature obtained using the Z-Score method, x re express or D all The e-th eigenvalue of the original r-th dimension feature, μ r express or D all The mean of the eigenvalues ​​of the original r-th dimension features, σ r express or D all The standard deviation of the eigenvalues ​​of the original r-th dimension features in .

[0104] Then the sliding window method is used to normalize the and D all The window size is set to 12, and S' one-hour data segments are obtained from the data point sequence sampled every five minutes; The divided data segment x db is the data segment to be interpolated, x db ∈R R×12×e×N , that is, x db ∈R R×T×N , T is one hour, All the divided data segments constitute the data segment set to be interpolated From the missing data set DP After the above processing, n sets of data segments to be interpolated with different missing rates are obtained.

[0105] After normalization, D all The divided data segment x realb is a complete data segment, x realb ∈R R×T×N , S' complete data segments constitute a complete data segment set D' all , D' all ={x real1 ,x real2 ,...,x realb ,...,x realS'}, data segment x realb For The data segment to be interpolated x db The corresponding complete data segment.

[0106] At the same time, the mask matrix Divide in the same way to form a new mask matrix set Among them, m b For data segment x db The corresponding mask matrix.

[0107] Treat the interpolation data segment set Extract training data samples on a daily basis and set the data segments to be interpolated For the T h The data segment of the H+3th time period of the day, H is an integer greater than 0, and the Tth time period is extracted. h The data segment R1p of the H+1th T-long data segment and the data segment R2p of the H+2th T-long data segment are extracted. h -1 day, the data segment D1p of the H+2T-th time period and the data segment D2p of the H+3T-th time period, extract the T-th h -7 days, the data segment W3p of the H+2th T-long and the data segment W4p of the H+3th T-long, extract the Tth h -14 days, the data segment W1p of the H+2th T duration and the data segment W2p of the H+3th T duration; data segment Data segment R1p, data segment R2p, data segment D1p, data segment D2p, data segment W3p, data segment W4p, data segment W1p, and data segment W2p are all from the data segment set according to time. The data segments extracted from the training data are combined to obtain a training data sample x. unnormp , x unnormp ∈R R×9×T×N .

[0108] The data segment set to be interpolated All the extracted training data samples constitute a sample set From the missing data set D P n sample sets are obtained by using n sets of data segments to be interpolated with different missing rates.

[0109] As an embodiment, the method of extracting training data samples is as follows: Figure 2 As shown, Xin is the data segment to be interpolated from 9:00 to 10:00 on the T-th day, W1 is the data segment to be interpolated from 8:00 to 9:00 on the T-14th day, W2 is the data segment to be interpolated from 9:00 to 10:00 on the T-14th day, W3 is the data segment to be interpolated from 8:00 to 9:00 on the T-7th day, W4 is the data segment to be interpolated from 9:00 to 10:00 on the T-7th day, and D1 is The data segment to be interpolated from 8:00 to 9:00 on the T-1 day, D2 is the data segment to be interpolated from 9:00 to 10:00 on the T-1 day, R1 is the data segment to be interpolated from 7:00 to 8:00 on the T day, R2 is the data segment to be interpolated from 8:00 to 9:00 on the T day, target is the data segment that has been interpolated from 9:00 to 10:00 on the T day, and a training data sample x is obtained. hi =

[0110] W1,W2,W3,W4,D1,D2,R1,R2,Xin],x hi ∈R R×9×T×N . Figure 2 The dotted line frame is a commonly used method for extracting periodic data, and the solid line frame is a new method for extracting transmission periodicity based on the dotted line.

[0111] Step 3: For the training data samples of the n sample sets obtained in step 2, divide them into training sets and validation sets according to the same quantity ratio. From one sample set, a training data set including a training set and a validation set is obtained, and n training data sets are obtained in total. The training set is divided into Training set From the training set The set of data segments to be interpolated consists of the S'' data segments to be interpolated in

[0113] Let D' all Zhongyu The corresponding complete data segment set is x realTf For x TfThe corresponding complete data segment.

[0115] right The missing rate of each data segment in is calculated to obtain the missing rate α of each data segment. f , the missing rates of all segments constitute the dynamic missing rate matrix M α ={α1,α2,...,α f ,...,α S”'}.

[0116] Step 4: Build a data interpolation network model

[0117] 4.1 Construct a generator network model to capture the spatiotemporal correlation of the data segments that need to be interpolated, and then learn the distribution of the data and accurately generate fake data under the learned data distribution. The generator network model architecture is shown in the figure below. Figure 1 shown.

[0118] The generator network model includes a first fully connected layer ( Figure 1 Linear1 layer in), DMblock (dynamic adjacency matrix building module), TPL module (transfer periodic learning module), the fourth fully connected layer ( Figure 1 The DMblock includes the spatial attention layer and the first bidirectional GRU layer ( Figure 1 SATT is the spatial attention layer, and BiGRU1 is the first bidirectional GRU layer).

[0119] The TPL module includes the third fully connected layer ( Figure 3 Linear3 in ), the first dilated causal convolutional layer ( Figure 3 CDconv1 in ), the second hole causal convolutional layer ( Figure 3 CDconv2) and ordinary convolutional layer ( Figure 3 resconv in), tanh activation function layer, sigmoid activation function layer, second Chebyshev graph convolution layer ( Figure 3 CGCN2 in ) and the maximum pooling layer (Avgpool). STblock consists of an encoder and a decoder, where the encoder includes the first time attention layer ( Figure 1 TATT1 in), the first time convolution layer ( Figure 1 CONV1 in ), the first Chebyshev graph convolutional layer ( Figure 1 CGCN1 in), the second bidirectional GRU layer ( Figure 1 The decoder includes a second temporal attention layer ( Figure 1 TATT2 in), the second time convolution layer ( Figure 1CONV2 in ), the third time convolution layer ( Figure 1 CONV3 in ) and the second fully connected layer ( Figure 1 Linear2 in .

[0120] The input data of the generator network model is a training data sample x unnormp , And the predefined adjacency matrix A constructed by the connectivity and distance parameters between N detectors. Among them, (Right now Figure 2 Xin in is used as the input of the first fully connected layer. The first fully connected layer performs high-dimensional projection on the input data, and the outputs are input to DMblock and STblock respectively.

[0122] In DMblock, the input data is processed by the spatial attention layer and the first bidirectional GRU layer in turn to obtain the dynamic adjacency matrix M D In STblock, the input data is first processed by the first time attention layer and the first time convolution layer in sequence, and the results are compared with the predefined adjacency matrix A and the dynamic adjacency matrix M. D Together they serve as the input of the first Chebyshev graph convolutional layer, and the output of the first Chebyshev graph convolutional layer is input to the second bidirectional GRU layer.

[0123] The temporal attention layer calculates the different weights of the data in the temporal dimension, the Chebyshev graph convolution layer extracts dynamic spatial correlations, and the bidirectional GRU layer extracts temporal correlations.

[0124] A training data sample x unnormp [W1p, W2p], [W3p, W4p], [D1p, D2p], [R1p, R2p], ([x1, x2] represents the concatenation of x1 and x2 in the time dimension) is input into the TPL module. The third fully connected layer in the TPL module performs high-dimensional projection on the 5 input data respectively, and the results are input into the first void causal convolution layer, the second void causal convolution layer and the ordinary convolution layer respectively. The output of the first void causal convolution layer is processed by the tanh activation function layer, and the result is point multiplied with the output of the second void causal convolution layer after being processed by the sigmoid activation function layer. The result is added to the output of the ordinary convolution layer, and the result is input into the second Chebyshev graph convolution layer together with the predefined adjacency matrix A to extract spatial dependencies. The output of the second Chebyshev graph convolution layer is input into the average pooling layer to downsample the time dimension, and then the five groups of periodic data are concatenated in the R dimension to obtain the generated data output by the TPL module ( Figure 3The output of the TPL module passes through the fourth fully connected layer ( Figure 1 The output obtained by processing Linear4 in is the transmission periodicity of the training data sample.

[0125] The output of the fourth fully connected layer and the output of the second bidirectional GRU layer are used as the input of the decoder of the STblock. The input is processed by the second temporal attention layer, the second temporal convolution layer, the third temporal convolution layer and the second fully connected layer in turn to obtain the output of the generator network model (i.e. Figure 1 in Xout).

[0126] Specifically, the generator network model first uses the first fully connected layer to process the input data x TP Perform high-dimensional projection.

[0127]

[0128] Where W1 and b1 are the weight matrix and bias value of the first fully connected layer, x input is the output of Linear1.

[0129] DMblock’s spatial attention layer uses spatial multi-head dot product self-attention to the data x input By calculating different weights in the spatial dimension, it can find the most important information in the feature vector and assign a larger weight value, so that the model can focus more on these important information and capture long-distance dependencies. First, the result of single-head attention is calculated:

[0130]

[0131] Where Q, K, and V are respectively q x input , W k x input and W v x input The obtained W q ∈R T×N×R , W k ∈R T×N×R , W v ∈R T×N×R , is the learnable parameter matrix; Q represents the query, K represents the key, and V represents the value. The input in self-attention is the same, all x input ;d k is the scaling factor, which is the number of channels of Q. K in the formula T Indicates that K is transposed.

[0132] Then the model is divided into multiple heads to form multiple subspaces to focus on different aspects of information. That is, the number of channels R is evenly divided into F, and then single-head attention operations are performed on them respectively (i.e., the calculation of formula (2)), and then the results are merged. The formula is as follows:

[0133]

[0134] in are the learnable parameter matrices of Q, K, and V respectively; W O ∈R T×N×R is the learnable parameter matrix of the projection, head i is the output of each single-head attention, MultiHead S (Q,K,V) is x sa , is the output result of multiple single attention splicing, that is, the output of the spatial attention layer of DMblock, x sa ∈R R×T×N .

[0135] The output of the spatial attention layer of DMblock is input to the first bidirectional GRU layer. GRU is a gated recurrent unit. The purpose of using bidirectional is to obtain the temporal dependency between the historical time and future time of the missing position. GRU has two gates, a reset gate and an update gate. The reset gate determines how to combine the new input information with the previous memory, and the update gate defines the amount of previous memory saved to the current time step. The following formula is the GRU calculation process:

[0136]

[0137] Among them, x sat For x sa The data at the tth time point in W z , W r , W t is the learnable parameter matrix, z t is the gate that controls the update, r t is the gate that controls the reset; h' t It contains the current input data, which is equivalent to remembering the current state; h t ∈R N×1×R , is a state that forgets some previous information and contains current information. The bidirectional GRU is divided into forward state and reverse state:

[0138]

[0139] For x satAfter the output of the bidirectional GRU, BiGRU() means sending the data into the BiGRU layer; using Construct dynamic adjacency matrix M D ,

[0140] For the TPL module, first input data x unnormp Splicing by time dimension as input of TPL module:

[0141]

[0142] Then use Linear3 for high-dimensional projection:

[0143]

[0144] Where W w1~w2 , W w3~w4 , W d1~d2 , W r1~r2 , and b w1~w2 、b w3~w4 、b d1~d2 、b r1~r2 , Corresponding to the parameter matrix and bias value.

[0145] Then use the dilated causal convolution to Convolution is performed in the time dimension respectively ( Figure 3 CDconv1 and CDconv2 in ) and activated with Tanh and Sigmoid activation functions, the results are multiplied and added to the residual connection data. Because the residual connection needs to have the same dimension, a layer of ordinary convolution (resconv) is used to align the number of channels. The hole convolution can expand the receptive field, obtain denser data, shorten the convergence time, and alleviate the gradient explosion problem; the causal convolution can change the time step position of the receptive field of each neuron by filling zeros so that the prediction made at the current time step only considers historical information but not future information. The formula is as follows:

[0146]

[0147] The convolution operation process of CDconv1, CDconv2 and resconv is as follows:

[0148]

[0149] Among them, X is the input data, i is the i-th convolution kernel, K1 is the convolution kernel size, f is the filter, e is the time step, d is the expansion factor that controls the receptive field, X conv is the output obtained after convolution.

[0150] The formula principles of the three convolutions are the same. CDconv1 and CDconv2 are void causal convolutions, and resconv is a convolution operation used by the residual connection to align the number of channels, which can be regarded as a void causal convolution with a dilation factor of 1.

[0151] Then, the second Chebyshev graph convolution layer is used to extract the spatial dependency of multi-period data according to the predefined adjacency matrix A. The Chebyshev graph convolution operation pays more attention to the neighbor node characteristics of the node. The predefined adjacency matrix A needs to be Laplace normalized first. The formula is as follows:

[0152]

[0153] Where D is the degree matrix of A, D ii are the diagonal elements of the degree matrix D, I n is the identity matrix, A ij is the element of A, L is the normalized Laplace matrix of A, T k (L) is the Chebyshev polynomial calculated by L, K2 is the order of the Chebyshev polynomial; X is the input data, W a is a learnable parameter matrix, CGCN(X,L) represents the operation of feeding data X and matrix L into the Chebyshev graph convolution layer, O A is the output of the Chebyshev graph convolutional layer.

[0154] Therefore, the data that has undergone the dilated causal convolution and residual connection is fed into CGCN2, and the formula is as follows:

[0155]

[0156] Get the transfer characteristic data of each cycle data Then, the average pooling layer is used to downsample its time dimension so that its time length shrinks from 2×T to T, and then it is spliced ​​in the channel dimension. Finally, the fourth fully connected layer is used to extract the transfer mode of each periodic data, and the obtained transfer periodic parameters are used to interpolate the missing data.

[0157]

[0158] Where W2 and b2 are the weight matrix and bias value of the fourth fully connected layer, is the learned transfer period characteristic parameter.

[0159] STblock uses the encoder and decoder structure to distribute the encoding and reconstruction of the data segments that need to be interpolated. The first time attention layer of the encoder firstly inputThe temporal multi-head dot product self-attention mechanism is used to calculate the different weights of the data in the time dimension. The calculation process is the same as formula (2) and (3). The difference between it and the spatial multi-head dot product attention mechanism is that for the input data, its time dimension and space dimension are first transposed, and multiple subspaces are formed in the time dimension. The calculation is performed according to formula (2) and (3) to obtain the output of the first temporal attention layer.

[0160] x tb =MultiHead T (x input ) (13)

[0161] Among them, MultiHead T () represents the first time attention layer ( Figure 1 The operation of TATT1) in tb is the output after the first time attention layer processing.

[0162] Then x tb After the first time convolution layer performs convolution operation in the time dimension and uses Dropout and Relu activation functions for processing, the vector x is obtained. conv1 :

[0163] x conv1 = Dropout(Relu(Conv1(x tb ))) (14)

[0164] Where Conv1() represents the first time convolution operation ( Figure 1 CONV1 in , Relu() indicates the use of Relu activation function, Dropout() indicates the use of random inactivation, x conv1 is the output of the first temporal convolutional layer. The principle formula of the temporal convolutional layer is the same as formula (9).

[0165] Next, we obtain the vector x conv1 Input to the first Chebyshev graph convolution layer (same principle as formula 10) Figure 1 CGCN1 in , using the dynamic adjacency matrix M D The normalized Laplacian matrix L of the predefined adjacency matrix A is used to learn the dynamic spatial dependencies and static spatial dependencies.

[0166]

[0167] Among them, M D is the constructed dynamic adjacency matrix, O L is to use L and x conv1 The result fed into CGCN, O D Is to use MD With x conv1 The result of feeding into CGCN, x GCN1 is the output of the CGCN1 layer.

[0168] Then input it into the second bidirectional GRU:

[0169]

[0170] Among them, x GCN1t For x GCN1 The data at the tth time point in Indicates splicing according to the time dimension.

[0171] The output of the second bidirectional GRU is added to the periodic parameter passed BiGRU Input to the decoder, and then pass through the second time attention layer ( Figure 1 TATT2 in), the second time convolution layer, the third time convolution layer ( Figure 1 CONV2 and CONV3 in), the second fully connected layer ( Figure 1 The generator is finally obtained based on the historical multi-period data (i.e., W1p, W2p, W3p, W4p, D1p, D2p, R1p, R2p) and missing data. Generated fake data ( Figure 1 Xout in), calculated by:

[0172]

[0173] Where W3 and b3 are the parameter matrix and bias value of the second fully connected layer, and Conv2() and Conv3() are both temporal convolution operations.

[0174] 4.2: Build a discriminator model to determine whether the input data is true or false.

[0175] The discriminator consists of a convolutional layer, a temporal attention layer, and a fully connected layer. The calculation formula is:

[0176]

[0177] Among them, W4 and b4 are the parameter matrix and bias value of the fully connected layer, Conv4() and Conv5() are both empty causal convolution operations, and m p The data segment to be interpolated The corresponding mask matrix. The discriminator finally gives the data segment completed by interpolation The truth or falsehood of the value at each position.

[0178] Step 5: Design the loss function of the data interpolation network model

[0179] First, a dynamic missing rate reconstruction loss function is designed to cope with different missing rates in different time periods:

[0180]

[0181] Among them, Loss α is the designed dynamic missing rate reconstruction loss function, Loss1 is the reconstruction loss of non-missing values, Loss2 is the reconstruction loss of interpolated values, β1 and β2 are the weight hyperparameters of the two reconstruction losses; is the mean square error formula, Y i are two parameters in the mean square error formula, n is the number of data; m p The data segment to be interpolated The corresponding mask matrix, x realTp The data segment to be interpolated The corresponding complete data segment, for The interpolated data obtained after inputting the generator. α p for missing rate.

[0182] Then construct the loss function Loss of the generator G And the loss function of the discriminator Loss D :

[0183]

[0184] in In order to interpolate the generated false data into the data segment at the missing position, It is the result obtained by sending the completed data segment into the discriminator.

[0185] Step 6: Train the data interpolation network model

[0186] 6.1 Network Model Initialization

[0187] Use random initialization method to initialize model parameters, set training rounds and batch size. Set the optimizer to Adam optimizer, the learning rate to 0.001, and the learning rate decay method to return the learning rate to the original 0.7 when the training steps reach [30, 50, 70, 90]. In the dynamic missing rate reconstruction loss function, β1 is set to 2, β2 is set to 10, the number of heads h of all multi-head dot product self-attention in the model is set to 4, the number of layers of bidirectional GRU is 1, the convolution kernel size in all convolution operations is 3x1, and the K2 of Chebyshev polynomial is set to 3. All parameters in the generator and discriminator models are randomly sampled and initialized from Gaussian distribution.

[0188] 6.2 Training Model

[0189] The model is trained using the n training data sets in step 3. The training data samples in a training data set are input into the model in batches according to the batch size for training. The output of the model, that is, the fake data segment generated by the generator and the complete data segment corresponding to the data segment to be interpolated, are compared using a batch of Loss G The loss value is calculated based on the average of a batch of Loss G The mean of the generator is back-propagated using the Adam optimizer to update the different weights and bias values ​​of the generator; then the values ​​needed for interpolation in the fake data segment generated by the generator are inserted into the missing position of the missing data segment to obtain the completed data segment, which is then input into the discriminator, and the output obtained is used to calculate the Loss D According to the Loss of a batch D The mean of the discriminator is back-propagated and updated using the Adam optimizer to complete a batch of iterative training. The updated model parameters are used as the initial parameters to continue training the generator and discriminator for the next batch of iterative training until the last batch of iterative training is completed. A round of training is completed. The model parameters at the completion of the previous round of training are used as the initial parameters for the next round of training. After each round of iterative training, the validation set in the training data set is input into the model to calculate the training data sample Loss of the validation set. D The average of the validation set Loss for 8 consecutive rounds D If the mean value of remains unchanged or the number of training rounds reaches the preset number, the training is stopped, the model parameters obtained by the last update are saved, and the neural network model that has completed the training of a training data set is obtained. The model parameters of the neural network model that has completed the training of a training data set are used as the initial parameters for the training of the next training data set, and the model training process is repeated until all n training data sets are trained, and a trained data interpolation network model is obtained.

[0190] The loss calculation method of the generator and discriminator is as shown in formulas (19) to (22). The model parameters are updated using back propagation, and the optimizer chooses to use the Adam optimizer. When initializing the Adam optimizer, the model parameters, including weights and biases, need to be set. At the same time, two first-order moment estimation variables m and second-order moment estimation variables v need to be initialized. Their dimensions are the same as the model parameters, and their initial values ​​are 0. During the training process, the Adam optimizer uses stochastic gradient descent (SGD) to calculate the gradient of the current batch of samples. The Adam optimizer calculates the first-order moment estimate (average gradient) m and the second-order moment estimate (exponentially weighted moving average of squared gradients) v based on the current gradient and the exponential moving average of the previous gradient. Then, it updates the model parameters based on these two estimates and the preset learning rate α.

[0191] The training data samples in the validation set of the n training data sets are input into the trained data interpolation network model respectively, and the data interpolation performance evaluation indicators of the trained data interpolation network model under the corresponding n missing rates are calculated: mean absolute error (MAE), root mean square error (RMSE) and mean absolute percentage error (MAPE). The formulas of MAE, RMSE and MAPE are as follows:

[0192]

[0193] in The data of the data segment to be interpolated, y ijzk is the data of the data segment to be interpolated, M is the number of training data samples in the validation set, R is the number of features, Z is the number of time points in the data segment, and N is the number of detection nodes;

[0194] When the data interpolation performance evaluation index values ​​of the trained data interpolation network model under the corresponding n missing rates are all lower than the MAE, RMSE and MAPE index values ​​achieved by the STGAN model trained on n training data sets, the trained data interpolation network model is the optimal data interpolation network model; otherwise, adjust the learning rate, batch size, and optimizer category, and repeat the training process of the data interpolation network model until the MAE, RMSE and MAPE index values ​​are all smaller than those of the STGAN model, and the optimal data interpolation network model is obtained. The STGAN model is the STGAN model described in the paper “Y. Yuan, Y. Zhang, B. Wang, Y. Peng, Y. Hu and B. Yin, "STGAN: Spatio-Temporal Generative Adversarial Network for Traffic Data Imputation," in IEEE Transactions on Big Data, vol. 9, no. 1, pp. 200-211, 1Feb. 2023, doi: 10.1109 / TBDATA.2022.3154097.”

[0195] A learning rate that is too large may cause model instability, while a learning rate that is too small may cause slow convergence. You can use a learning rate decay strategy, such as gradually reducing the learning rate or using an adaptive learning rate method; adjusting the batch size can affect the model convergence speed and stability. Try different optimizers, such as SGD, Momentum, Adagrad, Adam, etc., to find the optimizer that best suits the current problem. Adjustment of the learning rate decay strategy: You can gradually decay the learning rate by reducing a fixed ratio every certain epochs. You can try and adjust the number of epochs and the reduction ratio. You can also try strategies such as exponential decay. You may encounter several common situations: If the memory overflows, it may be that the batch size is too large, which can be reduced for normal training;

[0196] Step 7: Use the optimal data interpolation network model for data interpolation

[0197] Get the data segment S of the mth time period T to be interpolated of the traffic network on the Uth day in step 1 U m , m is an integer greater than 2, and obtains data segment S U m-1 , S U m-2 , S U-1 m , S U-1 m-1 , S U-7m , S U-7 m-1 , S U-14 m , S U-14 m-1 , where data segment S U m-1 represents the m-1th T-length data segment on the Uth day, S U-7 m represents the mth T-length data segment of the U-7th day, and the meanings of the remaining data segments are deduced accordingly; the Z-Score method is used to evaluate the data segment S U m , S U m-1 , S U m-2 , S U-1 m , S U-1 m-1 , S U-7 m , S U-7 m-1 , S U-14 m , S U-14 m-1 Normalization operation is performed, and the mean and standard deviation of each dimension feature are the same as the data set D all , get the input data sequence X U ; Among them, data segment S U m After normalization, we get data segment s U m ; Input data sequence X U and the predefined adjacency matrix A of the traffic network are input into the generator network model of the optimal data interpolation network model to obtain the generated data segment r U m ; According to the data segment to be interpolated S U m The missing rate of the mask matrix K is obtained U m , according to data segment r U m and the mask matrix K U m Fill in the missing positions to obtain the interpolated data segment R U m , R U m =K U m ×s U m +(1-K U m)×r U m ; Finally, the interpolated data segment R U m Perform denormalization processing to obtain the data segment S to be interpolated U m The corresponding complete data segment.

[0198] Example 1

[0199] This example uses the traffic data recorded by highway sensors as an example, and selects the public data set PeMS04, which is the traffic flow data collected from 307 detection points on California highways in the United States every five minutes in January and February 2018. There are 16,992 sample points in total, and each sample point contains flow, speed and road occupancy. This example only uses the flow feature, that is, R = 1. The data set information is shown in Table 1.

[0200] Table 1 Overview of the PeMS04 dataset

[0201] Number of sensors Time step Total time steps 307 5 minutes 16992

[0202] Traffic flow data interpolation is performed on the PeMS04 dataset using a missing traffic flow data interpolation method based on graph neural networks and combined with transfer periodicity and dynamic missing rate reconstruction loss function. The specific steps include:

[0203] Step 1: Obtain the adjacency and distance parameters between the traffic flow data and the detector in the PeMS04 dataset to construct a predefined adjacency matrix, set {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8} as the missing rate, create different mask matrices, and construct the missing traffic flow dataset corresponding to the missing rate based on the complete dataset.

[0204] Step 2: Normalize the complete data set and the missing traffic flow data set, and then use the sliding window method to construct the complete data segment set, the data segment set to be interpolated, and the mask matrix set, and then treat the interpolated data segment set according to Figure 1 The multi-cycle data extraction method is used to extract training data samples to form a sample set.

[0205] Step 3: For all sample sets with different missing rates, use a ratio of 6:2:2 to divide them into training set, validation set, and test set. Then calculate the missing rate of each data segment in the training set, obtain the missing rate of each segment, and form a dynamic missing rate matrix.

[0206] Step 4: Construct the entire generator according to formulas (1) to (17); construct the discriminator according to formula (18).

[0207] Step 5: Set different hyperparameters β1 and β2 and add dynamic missing rate parameters, and design the dynamic missing rate reconstruction loss function according to formulas (19) to (22).

[0208] Step 6: Train the generator and the discriminator alternately in the training set, so that the generator can generate fake data that the discriminator cannot distinguish between true and false. Use the validation set to check the effect of the training model, and then use the test set to test the quality of the generated data. Then adjust the hyperparameters to make the test set reach the MAE, RMSE and MAPE indicators. Finally, apply the trained generator to practice.

[0209] 6.1 Training parameter settings

[0210] The model parameters were initialized using the random initialization method, with the training rounds set to 100 and the batch size set to 32. The optimizer was set to the Adam optimizer, with a learning rate of 0.001 and a learning rate decay method where the learning rate returned to the original 0.7 when the training steps reached [30, 50, 70, 90]. In the dynamic missing rate reconstruction loss function, β1 was set to 2, β2 was set to 10, the number of heads h of all multi-head dot product self-attention in the model was set to 4, the number of layers of the bidirectional GRU was 1, the convolution kernel size was 3x1, and the K2 of the Chebyshev polynomial was set to 3.

[0211] 6.2 Training Model

[0212] All samples in the training set are used as the input of the model, and are input into the model in batches according to the batch size for training. The output of the model, that is, the fake data generated by the generator, is compared with the complete data corresponding to the data to be completed using Loss. G Calculate the loss value. Use the Adam optimizer to back-propagate and update the different weights and bias values ​​of the generator according to the loss value. Then insert the values ​​needed for interpolation in the fake data generated by the generator into the missing position of the missing data to form the completed data. This data is input into the discriminator, and the output obtained is used to calculate the loss. D According to Loss D The Adam optimizer is used to back-propagate and update the different weights and bias values ​​of the discriminator to complete an iterative training; the updated model parameters are used as the initial parameters to continue training the generator and discriminator for the next iterative training. When the number of training times reaches the preset number, the weight and bias value parameters of the last update are saved to obtain the trained neural network model. The trained model is verified using the validation set. The performance of the STGAN model on the PeMS04 dataset is shown in Table 2.

[0213] As shown in Table 3, the performance of the model of the present invention on the PeMS04 dataset during training and verification is lower than that of STGAN in terms of MAE, RMSE and MAPE, reaching the verification standard, and thus saving the model parameters.

[0214] Table 2 Interpolation effect of STGAN model under different missing rates of PeMS04 dataset

[0215]

[0216] Table 3 Interpolation effect of the proposed model under different missing rates of PeMS04

[0217]

[0218] It can be seen from Table 3 that the missing traffic flow data interpolation method proposed in the present invention based on graph neural network and combined with transfer periodicity and dynamic missing rate reconstruction loss function can be effectively used for the interpolation task of missing traffic flow data.

[0219] Any matters not described in the present invention are applicable to the prior art.

Claims

1. A missing traffic flow data interpolation method based on a GAN network with transfer periodicity, characterized in that: The method comprises the following steps: Step 1: Obtain a complete traffic flow dataset D of a certain traffic network all , D all ∈R S×R×t×N , where S is the number of samples in the traffic flow dataset, that is, the number of detection time points; R is the feature dimension, e is the time step length, and N is the number of detectors, that is, the number of detection nodes; Set n different missing rates to obtain the missing rate sequence P, P = {p1, p2, ..., p i ,...,p n }, where the missing rate p i The value of is between 0 and 1; construct different mask matrices for different missing rates, and get the matrix in is the missing rate at p i The mask matrix of the case; construct different missing data sets D according to the mask matrix of different missing rates P , in is used The missing data constructed Then, a predefined adjacency matrix is ​​constructed based on the connectivity and distance parameters between the N detectors in the traffic network: First, the detectors in the traffic network are regarded as nodes, and a graph G is constructed, G = (V, E, A), where V is the set of nodes in the graph, i.e., detectors, v i is any node in the set V; E represents the set of adjacent relationships between nodes. If node v i and v j are adjacent, then e ij =1, otherwise e ij =0; A∈R N×N , is the predefined adjacency matrix of the transportation network, an element in the predefined adjacency matrix A Where distance is v i and v j The distance between two nodes, and a ij =a ji ; Step 2: First, use the Z-Score method to and D all The feature data of each dimension are normalized respectively; then the sliding window method is used to normalize the normalized and D all The window size is set to w, and the data point sequence sampled with a step length of e is used to obtain S' w×e time segments; The divided data segment x db is the data segment to be interpolated, x db ∈R R×w×t×N , that is, x db ∈R R×T×N , T = w × e, All the divided data segments constitute the data segment set to be interpolated From the missing data set D P After the above processing, n sets of data segments to be interpolated with different missing rates are obtained; After normalization, D all The divided data segment x realb is a complete data segment, x realb ∈R R×T×N , S' complete data segments constitute a complete data segment set D' all , D' all ={x real1 ,x real2 ,...,x realb ,...,x realS '}, data segment x realb For The data segment to be interpolated x db The corresponding complete data segment; At the same time, the mask matrix Divide in the same way to form a new mask matrix set Among them, m b For data segment x db The corresponding mask matrix; Treat the interpolation data segment set Extract training data samples on a daily basis and set the data segments to be interpolated For the T h The data segment of the H+3th time period of the day, H is an integer greater than 0, and the Tth time period is extracted. h The data segment R1p of the H+1th T-long data segment and the data segment R2p of the H+2th T-long data segment are extracted. h -1 day, the data segment D1p of the H+2T-th time period and the data segment D2p of the H+3T-th time period, extract the T-th h -7 days, the data segment W3p of the H+2th T-long and the data segment W4p of the H+3th T-long, extract the Tth h -14 days, the data segment W1p of the H+2th T duration and the data segment W2p of the H+3th T duration; data segment Data segment R1p, data segment R2p, data segment D1p, data segment D2p, data segment W3p, data segment W4p, data segment W1p, and data segment W2p are all from the data segment set according to time. The data segments extracted from the training data are combined to obtain a training data sample x. unnormp , x unnormp ∈R R×9×T×N ; The data segment set to be interpolated All the extracted training data samples constitute a sample set From the missing data set D P n sample sets are obtained by using n data segments to be interpolated with different missing rates; Step 3: For the training data samples of the n sample sets obtained in step 2, divide them into training sets and validation sets according to the same quantity ratio. From one sample set, a training data set including a training set and a validation set is obtained, and a total of n training data sets are obtained. Let The training set is divided into Training set From the training set The set of data segments to be interpolated consists of the S'' data segments to be interpolated in Let D' all Zhongyu The corresponding complete data segment set is x realTf For x Tf The corresponding complete data segment; right The missing rate of each data segment in is calculated to obtain the missing rate α of each data segment. f , the missing rates of all segments constitute the dynamic missing rate matrix M α ={α1,α2,...,α f ,...,α S”' }; Step 4: Build a data interpolation network model 4.1 Building the Generator Network Model The generator network model includes a first fully connected layer, a DMblock, a TPL module, a fourth fully connected layer and an STblock; the DMblock includes a spatial attention layer and a first bidirectional GRU layer; the TPL module includes a third fully connected layer, a first void causal convolution layer, a second void causal convolution layer and a normal convolution layer, a tanh activation function layer, a sigmoid activation function layer, a second Chebyshev graph convolution layer and a maximum pooling layer; the STblock is composed of an encoder and a decoder, wherein the encoder includes a first temporal attention layer, a first temporal convolution layer), a first Chebyshev graph convolution layer, a second bidirectional GRU layer, and the decoder includes a second temporal attention layer, a second temporal convolution layer, a third temporal convolution layer and a second fully connected layer; The input data of the generator network model is a training data sample x unnormp , And the predefined adjacency matrix A constructed by the connectivity and distance parameters between N detectors; where, As the input of the first fully connected layer, the first fully connected layer performs high-dimensional projection on the input data, and the obtained output is input into DMblock and STblock respectively; In DMblock, the input data is processed by the spatial attention layer and the first bidirectional GRU layer in turn to obtain the dynamic adjacency matrix M D In STblock, the input data is first processed by the first time attention layer and the first time convolution layer in sequence, and the results are compared with the predefined adjacency matrix A and the dynamic adjacency matrix M. D Together they serve as the input of the first Chebyshev graph convolutional layer, and the output of the first Chebyshev graph convolutional layer is input to the second bidirectional GRU layer; A training data sample x unnormp [W1p, W2p], [W3p, W4p], [D1p, D2p], [R1p, R2p], The time dimension splicing forms are input into the TPL module respectively. The third fully connected layer in the TPL module performs high-dimensional projection on the five groups of input data respectively, and the results are input into the first void causal convolution layer, the second void causal convolution layer and the ordinary convolution layer respectively; the output of the first void causal convolution layer is processed by the tanh activation function layer to obtain the result and the output of the second void causal convolution layer is processed by the sigmoid activation function layer to perform a point multiplication operation, and the result is added to the output of the ordinary convolution layer. The result is input into the second Chebyshev graph convolution layer together with the predefined adjacency matrix A to extract the spatial dependency relationship; the output of the second Chebyshev graph convolution layer is input into the average pooling layer to downsample the time dimension, and then the five groups of periodic data are spliced ​​in the R dimension to obtain the generated data output by the TPL module; the output of the TPL module is processed by the fourth fully connected layer, and the output obtained is the transmission periodicity of the training data sample; The output of the fourth fully connected layer and the output of the second bidirectional GRU layer are used as the input of the decoder of the STblock. The input is processed by the second temporal attention layer, the second temporal convolution layer, the third temporal convolution layer, and the second fully connected layer in sequence to obtain the output of the generator network model. Specifically, the generator network model first uses the first fully connected layer to process the input data x TP Perform high-dimensional projection; Where W1 and b1 are the weight matrix and bias value of the first fully connected layer, x input is the output of the first fully connected layer; DMblock’s spatial attention layer uses spatial multi-head dot product self-attention to the data x input Different weights in the spatial dimension are calculated. First, the result of single-head attention is calculated: Where Q, K, and V are respectively q x input , W k x input and W v x input The obtained W q ∈R T×N×R , W k ∈R T×N×R , W v ∈R T ×N×R , is the learnable parameter matrix; Q represents the query, K represents the key, and V represents the value. The input in self-attention is the same, all x input ;d k is the scaling factor, which is the number of channels of Q; K in the formula T Indicates that K is transposed; Then the model is divided into multiple heads to form multiple subspaces to focus on different aspects of information. That is, the number of channels R is evenly divided into F, and then single-head attention operations are performed on them respectively, and then the results are merged. The formula is as follows: in R2=R / F, are the learnable parameter matrices of Q, K, and V respectively; W O ∈R T×N×R is the learnable parameter matrix of the projection, head i is the output of each single-head attention, MultiHead S (Q,K,V) is x sa , is the output result of multiple single attention splicing, that is, the output of the spatial attention layer of DMblock, x sa ∈R R×T×N ; The output of the spatial attention layer of DMblock is input to the first bidirectional GRU layer; GRU is a gated recurrent unit. The purpose of using bidirectional is to obtain the time dependency between the historical time and future time of the missing position. The following formula is the GRU calculation process: Among them, x sat For x sa The data at the tth time point in W z , W r , W t is the learnable parameter matrix, z t is the gate that controls the update, r t is the gate that controls the reset; h' t It contains the current input data, which is equivalent to remembering the current state; h t ∈R N×1×R , is a state that forgets some previous information and contains current information; the bidirectional GRU is divided into a forward state and a reverse state: For x sat After the output of the bidirectional GRU, BiGRU() means sending the data into the BiGRU layer; using Construct dynamic adjacency matrix M D , For the TPL module, first input data x unnormp Splicing by time dimension as input of TPL module: Then use the third fully connected layer to perform high-dimensional projection: Where W w1~w2 , W w3~w4 , W d1~d2 , W r1~r2 , and b w1~w2 , b w3~w4 , b d1~d2 , b r1~r2 , Corresponding to the parameter matrix and bias value; Then use the dilated causal convolution to Convolution is performed in the time dimension and activated using Tanh and Sigmoid activation functions. The results are multiplied and added to the residual connection data. Since the residual connection requires the same dimension, a layer of ordinary convolution is used to align the number of channels. The formula is as follows: Then, the second Chebyshev graph convolution layer is used to extract the spatial dependency of multi-period data according to the predefined adjacency matrix A. The Chebyshev graph convolution operation pays more attention to the neighbor node characteristics of the node. The predefined adjacency matrix A needs to be Laplace normalized first. The formula is as follows: Where D is the degree matrix of A, D ii are the diagonal elements of the degree matrix D, I n is the identity matrix, A ij is the element of A, L is the normalized Laplace matrix of A, T k (L) is the Chebyshev polynomial calculated by L, K2 is the order of the Chebyshev polynomial; X is the input data, W a is a learnable parameter matrix, CGCN(X,L) represents the operation of feeding data X and matrix L into the Chebyshev graph convolution layer, O A is the output of the Chebyshev graph convolutional layer; Therefore, the data that has passed through the dilated causal convolution and residual connection is fed into the second Chebyshev graph convolution layer, and the formula is as follows: Get the transfer characteristic data of each cycle data Then, the average pooling layer is used to downsample its time dimension, shrinking its time length from 2×T to T, and then splicing is performed in the channel dimension. Finally, the fourth fully connected layer is used to extract the transfer mode of each periodic data, and the obtained transfer periodicity parameters are used to interpolate the missing data. Where W2 and b2 are the weight matrix and bias value of the fourth fully connected layer, Transfer periodic parameters for the learned; STblock uses the encoder and decoder structure to distribute the encoding and reconstruction of the data segments that need to be interpolated. The first time attention layer of the encoder firstly input The time multi-head dot product self-attention mechanism is used to calculate the different weights of the data in the time dimension. The calculation process is the same as formula (2) and (3). The difference between it and the spatial multi-head dot product attention mechanism is that for the input data, its time dimension and space dimension are first transposed, and multiple subspaces are formed in the time dimension. The calculation is performed according to formula (2) and (3), and the output of the first time attention layer is obtained. x tb =MultiHead T (x input ) (13) Among them, MultiHead T () represents the operation of the first time attention layer, x tb is the output processed by the first time attention layer; Then x tb After the first time convolution layer performs convolution operation in the time dimension and uses Dropout and Relu activation functions for processing, the vector x is obtained. conv1 : x conv1 =Dropout(Relu(Conv1(x tb ))) (14) Conv1() represents the first time convolution operation, and Relu() represents the use of Relu activation function. Dropout() means using random dropout processing, x conv1 is the output of the first time convolution layer; Next, we obtain the vector x conv1 Input to the first Chebyshev graph convolution layer, using the dynamic adjacency matrix M D The normalized Laplacian matrix L of the predefined adjacency matrix A is used to learn the dynamic spatial dependency and the static spatial dependency; Among them, M D is the constructed dynamic adjacency matrix, O L is to use L and x conv1 The result fed into CGCN, O D Is to use M D With x conv1 The result of feeding into CGCN, x GCN1 is the output of the CGCN1 layer; Then input it into the second bidirectional GRU: Among them, x GCN1t For x GCN1 The data at the tth time point in Indicates splicing according to the time dimension; The output of the second bidirectional GRU is added to the periodic parameter passed BiGRU The input is sent to the decoder and processed by the second time attention layer, the second time convolution layer, the third time convolution layer, and the second full connection layer in turn. Finally, the generator is obtained based on the historical multi-cycle data and missing data. Generated fake data Calculation formula: Where W3 and b3 are the parameter matrix and bias value of the second fully connected layer, and Conv2() and Conv3() are both time convolution operations; 4.2: Build a discriminator model to determine whether the input data is true or false; The discriminator consists of a convolutional layer, a temporal attention layer, and a fully connected layer. The calculation formula is: Among them, W4 and b4 are the parameter matrix and bias value of the fully connected layer, Conv4() and Conv5() are both empty causal convolution operations, and m p The data segment to be interpolated The corresponding mask matrix; the discriminator finally gives the data segment completed by interpolation The truth or falsity of the value at each position; Step 5: Design the loss function of the data interpolation network model First, a dynamic missing rate reconstruction loss function is designed to cope with different missing rates in different time periods: Among them, Loss α is the designed dynamic missing rate reconstruction loss function, Loss1 is the reconstruction loss of non-missing values, Loss2 is the reconstruction loss of interpolated values, β1 and β2 are the weight hyperparameters of the two reconstruction losses; is the mean square error formula, Y i are two parameters in the mean square error formula, n is the number of data; m p The data segment to be interpolated The corresponding mask matrix, x realTp The data segment to be interpolated The corresponding complete data segment, for The interpolated data obtained after inputting the generator; α p for Missing rate; Then construct the loss function Loss of the generator G And the loss function of the discriminator Loss D : in In order to interpolate the generated false data into the data segment at the missing position, It is the result obtained by sending the completed data segment into the discriminator; Step 6: Train the data interpolation network model 6.1 Network Model Initialization Use random initialization method to initialize model parameters, set training rounds and batch size; set the optimizer to Adam optimizer, the learning rate to 0.001, and the learning rate decay method to return the learning rate to the original 0.7 when the training steps reach [30, 50, 70, 90]; in the dynamic missing rate reconstruction loss function, β1 is set to 2 and β2 is set to 10; the number of heads h of all multi-head dot product self-attention in the model is set to 4, the number of layers of bidirectional GRU is 1, the convolution kernel size in all convolution operations is 3x1, and K2 of Chebyshev polynomial is set to 3; 6.2 Training Model Use the n training data sets in step 3 to train the model; input the training data samples in a training data set into the model in batches according to the batch size for training, and use a batch of Loss to compare the output of the model, that is, the fake data segment generated by the generator and the complete data segment corresponding to the data segment to be interpolated. G The loss value is calculated based on the mean of the Loss of a batch. G The mean of the generator is back-propagated using the Adam optimizer to update the different weights and bias values ​​of the generator; then the values ​​needed for interpolation in the fake data segment generated by the generator are inserted into the missing position of the missing data segment to obtain the completed data segment, which is then input into the discriminator, and the output obtained is used to calculate the Loss D ; According to the Loss of a batch D The mean of the discriminator is back-propagated and updated using the Adam optimizer to complete a batch of iterative training. The updated model parameters are used as the initial parameters to continue training the generator and discriminator for the next batch of iterative training until the last batch of iterative training is completed. A round of training is completed. The model parameters at the completion of the previous round of training are used as the initial parameters for the next round of training. After each round of iterative training, the validation set in the training data set is input into the model to calculate the training data sample Loss of the validation set. D The average of the validation set Loss for 8 consecutive rounds D If the mean value of remains unchanged or the number of training rounds reaches the preset number, the training is stopped, the model parameters are saved for the last update, and a neural network model that completes the training of a training data set is obtained; The model parameters of the neural network model that has completed the training of one training data set are used as the initial parameters for the training of the next training data set, and the model training process is repeated continuously until all n training data sets are trained to obtain a trained data interpolation network model; The loss calculation method of the generator and discriminator is as shown in formulas (19) to (22), and the model parameters are updated using back propagation; Input the training data samples in the validation set of the n training data sets into the trained data interpolation network model respectively, and calculate the data interpolation performance evaluation index of the trained data interpolation network model under the corresponding n missing rates respectively; When the data interpolation performance evaluation index values ​​of the trained data interpolation network model under the corresponding n missing rates are all lower than the data interpolation performance evaluation index values ​​achieved by the STGAN model trained on n training data sets, the trained data interpolation network model is the optimal data interpolation network model; otherwise, adjust the learning rate, batch size, and optimizer category, and repeat the training process of the data interpolation network model until the data interpolation performance evaluation index values ​​are all smaller than those of the STGAN model, and the optimal data interpolation network model is obtained; Step 7: Use the optimal data interpolation network model for data interpolation Get the data segment S of the mth time period T to be interpolated of the traffic network on the Uth day in step 1 U m , m is an integer greater than 2, and obtains data segment S U m-1 , S U m-2 , S U-1 m , S U-1 m-1 , S U-7 m , S U-7 m-1 , S U-14 m , S U-14 m-1 , where data segment S U m-1 represents the m-1th T-length data segment on the Uth day, S U-7 m represents the mth T-length data segment of the U-7th day, and the meanings of the remaining data segments are deduced accordingly; the Z-Score method is used to evaluate the data segment S U m , S U m-1 , S U m-2 , S U-1 m , S U-1 m-1 , S U-7 m , S U-7 m-1 , S U-14 m , S U-14 m-1 Normalization operation is performed, and the mean and standard deviation of each dimension feature are the same as the data set D all , get the input data sequence X U ; Among them, data segment S U m After normalization, we get data segment s U m ; Input data sequence X U and the predefined adjacency matrix A of the traffic network are input into the generator network model of the optimal data interpolation network model to obtain the generated data segment r U m ; According to the data segment S to be interpolated U m The missing rate of the mask matrix K is obtained U m , according to data segment r U m and the mask matrix K U m Fill in the missing positions to obtain the interpolated data segment R U m , R U m =K U m ×s U m +(1-K U m )×r U m ; Finally, the interpolated data segment R U m Perform denormalization processing to obtain the data segment S to be interpolated U m The corresponding complete data segment.

2. According to claim 1, a missing traffic flow data interpolation method based on a GAN network with transfer periodicity is characterized in that: In step 1, the time step length is 5 minutes.

3. According to claim 1, a missing traffic flow data interpolation method based on a GAN network with transfer periodicity is characterized in that: In step 1, the window size is 12.

4. According to claim 1, a missing traffic flow data interpolation method based on a GAN network with transfer periodicity is characterized in that: In step 4, the convolution operation process of CDconv1, CDconv2 and resconv is as follows: Among them, X is the input data, i is the i-th convolution kernel, K1 is the convolution kernel size, f is the filter, e is the time step, d is the expansion factor that controls the receptive field, X conv It is the output obtained after convolution; the formulas and principles of the three convolution operations are the same. CDconv1 and CDconv2 are empty causal convolutions, and resconv is the convolution operation used by the residual connection to align the number of channels, which is a empty causal convolution with a dilation factor of 1.

5. According to claim 1, a missing traffic flow data interpolation method based on a GAN network with transfer periodicity is characterized in that: In step 6, all parameters in the generator and discriminator models are initialized by random sampling from the Gaussian distribution.

6. The missing traffic flow data interpolation method based on the GAN network with transfer periodicity according to claim 1 is characterized in that: In step 6, the data interpolation performance evaluation indicators are mean absolute error MAE, root mean square error RMSE and mean absolute percentage error MAPE. The formulas of MAE, RMSE and MAPE are as follows: in The data of the data segment to be interpolated, y ijzk is the data of the data segment to be interpolated, M is the number of training data samples in the validation set, R is the number of features, Z is the number of time points in the data segment, and N is the number of detection nodes.

7. The missing traffic flow data interpolation method based on the GAN network with transfer periodicity according to claim 1 is characterized in that: In step 1, the missing rate sequence P is {0.1, 0.2, 0.3, 0.4, 0.5, 0.6, 0.7, 0.8}.

Citation Information

Cited By

  • Network data asset security discovery system based on distributed machine learning

    CN119728210A

  • Time sequence prediction method and device in data missing scene, medium and equipment

    CN119988948A

  • Time Series Prediction Method, Device, Medium and Equipment in the Scenario of Missing Data

    CN119988948B

  • High-accuracy nuclear power key index predictor based on space-time correlation

    CN120069166A

  • Traffic characteristic data interpolation method

    CN120429556A