Traffic state data restoration method based on generative adversarial migration network
By training Generative Adversarial Transfer Network (MDTGAN) in two stages in the source and target domains, and combining GAT and GRU networks, the problem of spatiotemporal feature extraction in traffic data missing scenarios is solved, improving the accuracy and adaptability of data repair, and is applicable to multi-domain traffic data.
Patent Information
- Application Number
- CN202410669988.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-05-28
- Publication Date
- 2026-02-10
AI Technical Summary
Existing deep learning models struggle to effectively extract spatiotemporal features in scenarios with missing traffic data, and transfer learning is rarely used in traffic data restoration. Overcoming the differences in topology and features between different domains remains to be addressed.
We employ Generative Adversarial Transfer Network (MDTGAN) to learn and generate complete traffic data through a source domain data learning phase and a target domain data repair phase. We utilize adversarial training between the generator and the discriminator to learn and generate complete traffic data. We introduce datasets from multiple domains to enrich the training volume and guide the spatial encoder to learn domain-invariant features through a domain discriminator. We combine GAT and GRU networks to model spatiotemporal relationships.
It improves the precision and realism of traffic data repair, is applicable to road networks with different topologies, enhances the model's generalization ability, and adapts to traffic scenarios with high missing data rates.
Smart Images

Figure CN121502154A_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the fields of deep learning and traffic condition perception, and in particular to a traffic condition data repair method based on generative adversarial transfer networks. Background Technology
[0002] With the continuous development of cities and the increasing traffic volume, intelligent transportation systems are playing an increasingly important role in urban management and planning. The efficient and stable operation of these systems relies on urban data collection systems capable of acquiring large amounts of accurate traffic data in real time. However, in reality, due to factors such as equipment failure, inclement weather, and noise, the collected data is often damaged or erroneous. Previous deep learning models mostly used data from the entire network as input to explore global spatiotemporal correlations. Typically, model fitting requires support from a large amount of reliable data. However, in traffic scenarios with significant data gaps, this modeling approach struggles to accurately extract the spatiotemporal features of the target network. Therefore, solving the problem of data restoration has become urgent and crucial.
[0003] In recent research, an increasing number of researchers have begun to focus on this field. The ability of deep learning models to effectively model the spatiotemporal characteristics of data has garnered significant attention. Classic deep learning models such as Convolutional Neural Networks (CNNs) and Long Short-Term Time Networks (LSTMs) have been introduced and achieved remarkable success. Generative Adversarial Networks (GANs), as a commonly used deep learning network, have achieved significant results in image inpainting and have also provided a new approach for traffic data inpainting. GANs can learn the data distribution from the input data and simulate the generation of new data that conforms to the distribution at the missing locations. Furthermore, the interactive training method between the generator and discriminator allows the generator to simulate real data as closely as possible to deceive the discriminator, while the discriminator's method of verifying the authenticity of generated data is also well-suited for traffic data. Therefore, corresponding generative adversarial framework network models for scenarios with significant traffic data gaps urgently need to be developed.
[0004] While these studies have focused on adjusting the structure of deep spatiotemporal models to improve performance, corresponding models for scenarios with significant traffic data gaps remain to be explored. Therefore, increasing the knowledge input to the model has become a new research direction, including incorporating information such as weather, events, and traffic signals. Furthermore, researchers have found that traffic data from different cities, roads, and time periods may vary; however, these differences do not mean that all data are completely independent. In many cases, different traffic datasets may share commonalities and correlations, and transfer learning can leverage data and knowledge from other domains to improve model performance. Although transfer learning has achieved significant results in multiple fields, research applying transfer learning techniques in the specific field of traffic data restoration is relatively limited. Overcoming the differences in topological structure and features between different domains remains to be addressed. Summary of the Invention
[0005] In view of this, the purpose of this invention is to provide a traffic state data repair method based on generative adversarial transfer networks. Through adversarial training between the generator and the discriminator, the precision and realism of the repaired data are continuously improved, thereby achieving excellent repair results.
[0006] To achieve the above objectives, the present invention adopts the following technical solution: a traffic state data repair method based on generative adversarial transfer networks, which trains data through a source domain data learning stage and a target domain data repair stage; in the source domain data learning stage, spatial information is encoded according to prior knowledge of the source traffic network, and the source domain spatial information is guided into domain-invariant features by a domain discriminator; the domain-invariant features, together with the missing data, are used as input to the generator to generate complete data; the discriminator is used to distinguish between real data and generated data, thereby improving the performance of the generator; then, in the target domain data repair stage, the previously trained model parameters are adjusted using the target domain data.
[0007] In a preferred embodiment, the source domain data learning phase consists of a source data preprocessing module, a source data repair generator, a domain discriminator, and a source discriminator.
[0008] In a preferred embodiment, the data preprocessing module encodes the collected static and dynamic information of the road network; the static information uses geographic location information to generate the original node features e. v Then, spatial relationship aggregation is performed on the original features of the nodes to obtain spatial coding information f. v For dynamic observation information, data missing information needs to be handled by using a randomly generated mask matrix. To simulate data loss scenarios in the real world, the missing locations in the mask matrix are preprocessed using the average value of node observations;
[0009] Generate the original node features e using node2vec. v The Gin method with a local mean aggregator was used as a spatial encoder, and spatial features f were obtained through computation. v To obtain spatial coding information of different road network nodes;
[0010]
[0011] in This represents the iterative computation of a multilayer perceptron, with initial node spatial features. N (v) Let f represent the set of neighbors of node v. u ε represents the spatial characteristics of neighboring nodes. (k) It is a learnable parameter, k = 1, ..., K, representing the number of layers in the Gin network; after stacking multiple layers of the network, the final node spatial encoding information is obtained.
[0012] In a preferred embodiment, in the source data repair generator, a deep learning model extracts and represents important features and structures in the data by learning dynamic spatial relationships; the model utilizes the GAT network to obtain the dynamic spatial correlation between nodes, as shown in the following formula:
[0013]
[0014] GAT receives node features representing the graph structure as input, where and Let W1 and W2 represent the feature vectors of the i-th and j-th nodes, respectively; W1 and W2 are trainable weight matrices, || denotes the vector concatenation operation, and the attention weights e are... i,j This represents the degree of attention node i has towards node j; N S This represents the set of neighbors of the source domain node i;
[0015]
[0016] By applying the softmax activation function to the attention weights, they are transformed into attention coefficients α. i,j The attention coefficient represents the normalized attention between node i and its neighbor node j, and is used to perform weighted aggregation of the features of neighbor nodes.
[0017]
[0018] Compute the aggregation feature g of node i i By using the attention coefficient α i,j Features g of neighboring nodes jBy learning the weight matrix W3 and multiplying it, and then summing the features of all neighboring nodes, we obtain the aggregated feature g of node i. i ;
[0019] The temporal relationship model will focus on node-level temporal modeling, using nodes as the basic unit, and modeling all nodes in the road network one by one to expand to the repair of traffic data across the entire network. A GRU network will be used to model temporal relationships. v and It will also participate in the GRU learning and update process by concatenating its dimensions with the hidden state from the previous time step, thereby achieving in-depth exploration of temporal and spatial correlations; the detailed formula is as follows:
[0020]
[0021] W u and U u Both are learnable parameter matrices, representing the hidden states of nodes at time t-1. and the node state input at time t Feature transformation is performed, where σ represents the sigmoid function, and b u It is a learnable bias vector; then it is passed through a σ function to produce a value between [0,1], representing the weight of the previous hidden state, i.e., the update gate.
[0022]
[0023] W r and U r Both are learnable parameter matrices, representing the hidden states of nodes at time t-1. and the node state input at time t Feature transformation is performed, where σ represents the sigmoid function, and b r It is a learnable bias vector; then it is passed through a σ function to produce a value between [0,1], representing the past information that needs to be discarded or retained, i.e., the reset gate.
[0024]
[0025] W c and U c Both are learnable parameter matrices, representing the hidden states of nodes at time t-1. And after the door was reset Node state input at time t Perform feature transformation, b c It is a learnable bias vector; the candidate hidden state is obtained by passing it through the tanh activation function.
[0026]
[0027] The current hidden state is generated by combining the output of the update gate with the previous hidden state and then weighting the reset hidden state candidates with the output of the update gate; node space encoding information f v Dynamic spatial correlation features obtained through GAT neural network layers The hidden state at time t is obtained by inputting it into the fully connected layer through dimension concatenation.
[0028] Output hidden state Finally, the missing location repair value is obtained after passing through the fully connected layer. The aim is to minimize the error between the actual and corrected values in the source network, and its loss function is Loss. imp It is expressed as follows:
[0029]
[0030] Where T represents the time length for data repair. The set of nodes representing the missing positions in a node sequence;
[0031] At this point, the generator's loss function is composed of the error loss function and the domain discriminator's loss function, and is ultimately expressed as follows:
[0032]
[0033] Here, λ is the adjustment coefficient; the first part represents the error between the repaired data and the real data in the source domain, while the second part represents the loss function of the domain discriminator.
[0034] In a preferred embodiment, the domain discriminator employs node spatial coding information f v As input, a fully connected layer and activation function are used to map the input to a probability distribution vector. And for the actual domain label d of the node v One-hot encoding is used; the domain labels include all source and destination domains; the domain label mapping function formula is as follows:
[0035]
[0036] Where FC represents a fully connected layer, FC(f v The output of ) is used to calculate the domain probability distribution of the nodes through an activation function;
[0037] During training, parameters need to be optimized to maximize the classification loss. During backpropagation, a gradient reversal layer is used to pass the negative of the gradient to the previous layer. The loss function is Loss. dom Defined as follows
[0038]
[0039] in, This represents the set of all node spatial codes for the source and target datasets.
[0040] In a preferred embodiment, the discriminator structure consists of several stacked fully connected layers, and its output is a probability function in the interval [0,1], represented by the mapping function as follows: During model training, the discriminator is first trained to maximize the probability of generating the mask matrix, and then the generator is trained to minimize the probability of generating the mask matrix. The discriminator's loss function uses the cross-entropy loss function, as illustrated below:
[0041]
[0042] Where T represents the time length for data repair, This represents the total number of nodes in the source domain. During the overall training of the model, GAN first trains the discriminator, and then trains the model parameters in the generator after adjusting the parameters of the discriminator. This interactive training achieves the best repair effect.
[0043] In a preferred embodiment, the target domain data repair stage consists of a target data preprocessing module, a target data repair generator, and a target discriminator.
[0044] In a preferred embodiment, during the target domain data repair stage, the model needs to perform relevant processing on the target domain data and features to obtain the model's traffic state input. Node spatial encoding converts the original features e obtained from nodes using the node2vec method. v Then through the mapping function f v =M v (e v ;θ v ) to obtain f v The process of learning domain-invariant knowledge from source domain data during the learning phase is as follows: Here θ * (θ v This refers to adjusting the parameters initialized during the source domain data learning phase, while also adjusting them during the target domain data repair phase. Target node spatial feature extractor with the same structure but randomly initialized parameters To learn domain-specific knowledge, the process is as follows:
[0045] In a preferred embodiment, important features and structures in the data are extracted and represented by learning dynamic spatial relationships. The framework utilizes the GAT network to deeply mine the potential spatial features between target data, as shown in the following formula:
[0046]
[0047] in and Let W1, W2, and W3 represent the feature vectors of the i-th and j-th nodes; W1, W2, and W3 are trainable weight matrices, and || represents the vector concatenation operation. This is achieved by adjusting the attention weights e. i,j Using the softmax activation function, it is transformed into an attention coefficient α. i,j Then, the features of all neighboring nodes are summed to obtain the aggregated feature g of node i. i ;
[0048] In the process of modeling time-series relationships, the GRU model is still used as the main framework, and the model parameters trained on the source domain data are transferred to the target domain model; the source domain model is trained on a large amount of data.
[0049]
[0050] Among them, W u W r W c and U u U r U c Both are learnable parameter matrices, representing the hidden states of nodes at time t-1. and the node state input at time t Feature transformation is performed; σ represents the sigmoid activation function's ability to generate values between [0,1], used to generate update and reset gates; unlike the source domain data learning stage which extracts hidden node features, the spatiotemporal information aggregation process incorporates additional spatial domain-specific features. In addition to common characteristics, different domains also exhibit their own unique characteristics and patterns; by incorporating features into the model, the model can be made closer to the actual data distribution.
[0051] Output hidden state Finally, the missing location repair value is obtained after passing through the fully connected layer. Unlike the domain discriminator module present in the source domain data learning phase, the generator's final loss function is expressed as follows:
[0052]
[0053] Where T represents the time length for data repair. This represents the set of nodes at the missing positions in a node sequence.
[0054] In a preferred embodiment, the input to the discriminator is the target domain repair data output by the generator. The discriminator model structure in the target domain data repair stage is the same as that in the source domain data learning stage, consisting of several stacked fully connected layers. The output is a probability function in the interval [0,1], and the mapping function is expressed as follows: During model training, the discriminator is first trained to maximize the probability of generating the mask matrix, and then the generator is trained to minimize the probability of generating the mask matrix. The discriminator's loss function uses the cross-entropy loss function, as illustrated below:
[0055]
[0056] Where T represents the time length for data repair, This represents the total number of nodes in the target domain. During the overall training of the model, GAN first trains the discriminator, and then trains the model parameters in the generator after adjusting the parameters of the discriminator. This interactive training achieves the best repair effect.
[0057] Compared with the prior art, the present invention has the following beneficial effects:
[0058] 1. To address the problem of insufficient training samples due to missing data, we introduced datasets from multiple domains to enrich the training volume. MDGAN divides the training process into two stages: first, in the pre-training stage, the model parameters are learned and transferred using the source domain dataset; then, in the fine-tuning stage, the model parameters are optimized using the target domain dataset, and finally, the model is fitted.
[0059] 2. To enable the model to adapt to road networks with different topologies, unlike typical deep learning models that model specific road network levels, this model uses data from a single node in the road network as the modeling object and extends it to all nodes in the entire network to achieve global data repair. This helps the model spontaneously learn a common spatiotemporal correlation among nodes, improving the model's generalization ability and making it suitable for traffic scenarios with high missing data rates.
[0060] 3. This invention introduces a domain discriminator module, which guides the spatial encoder to learn common knowledge among different urban transportation networks during the pre-training stage and helps the model to deeply explore domain-invariant features. Attached Figure Description
[0061] Figure 1 This is a framework diagram of a traffic status data repair method based on a generative adversarial migration network, which is a preferred embodiment of the present invention. Detailed Implementation
[0062] The present invention will be further described below with reference to the accompanying drawings and embodiments.
[0063] It should be noted that the following detailed descriptions are illustrative and intended to provide further explanation of this application. Unless otherwise specified, all technical and scientific terms used in this invention have the same meaning as commonly understood by one of ordinary skill in the art to which this application pertains.
[0064] It should be noted that the terminology used herein is for the purpose of describing particular implementations only and is not intended to limit the exemplary implementations according to this application; as used herein, the singular form is intended to include the plural form as well, unless the context clearly indicates otherwise; furthermore, it should be understood that when the terms “comprising” and / or “including” are used in this specification, they indicate the presence of features, steps, operations, devices, components and / or combinations thereof.
[0065] This invention proposes MDTGAN to address the traffic data restoration problem. As shown in the figure, MDTGAN performs data training in two stages. First, in the source domain data learning stage, spatial information is encoded based on prior knowledge of the source traffic network, and a domain discriminator guides the source domain spatial information into domain-invariant features. These features, along with missing data, are used as input to the generator to generate complete data. The discriminator is used to distinguish between real and generated data, thereby improving the generator's performance. Then, in the target domain data restoration stage, the previously trained model parameters are adjusted using target domain data.
[0066] The present invention will be further described in detail below with reference to specific implementation steps and Figure 1.
[0067] Source domain data learning phase
[0068] In the source domain data learning phase, MDTGAN aims to explore transferable domain-invariant knowledge from multiple source domains, while leveraging generative adversarial training to improve traffic data inpainting tasks in the target domain. To achieve this, as... Figure 1 As shown, MDTGAN consists of four main modules in the source domain data learning phase: source data preprocessing module, source data repair generator, domain discriminator, and source discriminator.
[0069] Source data preprocessing module
[0070] The data preprocessing module aims to encode the collected static and dynamic information of the road network. In transportation, static information typically refers to POI information, topological node representations, and geographic location information. This chapter uses geographic location information to generate the original node features e. v Then, spatial relationship aggregation is performed on the original features of the nodes to obtain spatial coding information f. vFor dynamically observed information, data missing information needs to be handled, which requires the use of randomly generated mask matrices. To simulate data loss scenarios in the real world, the missing locations in the mask matrix are preprocessed using the average value of node observations.
[0071] In order to obtain the spatial coding information of different road network nodes, this invention generates the original node features e using node2vec. v The Gin method with a local mean aggregator is used as a spatial encoder, and spatial features f are obtained through computation. v .
[0072]
[0073] in This represents the iterative computation of a multilayer perceptron, with initial node spatial features. N (v) Let f represent the set of neighbors of node v. u ε represents the spatial characteristics of neighboring nodes. (k) It is a learnable parameter, k = 1, ..., K, representing the number of layers in the Gin network; after stacking multiple layers of the network, the final node spatial encoding information is obtained.
[0074] Domain discriminator
[0075] The domain discriminator uses node space encoded information f v As input, a fully connected layer and activation function are used to map the input to a probability distribution vector. And for the actual domain label d of the node v One-hot encoding is used. It's worth noting that the domain labels here include all source and target domains. The module aims to extract domain-invariant information from the nodes; therefore, the model expects the spatial encoding information to confuse the domain discriminator. The domain label mapping function formula is as follows:
[0076]
[0077] Where FC represents a fully connected layer, FC(f v The output of ) is used to calculate the domain probability distribution of the node through an activation function.
[0078] Ultimately, the goal of the domain discriminator is to enable the feature extractor to learn a more generalized feature representation, minimizing the difference between the source and target domains, thus preventing inaccurate judgment of the input data's domain. To achieve this, parameters need to be optimized during training to maximize the classification loss, and a gradient reversal layer is used during backpropagation to pass the negative of the gradient to the previous layer. The loss function is Loss.dom Defined as follows
[0079]
[0080] in, This represents the set of all node spatial codes for the source and target datasets.
[0081] Source data repair generator
[0082] Deep learning models can extract and represent important features and structures in data by learning dynamic spatial relationships, thereby gaining a better understanding of the data's inherent patterns. Therefore, the model utilizes the GAT network to obtain the dynamic spatial correlations between nodes, as shown in the following formula.
[0083]
[0084] GAT receives node features representing the graph structure as input, where and Let W1 and W2 represent the feature vectors of the i-th and j-th nodes. W1 and W2 are trainable weight matrices, || denotes the vector concatenation operation, and the attention weights e are... i,j This indicates the degree of attention node i pays to node j.
[0085]
[0086] By applying the softmax activation function to the attention weights, they are transformed into attention coefficients α. i,j The attention coefficient represents the normalized attention between node i and its neighbor node j, and is used to perform weighted aggregation of the features of neighbor nodes. S This represents the set of neighbors of the source domain node i.
[0087]
[0088] The formula calculates the aggregation feature g of node i. i By using the attention coefficient α i,j Features g of neighboring nodes j By multiplying the learnable weight matrix W3 and then summing the features of all neighboring nodes, the aggregated feature g of node i is obtained. i .
[0089] It is worth noting that, due to the source network G S With the target road network G TDue to differences in spatial topology, this framework's temporal relationship model will perform node-level temporal modeling to adapt to different domain structures. Using nodes as the basic unit, all nodes in the road network are modeled individually to expand to network-wide traffic data repair. Besides structural feasibility, this model design theoretically benefits from learning, since it focuses on node modeling, to achieve the best global data repair effect, the model will spontaneously learn the shared parameters best suited to all node information. This reflects domain invariance in temporal relationships. This invention uses a GRU network to model temporal relationships. Furthermore, f v and It will also participate in the GRU learning and update process by concatenating its dimensions with the hidden state from the previous time step, thereby achieving in-depth exploration of temporal and spatial correlations. The detailed formula is as follows:
[0090]
[0091] W u and U u Both are learnable parameter matrices, representing the hidden states of nodes at time t-1. and the node state input at time t Perform feature transformation. σ represents the sigmoid function, b u It is a learnable bias vector; then it is passed through a σ function to produce a value between [0,1], representing the weight of the previous hidden state, i.e., the update gate.
[0092]
[0093] W r and U r Both are learnable parameter matrices, representing the hidden states of nodes at time t-1. and the node state input at time t Perform feature transformation. σ represents the sigmoid function, b r It is a learnable bias vector; then it is passed through a σ function to produce a value between [0,1], representing the past information that needs to be discarded or retained, i.e., the reset gate.
[0094]
[0095] W c and U c Both are learnable parameter matrices, representing the hidden states of nodes at time t-1. And after the door was reset Node state input at time t Perform feature transformation. cIt is a learnable bias vector; the candidate hidden state is obtained by passing it through the tanh activation function.
[0096]
[0097] The current hidden state can be generated by combining the output of the update gate with the previous hidden state and then weighting the reset hidden state candidates with the output of the update gate. Furthermore, to fully consider the spatiotemporal correlation of the network, the node spatial encoding information f... v Dynamic spatial correlation features obtained through GAT neural network layers The hidden state at time t is obtained by inputting it into the fully connected layer through dimension concatenation.
[0098] Output hidden state Finally, the missing location repair value is obtained after passing through the fully connected layer. The aim is to minimize the error between the actual and corrected values in the source network, and its loss function is Loss. imp It is expressed as follows:
[0099]
[0100] Where T represents the time length for data repair. This represents the set of nodes at the missing positions in a node sequence.
[0101] At this point, the generator's loss function is composed of the error loss function and the domain discriminator's loss function, and is ultimately expressed as follows:
[0102]
[0103] Here, λ is the adjustment coefficient. The first part represents the error between the repaired data in the source domain and the real data, while the second part represents the loss function of the domain discriminator. Since the gradient propagation directions of the two losses are different, the framework introduces a gradient reversal layer to solve this problem.
[0104] Source discriminator
[0105] In this chapter, the input to the discriminator is the repaired data output by the generator. For missing locations, the model expects the discriminator to identify a result close to 0, while for non-missing locations, the result is close to 1, which is the final output result. The algorithm approximates the mask matrix M. This is done to avoid the discriminator generating only matrices of all 1s due to an overly powerful generator. The discriminator structure of this invention consists of several stacked fully connected layers, and its output is a probability function in the interval [0,1]. The mapping function is expressed as follows: During model training, the discriminator is first trained to maximize the probability of generating the mask matrix, and then the generator is trained to minimize the probability of generating the mask matrix. Therefore, the discriminator's loss function adopts the cross-entropy loss function, as illustrated below:
[0106]
[0107] Where T represents the time length for data repair, This represents the total number of nodes in the source domain. During the overall model training, the GAN first trains the discriminator, then trains the model parameters within the generator after adjusting the discriminator's parameters. This interactive training achieves the optimal repair effect.
[0108] Target domain data repair phase
[0109] The purpose of the target domain data repair phase is to leverage the common knowledge learned from the source domain during the source domain data learning phase to further improve the model's repair performance in the target domain. To this end, the model uses a parameter sharing mechanism to transfer the model parameters learned in the source domain data learning phase to the model in the target domain data repair phase. MDTGAN's target domain data repair phase consists of three main modules: a target data preprocessing module, a target data repair generator, and a target discriminator.
[0110] Target data preprocessing module
[0111] Similar to the source domain data learning phase, the target domain data repair phase requires the model to perform relevant processing on the target domain data and features to obtain the model's traffic state input.
[0112] Specifically, node spatial encoding is the process of converting the original features e obtained from nodes using the node2vec method. v Then through the mapping function f v =M v (e v ;θ v ) to obtain f v The process of learning domain-invariant knowledge from source domain data during the learning phase is as follows: Here θ * (θ v This refers to adjusting the parameters initialized during the source domain data learning phase, while also adjusting them during the target domain data repair phase. Target node spatial feature extractor with the same structure but randomly initialized parameters To learn domain-specific knowledge, the process is as follows:
[0113] Target data repair generator
[0114] Similar to the learning phase for data from the same source domain, this framework aims to model the dynamic spatial relationships between nodes in the target network. By learning these dynamic spatial relationships, it extracts and represents important features and structures within the data, thereby gaining a better understanding of the data's inherent patterns. The framework utilizes the GAT network to deeply mine the potential spatial features between target data, as shown in the following formula:
[0115]
[0116]
[0117] in and Let W1, W2, and W3 represent the feature vectors of the i-th and j-th nodes. W1, W2, and W3 are trainable weight matrices, and || denotes the vector concatenation operation. This is achieved by adjusting the attention weights e. i,j Using the Sofotmax activation function, it is transformed into an attention coefficient α. i,j Then, the features of all neighboring nodes are summed to obtain the aggregated feature g of node i. i .
[0118] Subsequently, in the process of modeling temporal relationships, the GRU model is still used as the main framework, and the model parameters trained on the source domain data are transferred to the target domain model to avoid the tedious process of training the model from scratch on the target domain. This greatly saves time and computing resources and improves training efficiency. In addition, the source domain model has been trained on a large amount of data, and therefore has learned rich feature representations and knowledge. Transferring this knowledge to the target domain model can help the target domain model better learn and adapt to new data, thereby improving model performance.
[0119]
[0120] Among them, W u W r W c and U u U r U c Both are learnable parameter matrices, representing the hidden states of nodes at time t-1. and the node state input at time t Feature transformation is performed. σ represents the sigmoid activation function's ability to generate values between [0,1], used to generate update and reset gates. Unlike the source domain data learning phase which extracts hidden node features, the spatiotemporal information aggregation process incorporates additional spatial domain-specific features. Beyond common characteristics, different domains may also exhibit their own unique features and patterns. Domain-specific features often capture key information and patterns within the domain, which are crucial for improving prediction accuracy. By incorporating these features into the model, the model can more closely approximate the actual data distribution, thereby improving prediction precision. Therefore, their role in spatiotemporal restoration models is equally indispensable.
[0121] Output hidden state Finally, the missing location repair value is obtained after passing through the fully connected layer. Aiming to minimize the error between the actual and corrected values in the target network, unlike the domain discriminator module present in the source domain data learning phase, the generator's final loss function is expressed as follows:
[0122]
[0123] Where T represents the time length for data repair. This represents the set of nodes at the missing positions in a node sequence.
[0124] Target data repair generator
[0125] In this chapter, the input to the discriminator is the target domain repair data output by the generator. The discriminator model structure in the target domain data repair stage is the same as that in the source domain data learning stage, consisting of several stacked fully connected layers. The output is a probability function in the interval [0,1], and the mapping function is expressed as follows: During model training, the discriminator is first trained to maximize the probability of generating the mask matrix, and then the generator is trained to minimize the probability of generating the mask matrix. Therefore, the discriminator's loss function adopts the cross-entropy loss function, as illustrated below:
[0126]
[0127] Where T represents the time length for data repair, This represents the total number of nodes in the target domain. During the overall model training, the GAN first trains the discriminator, then trains the model parameters within the generator after adjusting the discriminator's parameters. This interactive training achieves the optimal repair effect.
Claims
1. A method for repairing traffic state data based on generative adversarial migration networks, characterized in that, Data training is conducted through a source domain data learning phase and a target domain data repair phase. In the source domain data learning phase, spatial information is encoded based on prior knowledge of the source traffic network, and the source domain spatial information is guided into domain-invariant features by a domain discriminator. Domain-invariant features, along with missing data, are used as input to the generator to produce complete data; The discriminator is used to distinguish between real and generated data, thereby improving the performance of the generator; then, in the target domain data repair stage, the parameters of the previously trained model are adjusted using the target domain data.
2. The traffic state data repair method based on generative adversarial migration network according to claim 1, characterized in that, The source domain data learning phase consists of a source data preprocessing module, a source data repair generator, a domain discriminator, and a source discriminator.
3. The traffic state data repair method based on generative adversarial migration network according to claim 2, characterized in that, The data preprocessing module encodes the collected static and dynamic information of the road network; the static information uses geographic location information to generate the original node features e. v Then, spatial relationship aggregation is performed on the original features of the nodes to obtain spatial coding information f. v For dynamic observation information, data missing information needs to be handled by using a randomly generated mask matrix. To simulate data loss scenarios in the real world, the missing locations in the mask matrix are preprocessed using the average value of node observations; Generate the original node features e using node2vec. v The Gin method with a local mean aggregator was used as a spatial encoder, and spatial features f were obtained through computation. v To obtain spatial coding information of different road network nodes; in This represents the iterative computation of a multilayer perceptron, with initial node spatial features. N (v) Let f represent the set of neighbors of node v. u ε represents the spatial characteristics of neighboring nodes. (k) It is a learnable parameter, k = 1, ..., K, representing the number of layers in the Gin network; after stacking multiple layers of the network, the final node spatial encoding information is obtained.
4. The traffic state data repair method based on generative adversarial migration network according to claim 2, characterized in that, In the source data repair generator, the deep learning model extracts and represents important features and structures in the data by learning dynamic spatial relationships; the model uses the GAT network to obtain the dynamic spatial correlation between nodes, as shown in the following formula: GAT receives node features representing the graph structure as input, where and Let W1 and W2 represent the feature vectors of the i-th and j-th nodes, respectively; W1 and W2 are trainable weight matrices, || denotes the vector concatenation operation, and the attention weights e are... i,j This represents the degree of attention node i has towards node j; N S This represents the set of neighbors of the source domain node i; By applying the softmax activation function to the attention weights, they are transformed into attention coefficients α. i,j The attention coefficient represents the normalized attention between node i and its neighbor node j, and is used to perform weighted aggregation of the features of neighbor nodes. Compute the aggregation feature g of node i i By using the attention coefficient α i,j Features g of neighboring nodes j By learning the weight matrix W3 and multiplying it, and then summing the features of all neighboring nodes, we obtain the aggregated feature g of node i. i ; The temporal relationship model will model temporal relationships at the node level, using nodes as the basic unit, and modeling all nodes in the road network one by one to expand to traffic data repair of the entire network. A GRU network will be used to model temporal relationships. f v and It will also participate in the GRU learning and update process by concatenating its dimensions with the hidden state from the previous time step, thereby achieving in-depth exploration of temporal and spatial correlations; the detailed formula is as follows: W u and U u Both are learnable parameter matrices, representing the hidden states of nodes at time t-1. and the node state input at time t Feature transformation is performed, where σ represents the sigmoid function, and b u It is a learnable bias vector; then it is passed through a σ function to produce a value between [0,1], representing the weight of the previous hidden state, i.e., the update gate. W r and U r Both are learnable parameter matrices, representing the hidden states of nodes at time t-1. and the node state input at time t Feature transformation is performed, where σ represents the sigmoid function, and b r It is a learnable bias vector; then it is passed through a σ function to produce a value between [0,1], representing the past information that needs to be discarded or retained, i.e., the reset gate. W c and U c Both are learnable parameter matrices, representing the hidden states of nodes at time t-1. And after the door was reset Node state input at time t Perform feature transformation, b c It is a learnable bias vector; the candidate hidden state is obtained by passing it through the tanh activation function. The current hidden state is generated by combining the output of the update gate with the previous hidden state and then weighting the reset hidden state candidates with the output of the update gate; node space encoding information f v Dynamic spatial correlation features obtained through GAT neural network layers The hidden state at time t is obtained by inputting it into the fully connected layer through dimension concatenation. Output hidden state Finally, the missing location repair value is obtained after passing through the fully connected layer. The aim is to minimize the error between the actual and corrected values in the source network, and its loss function is Loss. imp It is expressed as follows: Where T represents the time length for data repair. The set of nodes representing the missing positions in a node sequence; At this point, the generator's loss function is composed of the error loss function and the domain discriminator's loss function, and is ultimately expressed as follows: Here, λ is the adjustment coefficient; the first part represents the error between the repaired data and the real data in the source domain, while the second part represents the loss function of the domain discriminator.
5. A traffic state data repair method based on generative adversarial migration network according to claim 2, characterized in that, The domain discriminator uses node space encoded information f v As input, a fully connected layer and activation function are used to map the input to a probability distribution vector. And for the actual domain label d of the node v One-hot encoding is used; the domain labels include all source and destination domains; the domain label mapping function formula is as follows: Where FC represents a fully connected layer, FC(f v The output of ) is used to calculate the domain probability distribution of the nodes through an activation function; During training, parameters need to be optimized to maximize the classification loss. During backpropagation, a gradient reversal layer is used to pass the negative of the gradient to the previous layer. The loss function is Loss. dom Defined as follows in, This represents the set of all node spatial codes for the source and target datasets.
6. The traffic state data repair method based on generative adversarial migration network according to claim 2, characterized in that, The discriminator structure consists of several stacked fully connected layers, and its output is a probability function in the interval [0,1]. The mapping function is expressed as follows: During model training, the discriminator is first trained to maximize the probability of generating the mask matrix, and then the generator is trained to minimize the probability of generating the mask matrix. The discriminator's loss function uses the cross-entropy loss function, as illustrated below: Where T represents the time length for data repair, This represents the total number of nodes in the source domain. During the overall training of the model, GAN first trains the discriminator, and then trains the model parameters in the generator after adjusting the parameters of the discriminator. This interactive training achieves the best repair effect.
7. The traffic state data repair method based on generative adversarial migration network according to claim 1, characterized in that, The target domain data repair stage consists of a target data preprocessing module, a target data repair generator, and a target discriminator.
8. A traffic state data repair method based on generative adversarial migration network according to claim 7, characterized in that, During the target domain data repair phase, the model needs to perform relevant processing on the target domain data and features to obtain the model's traffic state input. Node spatial encoding converts the original features e obtained from nodes using the node2vec method. v Then through the mapping function f v =M v (e v ;θ v ) to obtain f v The process of learning domain-invariant knowledge from source domain data during the learning phase is as follows: Here θ * (θ v This refers to adjusting the parameters initialized during the source domain data learning phase, while also adjusting them during the target domain data repair phase. Target node spatial feature extractor with the same structure but randomly initialized parameters To learn domain-specific knowledge, the process is as follows:
9. A traffic state data repair method based on generative adversarial migration network according to claim 7, characterized in that, By learning dynamic spatial relationships to extract and represent important features and structures in the data, the framework utilizes the GAT network to deeply mine the potential spatial features between target data, as shown in the following formula: in and Let W1, W2, and W3 represent the feature vectors of the i-th and j-th nodes; W1, W2, and W3 are trainable weight matrices, and || represents the vector concatenation operation. This is achieved by adjusting the attention weights e. i,j Using the softmax activation function, it is transformed into an attention coefficient α. i,j Then, the features of all neighboring nodes are summed to obtain the aggregated feature g of node i. i ; In the process of modeling time-series relationships, the GRU model is still used as the main framework, and the model parameters trained on the source domain data are transferred to the target domain model; the source domain model is trained on a large amount of data. Among them, W u W r W c and U u U r U c Both are learnable parameter matrices, representing the hidden states of nodes at time t-1. and the node state input at time t Feature transformation is performed; σ represents the sigmoid activation function's ability to generate values between [0,1], used to generate update and reset gates; unlike the source domain data learning stage which extracts hidden node features, the spatiotemporal information aggregation process incorporates additional spatial domain-specific features. In addition to common characteristics, different domains also exhibit their own unique characteristics and patterns; by incorporating features into the model, the model can be made closer to the actual data distribution. Output hidden state Finally, the missing location repair value is obtained after passing through the fully connected layer. Unlike the domain discriminator module present in the source domain data learning phase, the generator's final loss function is expressed as follows: Where T represents the time length for data repair. This represents the set of nodes at the missing positions in a node sequence.
10. A traffic state data repair method based on generative adversarial migration network according to claim 7, characterized in that, The input to the discriminator is the target domain repair data output by the generator. The discriminator model structure in the target domain data repair stage is the same as that in the source domain data learning stage, consisting of several stacked fully connected layers. The output is a probability function in the interval [0,1], and the mapping function is expressed as follows: During model training, the discriminator is first trained to maximize the probability of generating the mask matrix, and then the generator is trained to minimize the probability of generating the mask matrix. The discriminator's loss function uses the cross-entropy loss function, as illustrated below: Where T represents the time length for data repair, This represents the total number of nodes in the target domain. During the overall training of the model, GAN first trains the discriminator, and then trains the model parameters in the generator after adjusting the parameters of the discriminator. This interactive training achieves the best repair effect.