Cross-city traffic state prediction method based on knowledge migration framework
By pre-training and fine-tuning in source cities with rich traffic data, combined with multi-graph network and meta-learning technology, the accuracy of traffic state prediction in limited data is solved, and accurate prediction of traffic state across cities is achieved, and enhanced The robustness and feature matching capabilities of the model are achieved.
Patent Information
- Application Number
- CN202410982715.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-07-22
- Publication Date
- 2024-11-12
AI Technical Summary
The existing traffic state prediction methods perform poorly when data is limited, especially in small and medium-sized cities, due to the lack of abundant traffic data, the model prediction performance is poor, and the existing models fail to make full use of multi-graph perspectives and feature adaptation, resulting in Cross-city forecasting is not effective.
Using a knowledge transfer framework method, the model is pre-trained in source cities with rich traffic data, combined with the feature matching weights of the source city and the target city, and the multi-graph network and meta-learning technology are used to migrate the model to the target city for fine-tuning. , thereby achieving accurate prediction of cross-city traffic conditions.
Through multi-graph perspective and feature matching technology, the robustness of the model and capture complex interactions are enhanced, the accuracy of traffic state prediction in the case of limited data is improved, the problem of single-dimensional feature extraction and mismatch is solved, and the problem of Accurate prediction of cross-city traffic status.
Smart Images

Figure CN118940888A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the intersection of data intelligent transportation and deep learning, and relates to a cross-city traffic status prediction method based on a knowledge transfer framework. Background Art
[0002] Traffic status prediction is an important part of the intelligent transportation system and plays a vital role in various smart city applications. Real-time and accurate traffic status prediction can help urban residents better plan their travel, and also help the government to formulate policies and use public resources reasonably, thereby reducing urban traffic congestion and improving the efficiency of urban transportation systems.
[0003] Although traffic status data is so important, due to differences in development and road construction among cities, there is a clear gap in the richness of traffic status data among cities: some megacities have rich traffic status data, while a considerable number of small and medium-sized cities have relatively scarce traffic status data.
[0004] Most of the existing traffic status prediction methods are based on the premise of sufficient data, that is, most of them are used to predict traffic status in urban road networks with rich traffic status data. At present, the main methods in this field can be roughly divided into three categories: statistical learning methods, machine learning methods, and deep learning methods. Statistical learning methods mainly include historical average (HA) method and autoregressive integrated moving average (ARIMA) method. However, these two methods have the disadvantages of limited ability to process complex data and poor generalization ability; machine learning methods mainly include support vector regression model and K-nearest neighbor (KNN) model. However, these two methods do not make full use of the rich contextual information and structural features in the road network; deep learning methods use more complex and advanced model combinations (graph convolution; attention mechanism, etc.) to achieve more accurate traffic status prediction. However, the above methods require a large amount of data for model training, and the performance of the model is often poor when the data is limited.
[0005] Limited data is a common problem in the process of traffic state prediction (it is difficult to collect data in cities without advanced digital infrastructure, and the high cost of deploying advanced digital infrastructure leads to less traffic data). In order to enable the traffic state prediction model to maintain good prediction performance under limited data, some researchers have begun to propose the use of migration methods to solve such problems. Such as the Meta-ST model and the ST-DAAN model. However, ① some models only consider the road network structure from a single graph perspective, without combining multiple graph perspectives. Some models consider the road network structure from a multi-graph perspective, but ignore the intrinsic connection between multi-graph networks. ② The existing models only perform simple pre-training and fine-tuning on the model, without considering the feature adaptation problem between the source city and the target city, resulting in poor generalization and interpretability of knowledge transfer, which in turn leads to poor results in cross-city traffic state prediction. Summary of the invention
[0006] In order to overcome the problem that the existing deep traffic prediction model has poor prediction performance under limited traffic data, the present invention provides a cross-city traffic status prediction method based on a knowledge transfer framework. First, the model is pre-trained in a source city with rich traffic data, and the feature matching weights of the source city and the target city are combined. Then, the model is migrated to the target city for fine-tuning using the transfer learning framework, thereby achieving real-time and accurate cross-city traffic status prediction.
[0007] The technical solution adopted by the present invention to solve its technical problem is:
[0008] A cross-city traffic status prediction method based on a knowledge transfer framework comprises the following steps:
[0009] Step 1: Based on geographical division: Divide the urban road network structure into a grid map, which is represented by W C ×H C , W C ,H C They are respectively represented as the latitude and longitude range of the city. Each grid in the grid map is called a region r. The grid maps constructed based on the source city and the target city are respectively represented as W S ×H S ,W T ×H T ;
[0010] Based on the grid map, the regions are modeled as nodes and the cities are modeled as graphs. Based on the connection relationship between regions and the road connection relationship, as well as the road information and traffic data between regions, a multi-graph network is constructed: a graph g is constructed based on the adjacency between regions. p , based on the road connectivity between regions, we construct a graph g r , we construct graph g based on the similarity of POI distribution between regions poi, based on the similarity of population mobility between regions, we construct a graph g s ,g d , the multi-graph networks constructed by the source city and the target city are represented as
[0011] Step 2: Multi-graph network based on the construction v∈{p,r,poi,s,d},C∈{S,T}, where express The multi-graph network is input into the feature extraction module, and processed by multi-layer graph convolution and instance attention mechanism to obtain the embedded features of each city. C∈{S,T};, where N C represents the number of urban areas, D emb Expressed as the corresponding number of embedding dimensions;
[0012] Step 3: Embedding features based on source cities and the embedded features of the target city Input both into the feature matching module: First, add corresponding position codes to the two embedded features to distinguish the sources of their respective features, thereby obtaining the feature Secondly, the self-attention mechanism and the interactive attention mechanism are used to Processing to obtain the generalized characteristics of the city Finally, the feature matching weight λ between the source city and the target city is calculated using the similarity calculation method. S,T ;
[0013] Step 4: Match weights based on features S,T , introduce it into the joint meta-learning module, the process is as follows:
[0014] ① Source training: Carry out corresponding traffic state prediction in the environment of the source city, randomly sample the training data of the source city in batches and input them into the corresponding deep traffic prediction model for traffic state prediction, and consider the matching weight λ in the loss calculation S,T Get the weighted loss and use the weighted loss to update the model parameters;
[0015] ② Simulated target fine-tuning: Based on the source training, internal fine-tuning is performed in the environment of the target city. The training data of the target city is randomly sampled in batches and input into the deep traffic prediction model to make corresponding traffic state predictions, and the model parameters are updated according to the error loss.
[0016] ③ Parameter update: Use the test data of the target city to evaluate the performance of the traffic prediction model, and then adjust the feature matching weight λ S,TThe evaluation is performed in two steps: source training and target fine-tuning. The test data of the target city is randomly sampled in batches and input into the corresponding deep traffic prediction model. The parameters of the feature extraction module, feature matching module and traffic prediction model are updated according to the joint loss.
[0017] Step 5: Final model fine-tuning in the target city: Perform traffic status prediction in the target city to achieve further parameter updates, thereby obtaining the optimal model parameters and achieving the most accurate cross-city traffic status prediction.
[0018] The technical concept of the present invention is: first, the source city and the target city are divided into corresponding grid maps by using the geographical division method; second, a multi-graph network is constructed based on the proximity relationship and road connectivity of the regions as well as the road information and traffic data between the regions. C∈{S,T}, and use it as the input of the feature extraction module; use multi-layer graph convolution and instance attention mechanism to process the multi-graph network, extract the embedded features of the city, and then input the embedded features of the city into the feature matching module. In the feature matching module: first add the corresponding position encoding to the embedded features of the city to distinguish the source of the feature, then use the self-attention mechanism and the interactive attention mechanism to process multiple times to obtain the generalized features of the city, and finally use the similarity calculation method to calculate the feature matching weights between the source city and the target city; secondly, introduce the matching weights into the joint meta-learning module, and use the three steps of source training, target fine-tuning, and parameter update to achieve the parameter update of the feature extraction module, feature matching module, and deep traffic prediction model, so as to complete the pre-training of the model and obtain a more complete traffic prediction model; finally, perform the final model fine-tuning in the target city to obtain a mature and complete traffic prediction model, so as to achieve accurate traffic status prediction in the target city with limited data, and then achieve accurate cross-city traffic status prediction.
[0019] The beneficial effects of the present invention are as follows: the road network structure is considered from a multi-graph perspective, and a corresponding multi-graph network is constructed based on the proximity relationship and road connectivity of the region and the road information and traffic data between regions. A feature extraction module based on a shared processing mechanism can realize the intrinsic connection between different graph networks, thereby enhancing the diversity and comprehensiveness of the data and improving the robustness of the model and capturing complex interactive relationships, thereby solving the problem of single feature extraction in existing methods; a feature matching module based on Linear Transformer can continuously fuse and match the embedded features of the source city and the embedded features of the target city to achieve the most relevant feature state of the source city and the target city, thereby calculating the feature matching weights between the source city and the target city, thereby solving the problem of feature mismatch in existing methods. The joint meta-learning module based on meta-learning technology refers to the feature matching weights of the source city and the target city to enable the model to utilize the most effective feature information, and uses the three steps of source training, target fine-tuning, and parameter updating to achieve pre-training of the model, thereby realizing dynamic matching and adjustment of the source city and the target city; the knowledge transfer framework based on meta-learning technology is an effective paradigm for modeling limited sample problems. It can use knowledge from the source task (traffic status prediction in data-rich cities) to improve learning in new tasks (traffic status prediction in data-scarce cities), thereby achieving accurate traffic status prediction in cities with limited data, and then providing convenient services for other downstream intelligent transportation work. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] Figure 1 It is the overall framework diagram.
[0021] Figure 2 It is a schematic diagram of the feature extraction module.
[0022] Figure 3 It is a schematic diagram of the feature matching module.
[0023] Figure 4 It is Linear; a schematic diagram of the internal structure of Transformer.
[0024] Figure 5 It is a schematic diagram of the joint meta-learning module.
[0025] Figure 6 This is a schematic diagram of the NY city structure.
[0026] Figure 7 This is a schematic diagram of the CHI city structure.
[0027] Figure 8 This is a schematic diagram of the DC city structure. DETAILED DESCRIPTION
[0028] The present invention is further described below in conjunction with the accompanying drawings.
[0029] Reference Figures 1 to 8 , a cross-city traffic status prediction method based on a knowledge transfer framework, comprising the following steps:
[0030] Step 1: Based on geographical division: Divide the urban road network structure into a grid map, which is represented by W C ×H C , W C ,H C They are respectively represented as the latitude and longitude range of the city. Each grid in the grid map is called a region r. The grid maps constructed based on the source city and the target city are respectively represented as W S ×H S ,W T ×H T ;
[0031] Based on the grid map, the regions are modeled as nodes and the cities are modeled as graphs. Based on the connection relationship between regions and the road connection relationship, as well as the road information and traffic data between regions, a multi-graph network is constructed: a graph g is constructed based on the adjacency between regions. p , based on the road connectivity between regions, we construct a graph g r , we construct graph g based on the similarity of POI distribution between regions poi , based on the similarity of population mobility between regions, we construct a graph g s ,g d , the multi-graph networks constructed by the source city and the target city are represented as
[0032] The process of step 1 is as follows:
[0033] Step 1.1: Basic setup of the city grid map
[0034] Based on the geographical division method, the urban road network structure is divided into corresponding grid maps, and the grid map is represented by W C ×H C , W C ;,H C They are respectively represented as the latitude and longitude range of the city, and the grid map of the source city is represented as W S ×H S , the grid map of the target city is represented by W T ×H T , each region is modeled as a node and the entire city is modeled as a graph;
[0035] Step 1.2: Basic setup of the task
[0036] Given the traffic status data of each area in the source city S and the target city T It is used to predict the traffic status data of each area in the target city, that is, the pick-up and drop-off volume. The formula is as follows:
[0037]
[0038] where F θ (·) represents the deep traffic prediction model, represents the traffic status data of area r at time t-1;
[0039] Step 1.3: Construction of a multi-graph network, including a topological graph network and a logical graph network
[0040] Step 1.3.1: Construction of topology network, the process is as follows;
[0041] Step 1.3.1.1: Construction of the region proximity graph
[0042] Based on the corresponding grid map, adjacent regions are connected according to the adjacency relationship between regions, so as to construct the corresponding regional proximity map. The regional proximity graphs constructed by the source city and the target city are respectively expressed as
[0043] Step 1.3.1.2: Construction of road connection map
[0044] Based on the corresponding grid map, the connection relationship between regions is established according to whether there is a direct highway between regions, so as to construct the corresponding road connection map The road connection graphs constructed by the source city and the target city are respectively represented as
[0045] Step 1.3.2: Construction of the logical graph network. The process is as follows:
[0046] Step 1.3.2.1: Construction of Poi similarity graph
[0047] Based on the corresponding grid map, for a given region r, the connection relationship is constructed according to the cosine similarity of the POI distribution between each region. Region r is connected with the first k regions with the highest cosine similarity value. The calculation formula is shown below:
[0048]
[0049] in Represents region r i Therefore, the PoI similarity graphs constructed by the source city and the target city are expressed as
[0050] Step 1.3.2.2: Construction of population flow similarity graph
[0051] Based on the grid map constructed by the source city and the target city, for a given region r, this patent constructs a connection relationship based on the similarity of population mobility between regions, and establishes an edge relationship with the top k regions with high population mobility similarity values. The calculation formula for the distribution of population inflow and outflow and the similarity value of population mobility is as follows:
[0052]
[0053] V s =KL(s(r i ),s(r j )) (5)
[0054] V d =KL(d(r i ),d(r j )) (6)
[0055] Where s(r i |r) represents region r i The population outflow distribution of the source city and the target city is expressed as follows:
[0056] The multi-graph networks constructed by the source city and the target city are expressed as
[0057] Step 2: Multi-graph network based on the construction v∈{p,r,poi,s,d},C∈{S,T}, where express The multi-graph network is input into the feature extraction module, and processed by multi-layer graph convolution and instance attention mechanism to obtain the embedded features of each city. C∈{S,T};, where N C represents the number of urban areas, D emb Expressed as the corresponding number of embedding dimensions;
[0058] The process of step 2 is as follows:
[0059] Step 2: Extraction of embedding features
[0060] Multi-graph network based on construction C∈{S,T}, which is used as the input of the feature extraction module, which consists of a multi-layer graph convolutional network and an instance attention layer;
[0061] The multi-layer graph convolutional network is designed as a GNN model consisting of three GraphSAGE layers. There is a SAGPool after each GraphSAGE layer. The average pooled embedding and the maximum pooled embedding of the graph nodes after each SAGPool are connected, and the embeddings of different pooling layers are added together and then passed through the multi-layer perceptron MLP to obtain the embedding features of each graph network. In order to reflect the homogeneity of multiple graph networks, the first layer of graph convolution in the GNN model is set to predefined. In order to reflect the heterogeneity of multiple networks, the remaining graph convolutions in the GNN model are set to learnable. The formula is as follows:
[0062]
[0063]
[0064] in Represents node V i Embedding before and after the convolutional layer, W s is the weight matrix shared across modal branches, W m is the weight matrix specific to the current modal branch, Connect to node V for the current mode i The set of K is size;
[0065] According to the above formulas (7)-(11), the embedding features of different graph networks are obtained. In order to pay more attention to the embedding features of a specific graph network and dynamically weigh the embedding features of the graph network, after multi-layer graph convolution processing, the instance attention mechanism is used to process the embedding features. The formula is as follows:
[0066]
[0067] in For input data The feature representation of (the current n city n∈(S,T), m graph modality m∈(p,r,poi,s,d), the i-th data input), C(n,m) is the number of data inputs in a specific city n and a specific modality m, W is a learnable matrix, and σ is the sigmoid nonlinear activation function;
[0068] After multi-layer graph convolution and attention mechanism processing, the embedded features of the multi-graph network of the source city and the target city are obtained. C∈{S,T};
[0069] Embedding features based on the obtained multi-graph network C∈{S,T}, and then perform a concatenation operation to concatenate the multi-image embedding features together. The formula is as follows.
[0070]
[0071] Concat represents the concatenation operation, and finally the city’s embedded feature Φ is obtained. C ;
[0072] Step 3: Embedding features based on source cities and the embedded features of the target city Input both into the feature matching module: First, add corresponding position codes to the two embedded features to distinguish the sources of their respective features, thereby obtaining the feature Secondly, the self-attention mechanism and the interactive attention mechanism are used to Processing to obtain the generalized characteristics of the city Finally, the feature matching weight λ between the source city and the target city is calculated using the similarity calculation method. S,T ;
[0073] The process of step 3 is as follows:
[0074] Step 3.1: Extraction of generalization features
[0075] Based on the embedded features of the source city and the target city It is input into the subsequent feature matching module, which includes the self-attention and interactive attention models built based on Linear_Transformer;
[0076] First, add position encoding to the embedded features To distinguish the source of features, the formula is as follows.
[0077]
[0078] Among them, pos represents the position, i represents the dimension index, and d represents the number of embedding dimensions, thereby obtaining the embedding feature
[0079] Secondly, the corresponding self-attention mechanism and interactive attention mechanism are used to embed the features The processing formula is as follows:
[0080]
[0081]
[0082] ouput1=attention_scores1*V1 (19)
[0083]
[0084] ouput2=attention_scores2*V2 (24)
[0085]
[0086] in They are all learnable parameter matrices. Softmax represents the normalization operation, and LayerNorm represents the layer normalization operation. The generalized features of the source city and the target city are obtained.
[0087] Step 3.2: Calculate matching weights
[0088] Based on the generalized features of the source and target cities The cosine similarity calculation method is used to quantify the degree of feature matching between the source city and the target city. The formula is shown below.
[0089]
[0090] CosSim(·) represents the cosine similarity calculation, and obtains the feature matching weight λ between the source city and the target city S,T , and introduce it into the subsequent joint meta-learning module.
[0091] Step 4: Match weights based on features S,T , introduce it into the joint meta-learning module, the process is as follows:
[0092] ④ Source training: Perform corresponding traffic state prediction in the environment of the source city, randomly sample the training data of the source city in batches and input them into the corresponding deep traffic prediction model for traffic state prediction, and consider the matching weight λ in the loss calculation S,T Get the weighted loss and use the weighted loss to update the model parameters;
[0093] ⑤ Simulation target fine-tuning: Based on the source training, internal fine-tuning is performed in the environment of the target city. The training data of the target city is randomly sampled in batches and input into the deep traffic prediction model to make corresponding traffic state predictions, and the model parameters are updated according to the error loss.
[0094] ⑥ Parameter update: Use the test data of the target city to evaluate the performance of the traffic prediction model, and then adjust the feature matching weight λ S,T The evaluation is performed in two steps: source training and target fine-tuning. The test data of the target city is randomly sampled in batches and input into the corresponding deep traffic prediction model. The parameters of the feature extraction module, feature matching module and traffic prediction model are updated according to the joint loss.
[0095] The process of step 4 is as follows:
[0096] Step 4: Joint meta-learning module. Meta-learning technology provides a good basic framework for transfer learning, enabling the model to quickly adapt to new tasks and predict traffic conditions in target cities with limited data.
[0097] Step 4.1: Simulate source training
[0098] Based on feature matching weight λ S,T ,; Carry out source training, perform traffic state prediction in the source city with rich data, select the deep traffic state prediction model and randomly initialize the model parameters. The process is as follows:
[0099] In the context of selecting a deep traffic state prediction model, the prediction task is completed according to the input requirements of the model: within a certain number of iterations, the training data corresponding to the random batch sampling is input into the prediction model to obtain the prediction output, combined with the matching weight λ between the source city and the target city S,T Calculate the weighted loss and then update the model parameters through the gradient descent algorithm. The formula is as follows:
[0100]
[0101] Where L represents the absolute error function, Represents the source city area r S The predicted value and the true value at time t;
[0102] After the above operations, the source training process is completed and the model training parameters of this process are saved;
[0103] Step 4.2: Target fine-tuning
[0104] Based on the source training, the corresponding target fine-tuning is performed to predict the traffic status in the target city with limited data. At this time, the parameters of the traffic status prediction model will be initialized based on the training parameters in the previous text. The process is as follows:
[0105] Within a certain number of iterations, the training data is randomly sampled and input into the prediction model to obtain the corresponding prediction output and calculate the corresponding error loss, and the model parameters are updated according to the gradient descent algorithm. The formula is as follows:
[0106]
[0107] Where L represents the absolute error function, Represent the target city area r T The predicted value and the true value at time t;
[0108] After fine-tuning the target, we have preliminarily realized the use of the knowledge transfer framework to predict traffic status in target cities with limited data;
[0109] Step 4.3: Parameter Update
[0110] Based on source training and target fine-tuning, parameter updates are performed. The process is as follows:
[0111] Within a certain number of iterations, the test data in the target city is randomly sampled and input into the prediction model to obtain the prediction output, and the corresponding error loss is calculated. The three steps of source training, target fine-tuning, and model evaluation are an overall progressive process. Therefore, when the evaluation effect is not good, the parameters of the network module must be updated from the beginning; the parameters of the feature extraction module, feature matching module, and traffic prediction model are updated according to the joint error loss and gradient descent algorithm. The formula is shown below.
[0112]
[0113] L meta =λ1*L S (X S ,θ;λ S,T )+λ2*L T (X T ,θ;θ(λ S,T ))+λ3*L T (X T ,θ;θ T (λ S,T ))(32)
[0114]
[0115] where θ S Represents the parameter set of all models such as the feature extraction module and feature matching module mentioned above;
[0116] Through repeated iterative training of the above steps, the pre-training process of the traffic prediction model is realized, thereby obtaining a more complete traffic state prediction model.
[0117] Step 5: Final model fine-tuning in the target city: Based on the previous operations, traffic status prediction is performed in the target city to achieve further parameter updates, so as to obtain the optimal model parameters and achieve the most accurate cross-city traffic status prediction.
[0118] The process of step 5 is as follows:
[0119] Step 5: Final fine-tuning of the model
[0120] The knowledge transfer framework based on meta-learning technology is divided into two steps: pre-training and fine-tuning. The pre-training process has been completed through the previous operation process. The final fine-tuning process of the model is as follows:
[0121] Carry out corresponding traffic status prediction in the target city, batch sample training data for model training, batch sample test data for model verification, and perform final model fine-tuning based on the corresponding error loss and gradient update algorithm. The formula is shown below.
[0122]
[0123] After the final model fine-tuning, the fine-tuning process is completed and a perfect traffic status prediction model is obtained, so as to achieve accurate traffic status prediction in the target city with limited data, and then achieve accurate cross-city traffic status prediction.
[0124] Example: The data in the actual experiment, the process is as follows:
[0125] (1) Select experimental data
[0126] The experimental data of this patent is based on taxi data and bicycle data from three cities in the United States: New York (NY), Chicago (CHI), and Washington (DC). The time range of each data set is one year (2016.1.1-2016.12.31), and the time interval is 1 hour. This patent divides the three cities into 1km×1km grid areas. For the distribution of POIs in the area, this patent selects 14 types including scenic spots, medical services, housekeeping services, residential areas, financial institutions, sports and leisure services, cultural and educational services, shopping, accommodation services, government and organizations, company catering, transportation, and public services.
[0127] (2) Parameter determination
[0128] New York (NY) and Chicago (CHI) are selected as source cities, and Washington (DC) is selected as the target city. The urban road network is as follows: Figure 6 , 7, 8. The same data set settings are used for both the source city and the target city: two months of data are used as training sets, two months of data are used as validation sets, and the remaining eight months of data are used as test sets.
[0129] The deep learning model of the present invention is built based on the Pytorch environment. The specific parameters of the model are: the dimension D of the multi-graph embedding feature emb is 64. The number of edge relationships k in multi-graph construction is 10. The number of training iterations of the joint meta-learning module is 800, the number of training iterations of the final fine-tuning of the model is 64, the prediction period is 6h (the historical 6h traffic status data predicts the future 1h traffic status data), batch_size=32, the optimizer is Adam, and the update rate is 0.001.
[0130] (3) Experimental results
[0131] The purpose of this invention is to predict the population pick-up and drop-off volume in each area of the target city with limited prediction data, and corresponding experiments are carried out in three real road network data sets. This experiment uses the mean absolute error (MAE) and the root mean square error (RMSE) as evaluation indicators. This experiment selects the following benchmark models: classic deep learning models LSTM, CNN, ARIMA, DCRNN, STNet, GMAN, ETGCN; classic transfer learning models MetaST, ST-DAAN. For the feature extraction model based on the shared context processing mechanism and the feature matching module based on Linear; Transformer proposed in this paper, corresponding ablation experiments were carried out using the control variable method. Corresponding parameter selection experiments were carried out for some important hyperparameters in the model. The experimental results are shown in the following figure (table). It can be seen that the knowledge transfer framework proposed in this paper achieves more accurate traffic status prediction in the target city with limited data, and as a framework, it can match various traffic prediction models well.
Claims
1. A cross-city traffic status prediction method based on knowledge transfer framework, It is characterized in that The method comprises the following steps: Step 1: Based on geographical division: Divide the urban road network structure into a grid map, which is represented by W C ×H C , W C ,H C They are respectively represented as the latitude and longitude range of the city. Each grid in the grid map is called a region r. The grid maps constructed based on the source city and the target city are respectively represented as W S ×H S ,W T ×H T ; Based on the grid map, the regions are modeled as nodes and the cities are modeled as graphs. Based on the connection relationship between regions and the road connection relationship, as well as the road information and traffic data between regions, a multi-graph network is constructed: a graph g is constructed based on the adjacency between regions. p , based on the road connectivity between regions, we construct a graph g r , we construct graph g based on the similarity of POI distribution between regions poi , based on the similarity of population mobility between regions, we construct a graph g s ,g d , the multi-graph networks constructed by the source city and the target city are represented as Step 2: Multi-graph network based on the construction v∈{p,r,poi,s,d},C∈{S,T}, where express The multi-graph network is input into the feature extraction module, and processed by multi-layer graph convolution and instance attention mechanism to obtain the embedded features of each city. C∈{S,T};, where N C represents the number of urban areas, D emb Expressed as the corresponding number of embedding dimensions; Step 3: Embedding features based on source cities and the embedded features of the target city Input both into the feature matching module: First, add corresponding position codes to the two embedded features to distinguish the sources of their respective features, thereby obtaining the feature Secondly, the self-attention mechanism and the interactive attention mechanism are used to Processing to obtain the generalized characteristics of the city Finally, the feature matching weight λ between the source city and the target city is calculated using the similarity calculation method. S,T ; Step 4: Match weights based on features S,T , introduce it into the joint meta-learning module, the process is as follows: ① Source training: Carry out corresponding traffic state prediction in the environment of the source city, randomly sample the training data of the source city in batches and input them into the corresponding deep traffic prediction model for traffic state prediction, and consider the matching weight λ in the loss calculation S,T Get the weighted loss and use the weighted loss to update the model parameters; ② Simulated target fine-tuning: Based on the source training, internal fine-tuning is performed in the environment of the target city. The training data of the target city is randomly sampled in batches and input into the deep traffic prediction model to make corresponding traffic state predictions, and the model parameters are updated according to the error loss. ③ Parameter update: Use the test data of the target city to evaluate the performance of the traffic prediction model, and then adjust the feature matching weight λ S,T The evaluation is performed in two steps: source training and target fine-tuning. The test data of the target city is randomly sampled in batches and input into the corresponding deep traffic prediction model. The parameters of the feature extraction module, feature matching module and traffic prediction model are updated according to the joint loss. Step 5: Final model fine-tuning in the target city: Perform traffic status prediction in the target city to achieve further parameter updates, thereby obtaining the optimal model parameters and achieving the most accurate cross-city traffic status prediction.
2. The cross-city traffic status prediction method based on the knowledge transfer framework as claimed in claim 1, It is characterized in that The process of step 1 is as follows: Step 1.1: Basic setup of the city grid map Based on the geographical division method, the urban road network structure is divided into corresponding grid maps, and the grid map is represented by W C ×H C , W C ;,H C They are respectively represented as the latitude and longitude range of the city, and the grid map of the source city is represented as W S ×H S , the grid map of the target city is represented by W T ×H T , each region is modeled as a node and the entire city is modeled as a graph; Step 1.2: Basic setup of the task Given the traffic status data of each area in the source city S and the target city T It is used to predict the traffic status data of each area in the target city, that is, the pick-up and drop-off volume. The formula is as follows: Among them, F θ (·) represents the deep traffic prediction model, represents the traffic status data of area r at time t-1; Step 1.3: Construction of a multi-graph network, the multi-graph network includes a topological graph network and a logical graph network. Step 1.3.1: Construction of a topological graph network, the process is as follows; Step 1.3.1.1: Construction of the region proximity graph Based on the corresponding grid map, adjacent regions are connected according to the adjacency relationship between regions, so as to construct the corresponding regional proximity map. The regional proximity graphs constructed by the source city and the target city are respectively expressed as Step 1.3.1.2: Construction of road connection map Based on the corresponding grid map, the connection relationship between regions is established according to whether there is a direct highway between regions, so as to construct the corresponding road connection map The road connection graphs constructed by the source city and the target city are respectively expressed as Step 1.3.2: Construction of the logical graph network. The process is as follows: Step 1.3.2.1: Construction of Poi similarity graph Based on the corresponding grid map, for a given region r, the connection relationship is constructed according to the cosine similarity of the POI distribution between each region. Region r is connected with the first k regions with the highest cosine similarity value. The calculation formula is shown below: in Represents region r i Therefore, the PoI similarity graphs constructed by the source city and the target city are expressed as Step 1.3.2.2: Construction of population flow similarity graph Based on the grid map constructed by the source city and the target city, for a given region r, this patent constructs a connection relationship based on the similarity of population mobility between regions, and establishes an edge relationship with the top k regions with high population mobility similarity values. The calculation formula for the distribution of population inflow and outflow and the similarity value of population mobility is as follows: V s =KL(s(r i ),s(r j )) (5) V d =KL(d(r i ),d(r j )) (6) Where s(r i |r) represents region r i The population outflow distribution of the source city and the target city is expressed as follows: The multi-graph networks constructed by the source city and the target city are expressed as 3. The cross-city traffic status prediction method based on the knowledge transfer framework as claimed in claim 1 or 2, It is characterized in that The process of step 2 is as follows: Step 2: Extraction of embedding features Multi-graph network based on construction This is used as the input of the feature extraction module, which consists of a multi-layer graph convolutional network and an instance attention layer; The multi-layer graph convolutional network is designed as a GNN model consisting of three GraphSAGE layers. There is a SAGPool after each GraphSAGE layer. The average pooled embedding and the maximum pooled embedding of the graph nodes after each SAGPool are connected, and the embeddings of different pooling layers are added together and then passed through the multi-layer perceptron MLP to obtain the embedding features of each graph network. In order to reflect the homogeneity of multiple graph networks, the first layer of graph convolution in the GNN model is set to predefined. In order to reflect the heterogeneity of multiple networks, the remaining graph convolutions in the GNN model are set to learnable. The formula is as follows: in Represents node V i Embedding before and after the convolutional layer, W s is the weight matrix shared across modal branches, W m is the weight matrix unique to the current modal branch, N Vi Connect to node V for the current mode i The set of K is size; According to formulas (7)-(11), the embedding features of different graph networks are obtained. In order to pay more attention to the embedding features of a specific graph network and dynamically weigh the embedding features of the graph network, after multi-layer graph convolution processing, the instance attention mechanism is used to process the embedding features. The formula is as follows: in For input data The feature representation of (the current n city n∈(S,T), m graph modality m∈(p,r,poi,s,d), the i-th data input), C(n,m) is the number of data inputs in a specific city n and a specific modality m, W is a learnable matrix, and σ is the sigmoid nonlinear activation function; After multi-layer graph convolution and attention mechanism processing, the embedded features of the multi-graph network of the source city and the target city are obtained. Based on the embedded features of the obtained multi-graph network Then perform the splicing operation to splice the multi-image embedding features together. The formula is as follows: Concat represents the concatenation operation, and finally the city’s embedded feature Φ is obtained. C .
4. The cross-city traffic status prediction method based on the knowledge transfer framework as claimed in claim 3, It is characterized in that The process of step 3 is as follows: Step 3.1: Extraction of generalization features Based on the embedded features of the source city and the target city It is input into the subsequent feature matching module, which includes the self-attention and interactive attention models built based on Linear_Transformer; First, add position encoding to the embedded features To distinguish the source of the features, the formula is as follows: Among them, pos represents the position, i represents the dimension index, and d represents the number of embedding dimensions, thereby obtaining the embedding feature Secondly, the corresponding self-attention mechanism and interactive attention mechanism are used to embed the features The processing formula is as follows: ouput 1 =attention_scores 1 *V 1 (19) ouput 2 =attention_scores 2 *V 2 (24) in They are all learnable parameter matrices. Softmax represents the normalization operation, and LayerNorm represents the layer normalization operation. The generalized features of the source city and the target city are obtained. Step 3.2: Calculate matching weights Based on the generalized features of the source and target cities The cosine similarity calculation method is used to quantify the degree of feature matching between the source city and the target city. The formula is as follows: CosSim(·) represents the cosine similarity calculation, and obtains the feature matching weight λ between the source city and the target city S,T , and introduce it into the subsequent joint meta-learning module.
5. The cross-city traffic status prediction method based on the knowledge transfer framework as claimed in claim 4, It is characterized in that The process of step 4 is as follows: Step 4: Joint meta-learning module. Meta-learning technology provides a good basic framework for transfer learning, enabling the model to quickly adapt to new tasks and predict traffic conditions in target cities with limited data. Step 4.1: Simulate source training Based on feature matching weight λ S,T ,; Carry out source training, perform traffic state prediction in the source city with rich data, select the deep traffic state prediction model and randomly initialize the model parameters. The process is as follows: In the context of selecting a deep traffic state prediction model, the prediction task is completed according to the input requirements of the model: within a certain number of iterations, the training data corresponding to the random batch sampling is input into the prediction model to obtain the prediction output, combined with the matching weight λ between the source city and the target city S,T Calculate the weighted loss and then update the model parameters through the gradient descent algorithm. The formula is as follows: Where L represents the absolute error function, Represents the source city area r S The predicted value and the true value at time t; After the above operations, the source training process is completed and the model training parameters of this process are saved; Step 4.2: Target fine-tuning Based on the source training, the corresponding target fine-tuning is performed to predict the traffic status in the target city with limited data. At this time, the parameters of the traffic status prediction model will be initialized based on the training parameters in the previous text. The process is as follows: Within a certain number of iterations, the training data is randomly sampled and input into the prediction model to obtain the corresponding prediction output and calculate the corresponding error loss, and the model parameters are updated according to the gradient descent algorithm. The formula is as follows: Where L represents the absolute error function, Represent the target city area r T The predicted value and the true value at time t; After fine-tuning the target, we have preliminarily realized the use of the knowledge transfer framework to predict traffic status in target cities with limited data; Step 4.3: Parameter Update Based on source training and target fine-tuning, parameter updates are performed. The process is as follows: Within a certain number of iterations, the test data in the target city is randomly sampled and input into the prediction model to obtain the prediction output, and the corresponding error loss is calculated. The three steps of source training, target fine-tuning, and model evaluation are an overall progressive process. Therefore, when the evaluation effect is not good, the parameters of the network module must be updated from the beginning; the parameters of the feature extraction module, feature matching module, and traffic prediction model are updated according to the joint error loss and gradient descent algorithm. The formula is as follows: L meta =λ 1 *L S (X S ,θ;λ S,T )+λ 2 *L T (X T ,θ;θ(λ S,T ))+λ 3 *L T (X T ,θ;θ T (l S,T ))(32) where θ S Represents the parameter set of all models such as the feature extraction module and feature matching module mentioned above; Through repeated iterative training of the above steps, the pre-training process of the traffic prediction model is realized, thereby obtaining a more complete traffic state prediction model.
6. The cross-city traffic status prediction method based on the knowledge transfer framework as claimed in claim 5, It is characterized in that The process of step 5 is as follows: Step 5: Final fine-tuning of the model The knowledge transfer framework based on meta-learning technology is divided into two steps: pre-training and fine-tuning. The pre-training process has been completed through the previous operation process. The final fine-tuning process of the model is as follows: Carry out corresponding traffic status prediction in the target city, batch sample training data for model training, batch sample test data for model verification, and perform final model fine-tuning based on the corresponding error loss and gradient update algorithm. The formula is as follows: After the final model fine-tuning, the fine-tuning process is completed and a perfect traffic status prediction model is obtained, so as to achieve accurate traffic status prediction in the target city with limited data, and then achieve accurate cross-city traffic status prediction.
