A federated learning traffic prediction method based on traffic pattern classification
By employing a federated learning method based on traffic pattern classification, combined with cluster analysis and Gated Recurrent Unit (GRU) training, the problem of insufficient data utilization in traffic prediction by federated learning is solved, achieving high accuracy and high reliability in traffic prediction while protecting data privacy.
Patent Information
- Application Number
- CN202411356989.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-09-27
- Publication Date
- 2025-10-24
- Estimated Expiration
- 2044-09-27
AI Technical Summary
Existing federated learning traffic prediction methods suffer from several drawbacks when dealing with data differences and complex variations between different traffic data management centers. These drawbacks include the model's inability to effectively utilize the data, which affects the accuracy and reliability of the prediction results and poses a risk of data privacy breaches.
A federated learning approach based on traffic pattern classification is adopted. Different traffic patterns are identified through cluster analysis, a traffic pattern classification model of multilayer perceptron is constructed, and a gated recurrent unit (GRU) is used for training. The federated learning framework is combined to share and aggregate model parameters, screen samples with low uncertainty, and improve prediction accuracy and adaptability.
Effective integration of traffic data from different regions improves the accuracy and reliability of traffic forecasting, while protecting data privacy, adapting to dynamic changes in traffic patterns, and reducing data transmission and storage costs.
Smart Images

Figure CN119314329B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of traffic flow prediction, and particularly relates to a federated learning traffic prediction method based on traffic pattern classification. BACKGROUND
[0002] With the acceleration of urbanization and the rapid development of social economy, the number of private cars and public transportation tools is rapidly rising. Traffic congestion has become a major problem for urban residents traveling, especially during holidays and rush hours. Smart cities can greatly improve traffic conditions by using modern information technology, such as big data, the Internet of Things, cloud computing, and artificial intelligence, thereby improving urban travel efficiency. Real-time and effective traffic prediction is an important part of smart city traffic management. Through comprehensive analysis of traffic flow, speed, road conditions and other data, traffic prediction can provide scientific basis for traffic management departments to help them optimize traffic signals and vehicle distribution, thereby effectively improving traffic efficiency and reducing congestion time.
[0003] In intelligent transportation systems, accurate traffic flow prediction is crucial for traffic management and planning. Traditional traffic prediction methods mainly rely on statistical models, which have limitations in dealing with complex and dynamic traffic networks. In recent years, machine learning methods have gradually become a research hotspot in the field of traffic prediction. These methods not only have strong generalization ability, but also can capture and learn more complex nonlinear relationships, thereby better adapting to changing traffic conditions. In particular, the rapid development of deep learning technology makes it possible to build multi-level neural networks, thereby achieving unprecedented accuracy and robustness in traffic prediction. Secondly, many traffic flow deep learning prediction methods often rely on centralized data collection and processing, which not only poses a risk of data privacy leakage, but also is difficult to adapt to dynamic changes in traffic patterns. Federated learning allows devices to train prediction models locally without transmitting raw data to a centralized server. Each device only needs to share the model parameters obtained from its training. This method not only effectively reduces the cost of data transmission and storage, but also improves data privacy and security, as data remains on local devices, reducing the risk of data leakage.
[0004] However, federated learning faces challenges in building traffic prediction models, such as differences in data between different traffic data management centers and complex changes in data collected by traffic data management centers. This may result in the model being unable to effectively utilize data from different traffic data management centers, thereby affecting the accuracy and reliability of the prediction results. Although federated learning helps protect data privacy, it still has limitations in dealing with the complexity and diversity of traffic data, and further research and improvement of model construction methods are needed to adapt to actual application needs. SUMMARY
[0005] In view of the deficiencies of the prior art, the present application proposes a federated learning traffic prediction method based on traffic pattern classification, and the specific technical solutions are as follows:
[0006] A federated learning traffic prediction method based on traffic pattern classification, the method comprising the following steps:
[0007] S1: using a clustering algorithm to cluster the traffic data of the traffic data management center to be predicted, to identify different traffic patterns;
[0008] S2: according to the clustering result, constructing a label, and constructing a traffic pattern classification model based on a multilayer perceptron
[0009] r=f c (x;D A1 ,D A2 ,…,D Ai ,…,D AK )
[0010] Wherein, x represents the input traffic time series data, r represents the corresponding output category, D Ai represents the traffic data of the i-th category;
[0011] S3: sharing the model parameters of the traffic pattern classification model of the traffic data management center to be predicted to other traffic data management centers, and the other traffic data management centers classify the local traffic data according to the model parameters; using the classified data sets of each category to train a gated recurrent unit GRU according to a federated learning framework, to obtain the model parameters of the gated recurrent unit GRU of each category;
[0012] S4: classifying the future traffic flow of the traffic data management center to be predicted, and using the model parameters of the corresponding gated recurrent unit GRU to predict the future traffic flow of the traffic data management center to be predicted.
[0013] Further, in the S3, after the other traffic data management centers classify the local traffic data according to the model parameters, for each category of samples, the uncertainty of the sample classification result is calculated, and the effective samples with uncertainty lower than a threshold value are extracted;
[0014] Wherein, the calculation formula of the uncertainty is as follows:
[0015]
[0016] Wherein, p i represents the prediction probability of the model for category i; H is the entropy of quantifying uncertainty, and ∈ is a constant.
[0017] Further, the classified data sets of each category are used to train the gated recurrent unit GRU according to the federated learning framework, specifically including the following sub-steps:
[0018] (1) According to the shared model parameters of the traffic pattern classification model, the other traffic data management center divides the local traffic data into K categories, that is, the processed data D ij , i ∈ [1, N], j ∈ [1, K]; wherein N is the number of traffic data management centers;
[0019] (2) initialize the parameters of the K global models;
[0020] (3) share the parameters of the K global models in all traffic data management centers;
[0021] (4) each traffic data management center respectively trains the corresponding category of the gated recurrent unit GRU using its K categories of traffic data, and obtains the updated local model parameters;
[0022] (5) aggregate the updated local model parameters of all traffic data management centers to obtain the updated global model parameters;
[0023] (6) repeat steps (3) to (5) until the model converges, and obtain the model parameters of the gated recurrent unit GRU of each category.
[0024] Further, the loss function of the gated recurrent unit GRU trained by each traffic data management center using the classified data sets of each category is:
[0025]
[0026] Wherein, L ij represents the loss function of the jth category of the model trained by the ith traffic data management center, q ij represents the number of samples owned by the data D ij , x n represents the true value, represents the model prediction value; w ij represents the parameters of the jth category of the local model of the ith traffic data management center;
[0027] The expression of the updated local model parameters w i ′ j
[0028]
[0029] Wherein, w i ′ j denotes the updated model parameter of the jth type of data of the ith traffic data management center, and a denotes a learning rate.
[0030] Further, the calculation formula for aggregating the updated local model parameters of all traffic data management centers is as follows:
[0031]
[0032] wherein w g ′ j denotes the updated jth type of global model parameter.
[0033] Further, the hierarchical clustering method is used in S1, each data point is regarded as a separate cluster, the distance matrix between all clusters is calculated, the two clusters with the closest distance in the distance matrix are found, and the two clusters are merged into a new cluster; then, the distance matrix is updated to reflect the distance between the new cluster and other clusters; larger clusters are gradually formed through the iterative merging process.
[0034] Further, when training the gated recurrent unit GRU according to the federated learning framework using the classified data sets of each category, the loss function is minimized through the Adam algorithm.
[0035] The beneficial effects of the present application are as follows:
[0036] (1) In view of the distribution difference existing in different client data, the traffic prediction method of the present application identifies and deals with different traffic patterns through cluster analysis, thereby reducing the prediction inaccuracy caused by model aggregation due to data distribution when directly using federated learning;
[0037] (2) The present application combines federated learning with cluster analysis, and through the distributed data training mechanism of federated learning and the pattern recognition ability of cluster analysis, the data from different regions is integrated while ensuring privacy, the model can not only perform deep mining in different patterns, but also can improve the accuracy and adaptability of traffic prediction, and can better cope with the pattern changes in traffic time series data, thereby improving the accuracy and reliability of prediction. BRIEF DESCRIPTION OF DRAWINGS
[0038] Figure 1 is a schematic diagram of the traffic pattern-based classification model of the present application.
[0039] Figure 2 is a schematic diagram of the federated learning traffic prediction method based on traffic pattern classification of the present application. DETAILED DESCRIPTION
[0040] The present application will be described in detail below with reference to the accompanying drawings and preferred embodiments, the objects and effects of the present application will become more apparent, and it should be understood that the specific embodiments described herein are only intended to explain the present application and not to limit the present application.
[0041] The traffic prediction method based on traffic pattern classification of federated learning of the present application adopts the method of federated learning, and comprehensively utilizes traffic data from different regions. In addition, considering the mode change of traffic time series data, federated learning is combined with cluster analysis, which effectively overcomes the influence of data distribution difference.
[0042] As shown in Figure 1 The traffic prediction method based on traffic pattern classification of federated learning of the present application includes the following steps:
[0043] Step one: use clustering algorithm to cluster the traffic data of the traffic data management center to be predicted, to identify different traffic patterns.
[0044] In this embodiment, the clustering method adopted is hierarchical clustering, which does not need to specify the number of clusters in advance, but organizes data by constructing a cluster hierarchy; initially, each data point is regarded as a separate cluster, the distance matrix between all clusters is calculated, and the two clusters with the closest distance in the distance matrix are found and merged into a new cluster. Then, update the distance matrix to reflect the distance between the new cluster and other clusters. Larger clusters are gradually formed through the iterative merging process.
[0045] Of course, the clustering in step one can also use other clustering methods, such as K-means clustering.
[0046] Step two: according to the clustering result, construct a label, and construct a traffic pattern classification model based on multilayer perceptron
[0047] r=f c (x;D A1 ,D A2 ,…,D Ai ,…,D AK )
[0048] Where x represents the input traffic time series data, r represents the corresponding output category, and D Ai represents the traffic data of the i-th category.
[0049] Step three: share the model parameters of the traffic pattern classification model of the traffic data management center to be predicted to other traffic data management centers, and other traffic data management centers classify local traffic data according to the model parameters; utilize the classified data sets of each category to respectively train the gated recurrent unit GRU according to the federated learning framework, and obtain the model parameters of the gated recurrent unit GRU of each category.
[0050] Here, the sharing can be uploading the model parameters to the cloud, and other traffic data management centers (for example, B) downloading the model parameters from the cloud to establish a local classification model B. According to the classification model B and its local data B, the local data B can be classified, the classified data sets of each category are utilized to respectively train the gated recurrent unit GRU according to the federated learning framework, and the trained model parameters are uploaded to the corresponding server again. As shown in Figure 2 .
[0051] Among them, utilizing the classified data sets of each category to respectively train the gated recurrent unit GRU according to the federated learning framework specifically includes the following sub-steps:
[0052] (1) Other traffic data management centers divide local traffic data into K categories according to the shared model parameters of the traffic pattern classification model, that is, the processed data is D ij ,i∈[1,N],j∈[1,K];wherein N is the number of traffic data management centers;
[0053] (2) Initialize the parameters of K global models;
[0054] (3) Share the parameters of K global models in all traffic data management centers; for example, each traffic data management center downloads the parameters of the K global models from the corresponding server, and these parameters will be used for the initial setting of the local model to ensure that all traffic data management centers start from the same benchmark to perform the prediction task:
[0055] w ij =w gj ,i∈[1,N],j∈[1,K]
[0056] Among them, w ij represents the j-th local model parameter downloaded by the i-th traffic data management center, and w gj represents the j-th global model parameter on the server side.
[0057] (4) Each traffic data management center respectively trains the corresponding category of the gated recurrent unit GRU by using its K categories of traffic data to obtain updated local model parameters, so that the model can more accurately reflect the local traffic situation. During the training, the loss function is minimized by the Adam algorithm, and the calculation formula of the loss function is:
[0058]
[0059] wherein L ij represents the loss function of the jth type of data training model of the ith traffic data management center, q ij represents the data D ij owns the number of samples, x n represents the true value, represents the model prediction value; w ij represents the parameters of the jth type of local model of the ith traffic data management center.
[0060] the updated local model parameters w i ′ j The expression of w
[0061]
[0062] wherein w i ′ j represents the jth type of data local training updated model parameters of the ith traffic data management center, and a represents the learning rate.
[0063] (5) The updated local model parameters of all traffic data management centers are aggregated to obtain updated global model parameters of the corresponding category. For example, all traffic data management centers upload the local updated model parameters to the corresponding server. Each category server can obtain the latest model parameters w i ′ j of the corresponding category of each traffic data management center to perform further processing; after the server receives the updated parameters uploaded by all traffic data management centers, the parameters are aggregated and processed:
[0064]
[0065] wherein w g ′ j represents the updated jth type of global model parameters.
[0066] By aggregating the model parameters of all traffic data management centers, new global model parameters can be generated, thereby improving the accuracy and reliability of the entire traffic prediction system. The updated global model parameters will be distributed to each organization again to enter the next iteration cycle.
[0067] (6) Repeat steps (3) to (5) until the model converges to obtain the model parameters of the gating recurrent unit GRU of each category.
[0068] In addition, in order to screen samples of each category, the other traffic data management center, after classifying the local traffic data according to the model parameters, calculates the uncertainty of the sample classification result for each category of sample, extracts effective samples with uncertainty lower than a threshold, and updates each category of data set.
[0069] The calculation formula of the uncertainty is as follows:
[0070]
[0071] where p i represents the prediction probability of the model for category i; H is the entropy for quantifying uncertainty, and ∈ is a constant.
[0072] Step four: classifying the future traffic flow of the traffic data management center to be predicted, and using the model parameters of the corresponding category of gated recurrent unit GRU to predict the future traffic flow of the traffic data management center to be predicted.
[0073] The following is to illustrate the superiority of the method of the application in combination with a traffic data experiment. The experiment uses the METR-LA data set. The METR-LA data set records the traffic speed information of 207 loop detectors on the Los Angeles County freeway, and the recording time is from March 1, 2012 to June 30, 2012, and the data points are sampled every 5 minutes. In order to ensure the consistency and comparability of the data, we use the Z-score method to process the data. In the experiment of traffic speed prediction, we use the data of the past 12 time steps (i.e. 60 minutes) to predict the speed of the next 3 time steps (i.e. 15 minutes). This setting can capture short-term traffic trends and changes, thereby improving the accuracy of the prediction.
[0074] In order to make a comparison, the local model (Local) and the federal average model (Fedavg) are also used for traffic flow prediction, and the results are shown in Table 1.
[0075] Table 1 Experimental results of the federated learning traffic prediction method based on traffic pattern classification
[0076] Method Local Fedavg Ours RMSE 6.9916 7.0317 6.8932 R2 0.9014 0.9002 0.9041
[0077] As can be seen from the results shown in Table 1, the federated learning traffic prediction method based on traffic pattern classification of the application can effectively utilize the information of each data source while protecting the privacy of the data, thereby improving the overall performance of the model. By comparing the results with the Fedavg method, we can see that the federated learning traffic prediction method based on traffic pattern classification can effectively handle the complexity of traffic data, fully utilize the advantages of model aggregation, and improve the accuracy and reliability of the prediction.
[0078] Those skilled in the art can understand that the above description is only preferred examples of the application and is not used to limit the application. Although the application has been described in detail with reference to the foregoing examples, those skilled in the art can still make modifications to the technical solutions recorded in the foregoing examples, or make equivalent replacements to some of the technical features. Any modifications, equivalent replacements, and the like made within the spirit and principles of the application shall be included in the protection scope of the application.
Claims
1. A federated learning traffic prediction method based on traffic pattern classification, characterized in that, The method Comprise the following steps: S1: using a clustering algorithm to cluster the traffic data of the traffic data management center to be predicted to identify different traffic patterns; S2: according to the clustering result, construct a label, and construct a traffic pattern classification model based on a multilayer perceptron ; wherein, represents input traffic timing data, represents a corresponding output class, represents traffic data of the first class; S3: share the model parameters of the traffic pattern classification model of the traffic data management center to be predicted to other traffic data management centers, and classify the local traffic data according to the model parameters; train a gated recurrent unit GRU according to each category data set according to a federated learning framework, and obtain the model parameters of the gated recurrent unit GRU of each category; S4: classify the future traffic flow of the traffic data management center to be predicted, and use the model parameters of the corresponding gated recurrent unit GRU to predict the future traffic flow of the traffic data management center to be predicted.
2. The traffic pattern classification based federated learning traffic prediction method according to claim 1, wherein, In the S3, after the other traffic data management centers classify the local traffic data according to the model parameters, the uncertainty of the sample classification result is calculated for each category of sample, and the effective sample with uncertainty lower than a threshold is extracted; The calculation formula of the uncertainty is as follows: ; wherein, represents the predicted probability of the model for class i; is the entropy quantifying the uncertainty, is a constant; K represents the number of classes of the local traffic data.
3. The federated learning traffic prediction method based on traffic pattern classification according to claim 2, characterized in that, The gated recurrent unit GRU is trained according to each category data set according to a federated learning framework, and the specific steps are as follows: (1) other traffic data management centers divide local traffic data into K classes according to the model parameters of the shared traffic mode classification model, that is, the processed data is ; wherein N is the number of traffic data management centers; (2) initialize the parameters of K global models; (3) share the parameters of K global models in all traffic data management centers; (4) each traffic data management center respectively trains the corresponding gated recurrent unit GRU using its K categories of traffic data to obtain updated local model parameters; (5) aggregate the updated local model parameters of all traffic data management centers to obtain updated global model parameters; (6) repeat steps (3) ~ (5) until the model converges, and obtain the model parameters of the gated recurrent unit GRU of each category.
4. The federated learning traffic prediction method based on traffic pattern classification according to claim 3, characterized in that, The loss function of the gated recurrent unit GRU trained by each traffic data management center according to each category data set is: ; wherein, represents a loss function of the jth type of data training model of the ith traffic data management center, represents data owned by the ith traffic data management center, represents a true value, represents a model predicted value; represents a parameter of the jth type of local model of the ith traffic data management center; updated local model parameters The expression for is: ; wherein, denotes the updated model parameters of the jth type of data of the ith traffic data management center, denotes the learning rate.
5. The traffic pattern classification based federated learning traffic prediction method according to claim 1, wherein, The calculation formula of aggregating the updated local model parameters of all traffic data management centers is as follows: ; wherein, denotes the updated j-th global model parameter.
6. The traffic pattern classification based federated learning traffic prediction method according to claim 1, wherein, In the S1, a hierarchical clustering method is used, each data point is regarded as a separate cluster, the distance matrix between all clusters is calculated, the two clusters with the closest distance in the distance matrix are found, and the two clusters are merged into a new cluster; then, the distance matrix is updated to reflect the distance between the new cluster and other clusters; through the iterative merging process, larger clusters are gradually formed.
7. The traffic pattern classification based federated learning traffic prediction method according to claim 1, wherein, When the gated recurrent unit GRU is trained according to each category data set according to a federated learning framework, the loss function is minimized through the Adam algorithm.
Citation Information
Patent Citations
Federal learning method and system for classification prediction of connection data of Internet of Vehicles terminal
CN116227631A
Intelligent traffic management method for adjustment based on traffic flow
CN117351702A