Joint learning model training method and device based on cluster-driven mode
By adopting a cluster-driven approach in joint learning, local data is clustered and uploaded to the cluster center for joint learning model training. This solves the model training problem caused by data heterogeneity and achieves efficient data privacy protection and improved model generalization performance.
Patent Information
- Application Number
- CN202210583625.X
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-25
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2042-05-25
AI Technical Summary
In collaborative learning, the heterogeneity of data among the participants leads to slow model training convergence and poor generalization performance. Furthermore, due to privacy concerns, the participants are unwilling to share data, making it difficult for existing technologies to effectively address this issue.
A cluster-driven approach is adopted to cluster local data, obtain cluster centers, and upload them to the server. The server aggregates the data and feeds it back to the client for joint learning model training until preset conditions are met. Training is then stopped and combined with a load prediction model to ensure data privacy protection.
It effectively solves the problems of slow model training convergence speed and poor generalization performance caused by data heterogeneity, while protecting the data privacy of all parties involved and improving the efficiency and effectiveness of model training.
Smart Images

Figure CN117195009B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present disclosure relates to the technical field of federated learning, and particularly relates to a federated learning model training method and device based on a clustering driven mode. BACKGROUND
[0002] Federated learning is generally composed of participants and a central server. Each participant has its own local data and participates in the training of a federated learning model using its own local data. Since the local data of each participant is generally distributed in each participant's local (i.e., different data sources), the data from different sources usually has the problem of inconsistent data distribution (i.e., data heterogeneity). If each participant directly uses its own local data to participate in the training of a federated learning model, the established model cannot well fit the existing data, the model converges slowly and has poor generalization performance. Although training the local data of each participant together can solve the problem of poor generalization ability of the established model caused by data heterogeneity to some extent, many participants are reluctant to share their data due to the consideration of protecting their data privacy.
[0003] Therefore, there is an urgent need to provide a method for solving the problem of slow convergence of model training and poor generalization performance of the established model caused by data heterogeneity of each participant in the case of effectively protecting the data privacy of each participant. SUMMARY
[0004] In view of this, the embodiments of the present disclosure provide a federated learning model training method and device based on a clustering driven mode to solve the problem of slow convergence of model training and poor generalization performance of the established model caused by data heterogeneity of each participant in the case of effectively protecting the data privacy of each participant.
[0005] In a first aspect, the embodiments of the present disclosure provide a federated learning model training method based on a clustering driven mode, comprising:
[0006] The client:
[0007] responds to federated learning model training;
[0008] using a preset clustering method, performing data clustering on the local data and obtaining cluster centers, and uploading the cluster centers to the server;
[0009] When receiving the aggregated cluster centers obtained by aggregating the plurality of cluster centers fed back by the server, performing federated learning model training on the local data;
[0010] stop training to obtain the cluster-driven model when the joint learning model training using the local data reaches a preset condition; the preset condition is that an iteration number is met or the cluster centers no longer change;
[0011] train the load prediction model according to the cluster-driven model;
[0012] in response to feedback of the server;
[0013] perform local training on the load prediction model until a convergence condition is reached to obtain a target joint learning model.
[0014] A second aspect of the embodiments of the present disclosure provides a joint learning model training method based on a cluster-driven mode, including:
[0015] the server:
[0016] receive cluster centers sent by multiple clients;
[0017] aggregate the cluster centers sent by the multiple clients to obtain aggregated cluster centers;
[0018] send the aggregated cluster centers to each client;
[0019] respond to feedback information of each client, the feedback information including training model parameters of the load prediction model;
[0020] perform attention aggregation on the training model parameters of the load prediction model sent by the multiple clients to obtain global model parameters of the load prediction model;
[0021] distribute the global model parameters of the load prediction model to each client.
[0022] A third aspect of the embodiments of the present disclosure provides a joint learning model training device based on a cluster-driven mode, including:
[0023] a first response module configured to respond to joint learning model training;
[0024] a clustering module configured to perform data clustering on local data by using a preset clustering method and obtain cluster centers, and upload the cluster centers to a server;
[0025] a first training module configured to perform joint learning model training on local data when receiving aggregated cluster centers obtained by aggregating multiple cluster centers fed back by the server;
[0026] a second training module configured to stop training to obtain the cluster-driven model when the joint learning model training using the local data reaches a preset condition; the preset condition is that an iteration number is met or the cluster centers no longer change;
[0027] a third training module configured to train the load prediction model according to the clustering-driven model;
[0028] a second response module configured to respond to the feedback of the server;
[0029] a fourth training module configured to locally train the load prediction model until a convergence condition is reached to obtain a target federated learning model.
[0030] In a fourth aspect, the embodiments of the present disclosure provide a federated learning model training apparatus based on a clustering-driven model, which comprises:
[0031] a receiving module configured to receive class cluster centers sent by a plurality of clients;
[0032] a first aggregation module configured to aggregate the class cluster centers sent by the plurality of clients to obtain aggregated class cluster centers;
[0033] a first delivery module configured to send the aggregated class cluster centers to each client;
[0034] a response module configured to respond to feedback information of each client, the feedback information comprising training model parameters of a load prediction model;
[0035] a second aggregation module configured to perform attention aggregation on the training model parameters of the load prediction model sent by the plurality of clients to obtain global model parameters of the load prediction model;
[0036] a second delivery module configured to deliver the global model parameters of the load prediction model to each client.
[0037] Compared with the prior art, the embodiments of the present disclosure have at least the following beneficial effects: the federated learning model training method provided by the embodiments of the present disclosure can be applied to a client, and the federated learning model training is responded to; a preset clustering method is used to perform data clustering on local data and obtain class cluster centers, and the class cluster centers are uploaded to a server; when the server feedback is received, the aggregated class cluster centers obtained by aggregating a plurality of class cluster centers are obtained, and the federated learning model training is performed on the local data; when the federated learning model training using the local data reaches a preset condition, the training is stopped to obtain a clustering-driven model; wherein the preset condition is until the number of iterations or the class cluster centers no longer change; the load prediction model is trained according to the clustering-driven model; the feedback of the server is responded to; the load prediction model is locally trained until a convergence condition is reached to obtain a target federated learning model, which can effectively protect the data privacy of each participant, and well solves the problems of slow convergence speed of model training and poor generalization performance of the established model caused by data heterogeneity of each participant. BRIEF DESCRIPTION OF DRAWINGS
[0038] In order to more clearly illustrate the technical solutions in the embodiments of the present disclosure, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments of the present disclosure, and other drawings can be obtained by those skilled in the art without creative labor on the basis of these drawings.
[0039] Figure 1 is a joint learning architecture schematic diagram of an embodiment of the present disclosure;
[0040] Figure 2 is a parameter update path schematic diagram of an existing joint learning method;
[0041] Figure 3 is a multi-end interaction timing diagram of a joint learning model training method based on a clustering driven mode provided by an embodiment of the present disclosure;
[0042] Figure 4 is a flow schematic diagram of a joint learning model training method based on a clustering driven mode applied to a client provided by an embodiment of the present disclosure;
[0043] Figure 5 is a flow schematic diagram of a joint learning model training method based on a clustering driven mode applied to a server provided by an embodiment of the present disclosure;
[0044] Figure 6 is a structure schematic diagram of a joint learning model training device based on a clustering driven mode applied to a client provided by an embodiment of the present disclosure;
[0045] Figure 7 is a structure schematic diagram of a joint learning model training device based on a clustering driven mode applied to a server provided by an embodiment of the present disclosure;
[0046] Figure 8 is a structure schematic diagram of a joint learning model training system based on a clustering driven mode provided by an embodiment of the present disclosure;
[0047] Figure 9 is a structure schematic diagram of an electronic device provided by an embodiment of the present disclosure. DETAILED DESCRIPTION
[0048] In the following description, for purposes of explanation and not limitation, specific details are set forth such as particular architectures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present disclosure. However, it will be apparent to those skilled in the art that the present disclosure can be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present disclosure with unnecessary detail.
[0049] Joint learning refers to comprehensively utilizing multiple AI (Artificial Intelligence) technologies to jointly mine data value and give birth to new intelligent formats and modes based on joint modeling under the premise of ensuring data security and user privacy. Joint learning has at least the following characteristics:
[0050] (1) Participating nodes control the weak centralized joint training mode of self-owned data to ensure data privacy and security in the process of co-creating intelligence.
[0051] (2) In different application scenarios, AI algorithms, privacy protection calculations are used to screen and / or combine to establish multiple model aggregation optimization strategies to obtain high-level and high-quality models.
[0052] (3) Based on multiple model aggregation optimization strategies, the efficiency of the joint learning engine is improved under the premise of ensuring data security and user privacy. The efficiency method can be to improve the overall efficiency of the joint learning engine by solving problems including parallel computing architecture, information interaction in large-scale cross-domain networks, intelligent perception, and exception handling mechanism.
[0053] (4) Obtain the needs of users in various scenarios, determine the real contribution of each joint participant through a mutual trust mechanism, and distribute incentives.
[0054] Based on the above method, an AI technology ecosystem based on joint learning can be established to fully realize the value of industry data and promote the landing of vertical field scenarios.
[0055] A model training method, device and system based on joint learning according to an embodiment of the present disclosure will be described in detail below with reference to the accompanying drawings.
[0056] Figure 1 is a schematic diagram of a joint learning architecture according to an embodiment of the present disclosure. As shown in Figure 1 , the joint learning architecture can include a server (central node) 101 and a client (participant) 102, a client (participant) 103, and a client (participant) 104.
[0057] In the joint learning process, the training model can be established by the server 101, and the server 101 sends the training model to the client 102, the client 103 and the client 104 which establish communication connection with the server 101. The training model can also be established by any client and uploaded to the server 101, and the server 101 sends the model to other clients which establish communication connection with the server 101. The client 102, the client 103 and the client 104 construct the model according to the downloaded basic structure and model parameters, train the model by using the local data, obtain the updated model parameters, and upload the updated model parameters to the server 101 after encryption. The server 101 aggregates the training model parameters sent by the client 102, the client 103 and the client 104, obtains the global model parameters, and transmits the global model parameters back to the client 102, the client 103 and the client 104. The client 102, the client 103 and the client 104 iterate the respective models according to the received global model parameters until the model converges finally, so as to realize the training of the model. In the joint learning process, the data uploaded by the client 102, the client 103 and the client 104 is the training model parameter, the local data will not be uploaded to the server 101, and all clients can share the final model parameters, so that common modeling can be realized on the basis of ensuring data privacy. It should be noted that the number of clients is not limited to three as above, but can be set according to needs, and the embodiments of the present disclosure do not limit this.
[0058] In the prior art, since the FedAvg model does not need to collect the local data of each participant, but updates the model by exchanging model gradient or model parameter, the data privacy of each client can be effectively protected, so the FedAvg model is widely used in joint learning. However, in the actual application process, many times the clients participating in joint learning update the model parameters locally for several times before communicating with the server once, and since the clients are usually different data sources, the local data of the clients usually has the problem of inconsistent data distribution (i.e. data heterogeneity). This easily leads to a certain deviation phenomenon between the local update path of each client and the ideal update path of the server (as shown in FIG. 1). Figure 2 Figure 2 , the distributed client 1 (i.e. client1 in Figure 2 ) and the client 2 (i.e. client2 in Figure 2 The client drift phenomenon occurs in the process that each of the client 1 and the client 2 updates the model parameters in the local direction (the local update path) of the own training. Even if the server aggregates the model parameters uploaded from the client 1 and the client 2 by using the weighted average technology, the aggregation result still has the local offset phenomenon, thereby causing the slow convergence speed of the model training, and finally causing the unsatisfactory effect of the model training, such as the poor generalization performance of the model. Although many scholars try to optimize the gradient update of the local client, so that the local update of each client does not deviate too much from the global model, and each local update is pulled back to the vicinity of the ideal update path, thereby improving the convergence speed of the model training, or consider that the contributions of each client to the global model are different, and optimize the aggregation algorithm at the server to improve the effect of the model, but the problem of the slow convergence speed of the model training and the poor generalization performance of the obtained model caused by the data heterogeneity of each client cannot be well solved.
[0059] SGD refers to training all data together as an upper bound on performance.
[0060] Figure 3 is a multi-end interaction time sequence diagram of a joint learning model training method based on a clustering driven mode according to an embodiment of the present disclosure.
[0061] In combination with Figure 1 , 3The technical solution provided in this embodiment involves each client (e.g., clients 102, 103, and 104) responding to the joint learning model training by using a preset clustering method to cluster local data and obtain cluster centers, which are then uploaded to server 101. When server 101 receives cluster centers from multiple clients, it aggregates these cluster centers to obtain aggregated cluster centers, which are then sent to each client. Upon receiving the aggregated cluster centers from the server, each client trains a joint learning model on its local data. Training stops when the joint learning model training using local data reaches a preset condition. A clustering-driven model is obtained; the preset condition is that the number of iterations is met or the cluster centers no longer change; based on the clustering-driven model, a load prediction model is trained, the training model parameters of the load prediction model are obtained, and uploaded to server 101; server 101 responds to the feedback information from each client, the feedback information includes the training model parameters of the load prediction model; attention aggregation is performed on the training model parameters of the load prediction model sent by multiple clients to obtain the global model parameters of the load prediction model; the global model parameters of the load prediction model are distributed to each client; each client responds to the feedback from the server; the load prediction model is trained locally until the convergence condition is met, and the target joint learning model is obtained.
[0062] The technical solutions provided by the embodiments of this disclosure can not only effectively protect the data privacy of each client, but also effectively solve the problems of slow convergence speed of model training and poor generalization performance of the obtained model caused by the heterogeneity of data of each client.
[0063] Figure 4 This is a flowchart illustrating a joint learning model training method based on a clustering-driven model, as provided in an embodiment of this disclosure. Figure 4 The joint learning-based model training method can be derived from... Figure 1 The client executes this. For example... Figure 4 As shown, the training method for the joint learning model based on clustering-driven patterns includes:
[0064] Step S401, respond to joint learning model training.
[0065] The joint learning model here can be an algorithm model based on the actual needs of the clients participating in this joint learning or other model requesters, including but not limited to load forecasting models (such as gas load forecasting models, electricity load forecasting models), clustering-driven models, etc.
[0066] Step S402: Using a preset clustering method, cluster the local data to obtain cluster centers, and upload the cluster centers to the server.
[0067] The preset clustering method can be a clustering algorithm such as a k-means clustering algorithm.
[0068] As an example, when a client receives a task of training a certain federated learning model, the client can respond to the task of training the federated learning model and obtain local data related to the task of training the federated learning model; then, the k-means clustering algorithm is used to cluster the local data and obtain cluster centers, and the cluster centers are uploaded to the server 101.
[0069] In an embodiment, the above step S402 can specifically include the following steps:
[0070] Obtaining a local data set, the local data set including a plurality of training data subsets, each training data subset including a series of training data;
[0071] Decomposing the series of training data in each training data subset respectively to obtain a plurality of decomposition components corresponding to each training data subset, one decomposition component corresponding to one clustering feature;
[0072] Selecting one clustering feature as a clustering target at random, and clustering the training data in the local data set to obtain at least one cluster;
[0073] Extracting cluster centers of each cluster and uploading to the server.
[0074] As an example, when a client receives a task of training a certain federated learning model, the client can respond to the task of training the federated learning model and obtain a local data set related to the task of training the federated learning model. The local data set includes a plurality of training data subsets, each training data subset including a series of training data.
[0075] The local data set refers to the local data set related to participating in federated learning possessed by each client itself. For example, clients A, B and C are all gas suppliers, and each of them has its own local gas load data (i.e., local data set).
[0076] The training data subset refers to the training data (such as energy consumption data such as gas load data and electricity load data) of users (such as individual, family, etc.) affiliated to each client.
[0077] The series of training data can refer to a series of data collected at different times, i.e., time series data. For example, it can be a series of energy consumption data of each energy consumer in various time dimensions such as a month, a quarter, a year, etc.
[0078] As an example, assuming that the participants participating in the joint training of the current gas load prediction model are clients A, B and C, and each of clients A, B and C has 100 energy users, each client can collect a series of energy data of the 100 energy users under its jurisdiction in a certain time dimension (for example, from January 1, 201X to December 31, 201Y). In this example, clients A, B and C each have a local data set including a series of energy data of the 100 energy users from January 1, 201X to December 31, 201Y, and the local data set includes 100 training data subsets, each of which corresponds to a series of training data of an energy user.
[0079] The series of training data in each training data subset is decomposed respectively to obtain a plurality of decomposition components corresponding to each training data subset, and each decomposition component corresponds to a clustering feature.
[0080] Taking client A as an example, the energy data of the 100 energy users (i.e., 100 training data subsets) owned by client A can be numbered as training data subset 01, training data subset 02,..., and training data subset 100, respectively. Then, the series of training data in training data subsets 01-100 is decomposed respectively to obtain a plurality of decomposition components corresponding to training data subsets 01-100, respectively. The plurality of decomposition components can include trend components, periodic components and residual components.
[0081] As an example, the STL (Template Library) algorithm can be used to decompose the series of training data in training data subsets 01-100 to obtain three decomposition components corresponding to training data subsets 01-100, i.e., trend components, periodic components and residual components. For example, the training data subset includes the gas load data of energy user 01 in a certain year (12 months), and the STL algorithm can be used to decompose the gas load data of energy user 01 in a certain year (12 months) to obtain the trend components, periodic components and residual components.
[0082] The trend component mainly reflects the overall trend of time series data, such as monotonic increase, monotonic decrease or irregular fluctuations. The periodic component mainly reflects the periodicity of time series data, for example, the peak of gas load always occurs in a certain month from November to February. The time length of the periodic component is generally not fixed, but it appears cyclically in a long time scale. The residual component mainly reflects the irregular changes of time series data. The residual is the difference between the observed value and the predicted value (fitted value), that is, the difference between the actual observed value and the regression estimate. Obviously, there are as many residuals as there are pairs of data. Residual analysis is to analyze the reliability, periodicity or other disturbances of the data through the information provided by the residual.
[0083] It should be noted that, generally, for shorter time series, the periodicity can not be considered due to insufficient data to reflect the periodic component.
[0084] As an example, a clustering feature label can be assigned to each decomposition component of each training data subset. For example, for the trend component, a trend word label, a number label, or an alphabet label, etc. can be assigned to it. It can be understood that for the periodic component and the residual component, a corresponding word label, number label, or alphabet label, etc. can also be assigned to them respectively. In order to facilitate the distinction, the clustering feature labels of the trend component, the periodic component and the residual component are usually different, and preferably the same as word or number or alphabet labels.
[0085] Any selected clustering feature is selected as a clustering target, and the training data in the local data set is clustered to obtain at least one clustering cluster, and the cluster centers of each clustering cluster are extracted and uploaded, and the clustering targets selected by each client are the same.
[0086] As an example, each client can arbitrarily select a clustering feature label corresponding to one of the decomposition components of the trend component, the periodic component or the residual component, and each clustering feature label corresponds to a clustering target. For example, the word label of the trend component corresponds to the trend component of the time series data.
[0087] In combination with the above example, taking client A as an example, assuming that the clustering feature label selected by client A is a word label representing the trend component, then the trend component can be selected as the clustering target, and the energy data of 100 energy users in its local data set is clustered to obtain at least one clustering cluster, that is, at least one clustering cluster of the trend is obtained, and usually one clustering cluster represents one trend. Assuming that three clustering clusters are obtained in this example, which are clustering cluster 01 (such as corresponding to the trend that the gas load in some months of a certain year is gradually increasing), 02 (such as corresponding to the trend that the gas load in some four months of a certain year is gradually decreasing) and 03 (such as corresponding to the trend that the gas load in some 5 months of a certain year is irregular fluctuation), then the cluster centers 01, 02 and 03 of the clustering clusters 01, 02 and 03 can be further extracted and uploaded to the server 101.
[0088] In some embodiments, clustering the training data in the local data set to obtain at least one clustering cluster can specifically include the following steps:
[0089] Arbitrarily selecting a decomposition component of a training data subset corresponding to the clustering target as a clustering centroid;
[0090] Obtaining the clustering decomposition component corresponding to the clustering target in each training data subset in the local data set;
[0091] respectively calculate distance values between each cluster decomposition component and the cluster centroid;
[0092] According to the distance values, the training data in the local data set is divided into at least one cluster.
[0093] As an example, taking client A as an example, assuming that the local data set of client A includes 100 training data subsets, and the selected cluster target is the trend component, then an arbitrary "trend component" in a training data subset can be selected as the cluster centroid. For example, the "trend component" in the first training data subset is selected as the cluster centroid.
[0094] Then, the "trend components" in the second to 100th training data subsets in the local data set of client A can be obtained, and there are 99 "trend components" (i.e., each cluster decomposition component corresponding to the cluster target in each training data subset). Respectively calculate the distance values (such as Euclidean distance) between each cluster decomposition component and the cluster centroid. Then, according to the distance values of the cluster decomposition components from the cluster centroid, clustering (classes) is performed, and the distance is divided into which cluster (class), and at least one cluster is obtained.
[0095] Similarly, other clients (including clients B, C, etc.) can refer to the clustering method of the above client A to cluster the training data in their local data sets locally, obtain at least one cluster, and extract the cluster centers of each cluster and upload them to the server 101.
[0096] In the embodiments of the present disclosure, a clustering algorithm such as a k-means clustering algorithm can be used to cluster the training data in the local data set to obtain at least one cluster.
[0097] In the joint learning process in the embodiments of the present disclosure, it is generally necessary to ensure that the cluster targets selected by each client are consistent. For example, if client A selects the cluster target as the trend, then the cluster target selected by other clients (including clients B, C, etc.) should also be the trend. In this way, the training data used by each client can be guaranteed to belong to the same category and have similar trend changes, so that the degree of deviation of the local update path of each client caused by the data heterogeneity of each client can be corrected to some extent, so that the convergence speed of model training is accelerated, and the generalization performance of the trained model is improved.
[0098] Through the clustering method described above, similar training data in the local data set of each client can be effectively mined under the premise of ensuring the data privacy of each client. In subsequent model training, each client uses these similar training data to perform model training locally, which can effectively alleviate the data heterogeneity problem caused by different data sources of each client, thereby effectively solving the problems of slow model convergence speed and poor model generalization performance caused by data heterogeneity of each client.
[0099] In an exemplary embodiment, it is assumed that the server 101 receives the class cluster centers uploaded by the client 102 (hereinafter referred to as client A), the client 103 (hereinafter referred to as client B), and the client 104 (hereinafter referred to as client C), such as class cluster centers 01, 02, 03 uploaded by the client 102, 04, 05, 06 uploaded by the client 103, and 07, 08, 09 uploaded by the client C. Then the server 101 can further aggregate the class cluster centers 01, 02, 03, 04, 05, 06, 07, 08, 09 to obtain the aggregated class cluster centers 01, 02, 03, and feed back to the clients A, B, C.
[0100] Step S403, when receiving the aggregated class cluster centers obtained by aggregating the plurality of class cluster centers fed back by the server, performing joint learning model training on the local data.
[0101] In combination with the above example, taking the client A as an example, when the client A receives the aggregated class cluster centers 01, 02, 03 fed back by the server 101, it can update its class cluster centers 01, 02, 03 using the aggregated class cluster centers 01, 02, 03 respectively, to obtain the updated class cluster centers 01', 02', 03'. Then, using the class cluster centers 01', 02', 03' to cluster the training data in its local data set, to obtain the updated clustering clusters 01 (corresponding to the class cluster center 01'), 02 (corresponding to the class cluster center 02'), 03 (corresponding to the class cluster center 03'), and upload the updated class cluster centers 01, 02, 03 corresponding to the updated clustering clusters 01, 02, 03 to the server 101.
[0102] Similarly, the clients B and C can refer to the class cluster center updating and clustering means of the client A described above to update their class cluster centers, and use the updated class cluster centers to cluster their local data to obtain updated class cluster centers and upload them to the server 101. The server 101 can aggregate the updated class cluster centers uploaded by the clients A, B, and C to obtain updated aggregated class cluster centers and distribute them to each client, so that the client performs the next round of joint learning model training on its local data.
[0103] Step S404, when the joint learning model training using the local data reaches a preset condition, stop training to obtain the cluster-driven model; wherein the preset condition is until the number of iterations or the cluster center no longer changes.
[0104] The number of iterations can be flexibly set according to actual conditions, for example, it can be set to 50 rounds, 100 rounds, etc., which is not specifically limited in the present disclosure.
[0105] In combination with the examples listed in the above step S403, when each client uses its local data to perform joint learning model training to reach a preset condition (such as the cluster center no longer changing), the above joint learning model training using the local data is stopped to obtain the cluster-driven model.
[0106] Step S405, training the load prediction model according to the cluster-driven model to obtain the training model parameters of the load prediction model, and uploading to the server.
[0107] Step S406, responding to the feedback of the server.
[0108] Step S407, locally training the load prediction model until a convergence condition is reached to obtain the target joint learning model.
[0109] In an embodiment, the above step S405 can specifically include the following steps:
[0110] According to the final cluster center corresponding to the cluster-driven model, the training data in the local data set is clustered to obtain at least one final cluster, and the number of final clusters is the same as the number of clusters;
[0111] The training data corresponding to each final cluster is divided into a class of training samples, and each class of training samples is used to train a load prediction model.
[0112] In combination with the above examples, the server 101 can aggregate the cluster centers uploaded by each client in the last round to obtain the final cluster center, which is respectively distributed to the client 102, the client 103 and the client 104. The client 102, the client 103 and the client 104 can use the final cluster center to cluster the training data in the local data set to obtain at least one final cluster, such as the final cluster 01, 02, 03 obtained by the client A, the final cluster 04, 05, 06 obtained by the client B, and the final cluster 07, 08, 09 obtained by the client C. One final cluster corresponds to the training data of multiple training data subsets.
[0113] In some embodiments, training a load prediction model using each class of training samples can include the following steps:
[0114] a load prediction model is assigned to each type of training sample, and the load prediction model comprises a plurality of network layers;
[0115] For each type of training sample, the corresponding load prediction model is trained using the training sample to obtain a set of training model parameters and upload the set of training model parameters to the server.
[0116] Taking the client A as an example, assuming that the client A receives the final cluster centers 01, 02, and 03 issued by the server 101, then the final cluster centers 01, 02, and 03 can be used to update the cluster centers 01, 02, and 03 of the client A respectively to obtain updated cluster centers 01', 02', and 03'. Next, the cluster centers 01', 02', and 03' are used to cluster the training data in the local data set of the client A to obtain final clustering clusters 01 (corresponding to the cluster center 01'), 02 (corresponding to the cluster center 02'), and 03 (corresponding to the cluster center 03'). The final clustering clusters 01, 02, and 03 respectively contain training data of a plurality of training data subsets, and the final clustering clusters 01, 02, and 03 respectively correspond to a type of training sample.
[0117] Next, a load prediction model is assigned to each of the final clustering clusters 01, 02, and 03. The load prediction model can be the same model or different models. Assuming that the load prediction model assigned in this embodiment is the same model. The load prediction model can be a neural network model comprising a plurality of network layers. For example, it can be a neural network model comprising three network layers 01, 02, and 03.
[0118] In this example, it is assumed that the load prediction models 01, 02, and 03 are assigned to the final clustering clusters 01, 02, and 03 respectively. Then, the load prediction model 01 is trained using the training sample corresponding to the final clustering cluster 01 to obtain a set of training model parameters 01; the load prediction model 02 is trained using the training sample corresponding to the final clustering cluster 02 to obtain a set of training model parameters 02; the load prediction model 03 is trained using the training sample corresponding to the final clustering cluster 03 to obtain a set of training model parameters 03, and the training model parameters 01, 02, and 03 are uploaded to the server 101.
[0119] Similarly, for other clients (such as the clients B and C), the same model training method as that of the client A can be used to train three sets of training model parameters respectively. Assuming that the three sets of training model parameters obtained by the client B using the training data of its local data set are training model parameters 04, 05, and 06 and are uploaded to the server 101; and the three sets of training model parameters obtained by the client C using the training data of its local data set are training model parameters 07, 08, and 09 and are uploaded to the server 101.
[0120] After receiving the training model parameters 01, 02, 03, 04, 05, 06, 07, 08 and 09, the server 101 can aggregate the training model parameters 01, 02, 03, 04, 05, 06, 07, 08 and 09 to obtain global model parameters corresponding to each load prediction model, i.e., global model parameter 01 corresponding to the load prediction model 01, global model parameter 02 corresponding to the load prediction model 02, and global model parameter 03 corresponding to the load prediction model 03. Then, the global model parameters 01, 02 and 03 are respectively sent to the clients A, B and C, so that the clients A, B and C update the training models 01, 02 and 03 corresponding thereto using the global model parameters 01, 02 and 03 to obtain updated models 01, 02 and 03 corresponding to the training models 01, 02 and 03.
[0121] For example, the client A can update the model parameters of the load prediction model 01 using the global model parameter 01 to obtain an updated model 01, update the model parameters of the load prediction model 02 using the global model parameter 02 to obtain an updated model 02, and update the model parameters of the load prediction model 03 using the global model parameter 03 to obtain an updated model 03.
[0122] The convergence condition can be that a preset number of iterations is met, or that the model accuracy reaches a preset accuracy requirement.
[0123] Figure 5 FIG. 4 is a flow diagram of another method for training a joint learning model based on a clustering-driven mode according to an embodiment of the present disclosure. Figure 5 The method for training a model based on joint learning can be performed by the server 101. Figure 1 As shown in FIG. 5, the method for training a joint learning model based on a clustering-driven mode includes the following steps. Figure 5
[0124] In step S501, the class cluster centers sent by the plurality of clients are received.
[0125] In step S502, the class cluster centers sent by the plurality of clients are aggregated to obtain aggregated class cluster centers.
[0126] In step S503, the aggregated class cluster centers are sent to each client.
[0127] In some embodiments, the above step S502 can specifically include the following steps.
[0128] The class cluster centers uploaded by each client are aggregated to obtain aggregated class cluster centers.
[0129] If it is determined that the change value of the aggregated class cluster centers meets the preset change range, the aggregated class cluster centers are determined as the final class cluster centers.
[0130] In an embodiment, each cluster center carries a cluster label.
[0131] The cluster centers uploaded by each client are aggregated to obtain aggregated cluster centers, which can include the following steps:
[0132] The cluster centers uploaded by each client belonging to the same cluster label are aggregated to obtain an aggregated cluster center corresponding to each cluster label.
[0133] If it is determined that the change value of the aggregated cluster center meets the preset change range, the aggregated cluster center is determined as the final cluster center, including:
[0134] If it is determined that the change value of the aggregated cluster center corresponding to each cluster label meets the preset change range, the aggregated cluster center corresponding to each cluster label is determined as the final cluster center.
[0135] As an example, assume that the server 101 receives the cluster centers 01, 02, and 03 of client A, the cluster centers 04, 05, and 06 of client B, and the cluster centers 07, 08, and 09 of client C. Among them, the cluster centers 01, 04, and 07 carry the same cluster label (such as the text label of "class 1"); the cluster centers 02, 05, and 08 carry the same cluster label (such as the text label of "class 2"); and the cluster centers 03, 06, and 09 carry the same cluster label (such as the text label of "class 3"). The cluster centers 01, 04, and 07 can be aggregated to obtain an aggregated cluster center 01; the cluster centers 02, 05, and 08 can be aggregated to obtain an aggregated cluster center 02; and the cluster centers 03, 06, and 09 can be aggregated to obtain an aggregated cluster center 03.
[0136] In one case, if it is determined that the change values of the aggregated cluster center 01, the aggregated cluster center 02, and the aggregated cluster center 03 all meet the preset change range (such as no longer changing), the aggregated cluster center 01, the aggregated cluster center 02, and the aggregated cluster center 03 are determined as the final cluster centers.
[0137] In another case, if the change values of the aggregated cluster centers 01, 02 and 03 do not completely conform to the preset change range, the aggregated cluster centers 01, 02 and 03 are sent to each client, so that each client uses the aggregated cluster centers 01, 02 and 03 to update the cluster centers of the last round, and then updates the training data in the local data set to obtain new clusters and extract the updated cluster centers of the new clusters and upload them to the server. The server repeatedly executes the above aggregation and judgment processes of the cluster centers, and iterates until the preset convergence condition (such as the cluster centers no longer change, or the preset round threshold is reached) is reached, to obtain the final cluster centers.
[0138] Step S504, in response to the feedback information of each client, the feedback information including the training model parameters of the load prediction model.
[0139] Step S505, performing attention aggregation on the training model parameters of the load prediction model sent by the plurality of clients to obtain global model parameters of the load prediction model.
[0140] Step S506, sending the global model parameters of the load prediction model to each client.
[0141] In some embodiments, the attention aggregation on the training model parameters of the load prediction model sent by the plurality of clients can specifically include the following steps:
[0142] obtaining initial model parameters;
[0143] calculating the similarity between the initial model parameters and the training model parameters of each client for the training sample corresponding to the same type of training sample of each client;
[0144] determining the global model parameters of the load prediction model corresponding to the same type of training sample of each client according to the similarity and the training model parameters of the load prediction model corresponding to the same type of training sample of each client.
[0145] The initial model parameter generally refers to the aggregated parameter obtained by the server 101 aggregating the training model parameters uploaded by each client after the last round of training. If it is the first round, the initial model parameter can be the initialization model parameter obtained by the server 101 initializing the load prediction model. In the second round, the initial model parameter refers to the aggregated parameter obtained by aggregating the training model parameters uploaded by each client after the first round of training. It can be understood that in the Nth round, the initial model parameter refers to the aggregated parameter obtained by aggregating the training model parameters uploaded by each client after the (N-1)th round of training. N is a positive integer greater than or equal to 1.
[0146] As an example, it is assumed that the server 101 receives the training model parameters 01, 02, 03 uploaded by the client A, the training model parameters 04, 05, 06 uploaded by the client B, and the training model parameters 07, 08, 09 uploaded by the client C. The client A trains the load prediction model 01 using the final clustering cluster 01 to obtain the training model parameter 01; the client B trains the load prediction model 01 using the final clustering cluster 04 to obtain the training model parameter 04; and the client C trains the load prediction model 01 using the final clustering cluster 07 to obtain the training model parameter 07. The final clustering clusters 01, 04, and 07 are the same type of training samples in the local data sets of the clients A, B, and C. It is assumed that the obtained initial model parameter is ①. Then, the similarity a between the initial model parameter ① and the training model parameter 01, the similarity b between the initial model parameter ① and the training model parameter 04, and the similarity c between the initial model parameter ① and the training model parameter 07 are calculated for the training model parameters 01, 04, and 07 of the load prediction model 01 corresponding to the same type of training samples of the clients A, B, and C.
[0147] As an example, the similarity between the initial model parameter and the training model parameter of each client can be measured by distance (such as two norm). The two norm of a matrix X is the square root of the maximum eigenvalue of X multiplied by the transpose matrix of X, which refers to the straight-line distance between two vector matrices in space. It is similar to calculating the straight-line distance between two points on a chessboard.
[0148] In some embodiments, the global model parameter of the load prediction model corresponding to the same type of training samples of each client includes the layer global model parameter of each network layer in the load prediction model; the training model parameter of the load prediction model corresponding to the same type of training samples of each client includes the layer training model parameter of each network layer in the training model; and the similarity between the training model parameter of the load prediction model corresponding to the same type of training samples of each client and the initial model parameter includes the layer similarity between the training model parameter and the initial model parameter of each network layer in the load prediction model.
[0149] According to the similarity and the training model parameters of the load prediction model corresponding to the same type of training sample of each client, the global model parameters of the load prediction model corresponding to the same type of training sample of each client are determined, which can specifically include the following steps:
[0150] The layer training model parameters belonging to the same network layer are extracted from the training model parameters of the load prediction model corresponding to the same type of training sample of each client, and the layer similarity corresponding to the layer training model parameters belonging to the same network layer is extracted from the similarity;
[0151] According to the layer similarity, the weight parameter attention value of the layer training model parameters of the same layer network layer of the load prediction model corresponding to the same type of training sample of each client is determined;
[0152] According to the weight parameter attention value and the layer training model parameters, the layer global model parameters of the same layer network layer of the load prediction model corresponding to the same type of training sample of each client are determined.
[0153] In combination with the above example, assuming that the load prediction model 01 includes three network layers 01, 02 and 03, the training model parameters 01 of the client A include the layer training model parameters A1 corresponding to the network layer 01, the layer training model parameters A2 corresponding to the network layer 02, and the layer training model parameters A3 corresponding to the network layer 03; the training model parameters 04 of the client B include the layer training model parameters B1 corresponding to the network layer 01, the layer training model parameters B2 corresponding to the network layer 02, and the layer training model parameters B3 corresponding to the network layer 03; the training model parameters 07 of the client C include the layer training model parameters C1 corresponding to the network layer 01, the layer training model parameters C2 corresponding to the network layer 02, and the layer training model parameters C3 corresponding to the network layer 03. The similarity a includes the layer similarity a1 corresponding to the network layer 01, the layer similarity a2 corresponding to the network layer 02, and the layer similarity a3 corresponding to the network layer 03; the similarity b includes the layer similarity b1 corresponding to the network layer 01, the layer similarity b2 corresponding to the network layer 02, and the layer similarity b3 corresponding to the network layer 03; the similarity c includes the layer similarity c1 corresponding to the network layer 01, the layer similarity c2 corresponding to the network layer 02, and the layer similarity c3 corresponding to the network layer 03.
[0154] As an example, the layer training model parameters belonging to the same network layer are extracted from the training model parameters of the load prediction model corresponding to the same type of training sample of each client. For network layer 01, the layer training model parameters A1 of client A, the layer training model parameters B1 of client B, and the layer training model parameters C1 of client C are extracted respectively; and the layer similarity a1 of client A, the layer similarity b1 of client B, and the layer similarity c1 of client C corresponding to the layer network layer 01 are extracted. For network layer 02, the layer training model parameters A2, the layer similarity a2 of client A, the layer training model parameters B2, the layer similarity b2 of client B, and the layer training model parameters C2, the layer similarity c2 of client C are extracted respectively. For network layer 03, the layer training model parameters A3, the layer similarity a3 of client A, the layer training model parameters B3, the layer similarity b3 of client B, and the layer training model parameters C3, the layer similarity c3 of client C are extracted respectively.
[0155] Then, the Euclidean distance (two-norm) between the initial model parameters and the layer training model parameters of each network layer of each client can be calculated according to the following formula (1), and the calculated Euclidean distance (two-norm) can be normalized according to the following formula (2) to obtain the weight parameter attention value of the layer training model parameters of the same layer network layer of the load prediction model corresponding to the same type of training sample of each client.
[0156]
[0157]
[0158] In the above formula (1), (2), ω l represents the layer initial model parameters of the Lth layer network layer in the load prediction model of the server; represents the layer training model parameters of the Lth layer network layer in the load prediction model of the Kth client; represents the two-norm (i.e., layer similarity) between the layer initial model parameters of the Lth layer network layer in the load prediction model of the server and the layer training model parameters of the Lth layer network layer in the load prediction model of the Kth client; m represents the number of network layers of the load prediction model; represents the weight parameter attention value of the Lth layer network layer of the Kth client, and p represents what norm, such as two-norm, p = 2.
[0159] In an exemplary embodiment, it is assumed that the weight parameter attention values of each network layer 01, 02, 03 of the load prediction model 01 of client A are respectively and The weight parameter attention value of each network layer 01, 02, 03 of the load prediction model 01 of the client B is respectively The weight parameter attention value of each network layer 01, 02, 03 of the load prediction model 01 of the client C is respectively
[0160] Therefore, the global model parameter 01 (ω1) of the network layer 01 is:
[0161]
[0162] The global model parameter 02 (ω2) of the network layer 02 is:
[0163]
[0164] The global model parameter 03 (ω3) of the network layer 03 is:
[0165]
[0166] Similarly, the global model parameters of each layer network of the load prediction model 02 and the load prediction model 03 can be calculated by referring to the above method, which will not be described here.
[0167] The server 101 respectively issues the layer global model parameters of each layer network of each load prediction model of each client to each client, so that each client can use the layer global model parameters of each layer network to update the model parameters of the network layer of the corresponding load prediction model, and obtain an updated model.
[0168] For example, the client A can use the global model parameter 01 (ω1) to update the model parameters of the last round of the network layer 01 of the load prediction model 01, use the global model parameter 02 (ω2) to update the model parameters of the last round of the network layer 02 of the load prediction model 01, and use the global model parameter 03 (ω3) to update the model parameters of the last round of the network layer 03 of the load prediction model 01, to obtain the updated model 01 of the load prediction model 01.
[0169] The model training method provided by the embodiments of the present disclosure first decomposes a series of training data in a plurality of training data subsets in the local data set of each client locally to obtain a plurality of decomposition components. Then, a clustering feature corresponding to any selected decomposition component is taken as a clustering target, and a clustering algorithm (such as a k-means clustering algorithm) is used to cluster the training data in the local data set to obtain at least one cluster center. The cluster center of each cluster is uploaded to the server, the cluster centers of each client are aggregated by the server, and the aggregated cluster centers are returned to the server. Each client uses the aggregated cluster centers returned by the server to update the cluster centers of the N-1th round, and uses the updated cluster centers to cluster the training data in the local data set to obtain the cluster centers of the Nth round. The training is repeatedly iterated until the preset iteration round is met, or the cluster center no longer changes, the final cluster center is determined, and is returned to each client. Each client uses the final cluster center to update the cluster center of the previous round, and clusters the training data in the local data set to obtain at least one final cluster. Each final cluster is divided into a training sample, and each training sample is used to participate in the training of the joint learning model. Through the above process, each client does not need to upload its local data to the server, which can effectively protect the data privacy and security of each client. At the same time, similar training data (such as data with similar gas load patterns) in the local data set of each client can be effectively mined, which helps the gas company to understand the energy consumption behavior of the energy consumer, so as to better coordinate the gas resources and manage the energy consumption demand of the energy consumer. Then, the training samples mined are used for model training, which can effectively alleviate the data heterogeneity problem caused by different data sources of each client, not only can accelerate the convergence speed of model training, but also can improve the effect of the model obtained by training, and establish a high-precision load prediction model. Through related deduction test verification, the generalization performance of the model trained by the method is better than that of the model obtained by using the traditional model training method.
[0170] All the optional technical solutions described above can be combined to form optional embodiments of the present application, which will not be described here.
[0171] The following is an embodiment of the device of the present disclosure, which can be used to execute the method embodiments of the present disclosure. For details not disclosed in the device embodiments of the present disclosure, please refer to the method embodiments of the present disclosure.
[0172] Figure 6 is a schematic diagram of a joint learning model training device based on a clustering driven mode provided by an embodiment of the present disclosure. As Figure 6 shown, the joint learning model training device based on the clustering driven mode comprises:
[0173] The first response module 601 is configured to respond to the federated learning model training.
[0174] The clustering module 602 is configured to use a preset clustering method to perform data clustering on the local data and obtain cluster centers, and upload the cluster centers to the server.
[0175] The first training module 603 is configured to perform federated learning model training on the local data when receiving the aggregated cluster centers obtained by the server after aggregating the plurality of cluster centers.
[0176] The second training module 604 is configured to stop training to obtain a clustering-driven model when the federated learning model training using the local data reaches a preset condition; wherein the preset condition is until the number of iterations or the cluster centers no longer change.
[0177] The third training module 605 is configured to train a load prediction model according to the clustering-driven model.
[0178] The second response module 606 is configured to respond to the feedback of the server.
[0179] The fourth training module 607 is configured to perform local training on the load prediction model until a convergence condition is reached to obtain a target federated learning model.
[0180] The technical scheme provided by the embodiments of the present disclosure, through the first response module 601 responding to the federated learning model training; the clustering module 602 using a preset clustering method to perform data clustering on the local data and obtaining cluster centers, and uploading the cluster centers to the server; the first training module 603 performing federated learning model training on the local data when receiving the aggregated cluster centers obtained by the server after aggregating the plurality of cluster centers; the second training module 604 stopping training to obtain a clustering-driven model when the federated learning model training using the local data reaches a preset condition; wherein the preset condition is until the number of iterations or the cluster centers no longer change; the third training module 605 training a load prediction model according to the clustering-driven model; the second response module 606 responding to the feedback of the server; and the fourth training module 607 performing local training on the load prediction model until a convergence condition is reached to obtain a target federated learning model, which can effectively protect the data privacy of each participant, and well solve the problems of slow convergence speed of model training and poor generalization performance of the established model caused by data heterogeneity of each participant.
[0181] In some embodiments, the clustering module 602 includes:
[0182] a data obtaining unit configured to obtain a local data set, the local data set comprising a plurality of training data subsets, each training data subset comprising a series of training data;
[0183] a data decomposing unit configured to decompose the series of training data in each training data subset respectively to obtain a plurality of decomposed components corresponding to each training data subset, one decomposed component corresponding to one clustering feature;
[0184] a clustering unit configured to select one clustering feature as a clustering target at will and cluster the training data in the local data set to obtain at least one clustering cluster;
[0185] an extraction unit configured to extract the cluster centers of the clustering clusters and upload to the server.
[0186] In some embodiments, the third training module 605 comprises:
[0187] a data clustering unit configured to cluster the training data in the local data set according to the final cluster centers corresponding to the clustering driving model to obtain at least one final clustering cluster, the number of final clustering clusters being the same as the number of clustering clusters;
[0188] a data dividing unit configured to divide the training data corresponding to each final clustering cluster into a training sample, and train a load prediction model using each training sample.
[0189] In some embodiments, the training of a load prediction model using each training sample comprises:
[0190] allocating a load prediction model to each training sample respectively, the load prediction model comprising a plurality of network layers;
[0191] for each training sample, training the load prediction model corresponding to the training sample using the training sample to obtain a set of training model parameters and upload to the server.
[0192] Figure 7 is another schematic diagram of a joint learning model training device based on a clustering driving mode provided by the embodiments of the present disclosure. As shown in the figure, Figure 7 the joint learning model training device based on the clustering driving mode comprises:
[0193] a receiving module 701 configured to receive the cluster centers sent by a plurality of clients;
[0194] a first aggregation module 702 configured to aggregate the cluster centers sent by the plurality of clients to obtain aggregated cluster centers;
[0195] The first sending module 703 is configured to send the aggregated cluster center to each client;
[0196] The response module 704 is configured to respond to feedback information of each client, and the feedback information includes a training model parameter of the load prediction model;
[0197] The second aggregation module 705 is configured to perform attention aggregation on the training model parameters of the load prediction model sent by the plurality of clients to obtain global model parameters of the load prediction model;
[0198] The second sending module 706 is configured to send the global model parameters of the load prediction model to each client.
[0199] In some embodiments, the first aggregation module 702 includes:
[0200] An aggregation unit is configured to aggregate the cluster centers uploaded by each client to obtain an aggregated cluster center;
[0201] A judgment unit is configured to determine the aggregated cluster center as a final cluster center and stop aggregating the cluster centers fed back by each client if it is determined that a change value of the aggregated cluster center meets a preset change range.
[0202] In some embodiments, the second aggregation module 705 includes:
[0203] A parameter acquisition unit is configured to acquire an initial model parameter;
[0204] A calculation unit is configured to calculate a similarity between the initial model parameter and the training model parameter of each client for a same type of training sample corresponding to the load prediction model;
[0205] A determination unit is configured to determine a global model parameter of the load prediction model corresponding to the same type of training sample of each client according to the similarity and the training model parameter of the load prediction model corresponding to the same type of training sample of each client.
[0206] In some embodiments, the global model parameter of the load prediction model corresponding to the same type of training sample of each client includes a layer global model parameter of each network layer in the load prediction model; the training model parameter of the load prediction model corresponding to the same type of training sample of each client includes a layer training model parameter of each network layer in the load prediction model; and the similarity between the training model parameter of the load prediction model corresponding to the same type of training sample of each client and the initial model parameter includes a layer similarity between the training model parameter and the initial model parameter of each network layer in the load prediction model.
[0207] The determination unit can be specifically configured to:
[0208] According to the similarity and the training model parameters of the load prediction model corresponding to the same type of training sample of each client, determine the global model parameters of the load prediction model corresponding to the same type of training sample of each client, including:
[0209] Respectively extract layer training model parameters belonging to the same network layer from the training model parameters of the load prediction model corresponding to the same type of training sample of each client, and extract layer similarity corresponding to the layer training model parameters belonging to the same network layer from the similarity;
[0210] According to the layer similarity, determine the weight parameter attention value of the layer training model parameters of the same layer network layer of the load prediction model corresponding to the same type of training sample of each client;
[0211] According to the weight parameter attention value and the layer training model parameters, determine the layer global model parameters of the same layer network layer of the load prediction model corresponding to the same type of training sample of each client.
[0212] Figure 8 is a schematic diagram of a joint learning model training system based on a clustering driven mode provided by the embodiments of the present disclosure. As Figure 8 indicated, the joint learning model training system based on the clustering driven mode includes:
[0213] a server 101, and at least two clients 102 respectively in communication connection with the server;
[0214] The server 101 includes a model training apparatus as Figure 7 indicated;
[0215] Each client 102 includes a model training apparatus as Figure 6 indicated.
[0216] The server 101 can establish a communication connection with each client via a network to receive and send information, etc. Specifically, the joint learning model training system provided in the embodiments of the present disclosure, each client 102 responds to joint learning model training, uses a preset clustering method to perform data clustering on local data and obtains a cluster center, and uploads the cluster center to the server 101; the server 101 aggregates the cluster centers sent by the plurality of clients when receiving the cluster centers sent by the plurality of clients, obtains an aggregated cluster center, and sends the aggregated cluster center to each client; each client performs joint learning model training on local data when receiving the aggregated cluster center obtained by aggregating the plurality of cluster centers fed back by the server; when the joint learning model training using the local data reaches a preset condition, the training is stopped to obtain a clustering driven model; wherein the preset condition is until the number of iterations or the cluster center no longer changes; according to the clustering driven model, a load prediction model is trained to obtain training model parameters of the load prediction model, and the training model parameters are uploaded to the server 101; the server 101 feeds back the feedback information of each client, and the feedback information includes the training model parameters of the load prediction model; the training model parameters of the load prediction model sent by the plurality of clients are aggregated by attention to obtain global model parameters of the load prediction model; the global model parameters of the load prediction model are distributed to each client; each client responds to the feedback of the server; when the local training of the load prediction model reaches a convergence condition, a target joint learning model is obtained, which not only effectively protects the data privacy of each client, but also solves the problem of slow convergence speed of model training caused by data heterogeneity of each client, and the generalization performance of the obtained model is poor.
[0217] It should be understood that the size of the serial number of each step in the above embodiments does not mean the order of execution, and the execution order of each process should be determined according to its function and inherent logic, and should not constitute any limitation on the implementation process of the embodiments of the present disclosure.
[0218] Figure 9 is a schematic diagram of an electronic device 9 provided by the embodiments of the present disclosure. As shown in Figure 9 the electronic device 9 of this embodiment includes a processor 901, a memory 902, and a computer program 903 stored in the memory 902 and executable on the processor 901. The processor 901 implements the steps in each of the above method embodiments when executing the computer program 903. Alternatively, the processor 901 implements the functions of each module / unit in the above each device embodiment when executing the computer program 903.
[0219] Exemplarily, the computer program 903 can be divided into one or more modules / units, which are stored in the memory 902 and executed by the processor 901 to complete the present disclosure. The one or more modules / units can be a series of computer program instruction segments capable of completing a specific function, which are used to describe the execution process of the computer program 903 in the electronic device 9.
[0220] The electronic device 9 can be a desktop computer, a notebook computer, a palm computer, a cloud server and the like. The electronic device 9 can include but is not limited to the processor 901 and the memory 902. Those skilled in the art can understand that the electronic device 9 can include more or less components, or combine certain components, or different components, for example, the electronic device can also include an input / output device, a network access device, a bus and the like. Figure 9 The electronic device 9 is only an example and does not constitute a limitation on the electronic device 9, and can include more or less components than the diagram, or combine certain components, or different components, for example, the electronic device can also include an input / output device, a network access device, a bus and the like.
[0221] The processor 901 can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), field programmable gate arrays (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. The general-purpose processor can be a microprocessor or the processor can also be any conventional processor.
[0222] The memory 902 can be an internal storage unit of the electronic device 9, for example, a hard disk or a memory of the electronic device 9. The memory 902 can also be an external storage device of the electronic device 9, for example, a plug-in hard disk, a smart media card (SMC), a secure digital (SD) card, a flash card and the like equipped on the electronic device 9. Further, the memory 902 can include both the internal storage unit and the external storage device of the electronic device 9. The memory 902 is used to store computer programs and other programs and data required by the electronic device. The memory 902 can also be used to temporarily store data that has been output or will be output.
[0223] Those skilled in the art can clearly understand that, for the convenience and brevity of description, only the division of the above functional units and modules is taken as an example, and in actual application, the above functions can be completed by different functional units and modules according to needs, that is, the internal structure of the device is divided into different functional units or modules to complete all or part of the functions described above. Each functional unit and module in the embodiment can be integrated in one processing unit, or each unit can be physically present separately, or two or more units can be integrated in one unit. The above integrated unit can be realized in the form of hardware or software functional unit. In addition, the specific names of each functional unit and module are only for easy distinction, and do not limit the protection scope of the present application. The specific working process of the units and modules in the above system can refer to the corresponding process in the foregoing method embodiments, which will not be repeated here.
[0224] In the above embodiments, the description of each embodiment has its own emphasis, and the parts not described or recorded in detail in a certain embodiment can be referred to the related description of other embodiments.
[0225] Those of ordinary skill in the art can realize that the units and algorithm steps of each example described in combination with the embodiments disclosed herein can be realized in electronic hardware or a combination of computer software and electronic hardware. Whether the functions are performed in hardware or software depends on the specific application and design constraints of the technical solution. Professionals can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of the present disclosure.
[0226] In the embodiments provided in the present disclosure, it should be understood that the disclosed devices / equipment and methods can be implemented in other ways. For example, the device / equipment embodiments described above are only schematic. For example, the division of modules or units is only a logical function division, and actual implementation can have another division manner. Multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. In addition, the coupling or direct coupling or communication connection between the shown or discussed mutual units can be indirect coupling or communication connection through some interface, device or unit, and can be electrical, mechanical or other forms.
[0227] The units described as separate components can or can not be physically separated, and the components shown as units can or can not be physical units, that is, they can be located in one place, or can be distributed on multiple network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the present embodiment.
[0228] In addition, each functional unit in each of the embodiments of the present disclosure can be integrated in one processing unit, or each unit can exist physically, or two or more units can be integrated in one unit. The integrated unit can be realized in the form of hardware or in the form of a software functional unit.
[0229] If the integrated module / unit is realized in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer readable storage medium. Based on such understanding, all or part of the processes in the above-mentioned embodiment methods can be completed by the computer program instructing the related hardware, and the computer program can be stored in the computer readable storage medium. When the processor executes the computer program, the steps of each method embodiment described above can be implemented. The computer program can include computer program code, which can be in the form of source code, object code, executable file, or some intermediate form. The computer readable medium can include any entity or device capable of carrying the computer program code, recording medium, U disk, mobile hard disk, magnetic disk, optical disk, computer memory, read-only memory (ROM), random access memory (RAM), electric carrier signal, telecommunication signal, and software distribution medium, etc. It should be noted that the content included in the computer readable medium can be appropriately increased or decreased according to the requirements of legislation and patent practice in the jurisdiction, for example, in some jurisdictions, according to legislation and patent practice, the computer readable medium does not include electric carrier signals and telecommunication signals.
[0230] The above embodiments are only used to illustrate the technical solutions of the present disclosure, rather than limit them; although the present disclosure has been described in detail with reference to the foregoing embodiments, it should be understood by those skilled in the art that the technical solutions recorded in the foregoing embodiments can be modified, or some technical features can be replaced by equivalents; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present disclosure, and should be included in the protection scope of the present disclosure.
Claims
1. A method for training a federated learning model based on a cluster-driven mode, characterized in that, Comprising: Client: Response to federated learning model training; Using a preset clustering method, the local data is clustered and the cluster center is obtained, and the cluster center is uploaded to the server; When receiving the feedback of the server, the aggregation cluster center obtained after the aggregation of the plurality of cluster centers is obtained, the federated learning model training is performed on the local data; When the federated learning model training using the local data reaches a preset condition, stop training to obtain a clustering driven model; Wherein the preset condition is until the iteration number is met or the cluster center no longer changes; According to the clustering driven model, the load prediction model is trained, the training model parameters of the load prediction model are obtained, and the server is uploaded; In response to the feedback of the server; Local training of the load prediction model until the convergence condition is reached to obtain a target federated learning model; Using a preset clustering method, the local data is clustered and the cluster center is obtained, and the cluster center is uploaded to the server, comprising: Obtain a local data set, the local data set includes a plurality of training data subsets, and each training data subset includes a series of training data; Respectively, each training data subset in a series of training data is decomposed to obtain a plurality of decomposition components corresponding to each training data subset, and each decomposition component corresponds to a clustering feature; Arbitrarily select a clustering feature as a clustering target, and cluster the training data in the local data set to obtain at least one cluster; Extract the cluster center of each cluster and upload it to the server; According to the clustering driven model, the load prediction model is trained, comprising: According to the final cluster center corresponding to the clustering driven model, the training data in the local data set is clustered to obtain at least one final cluster, and the number of final clusters is the same as the number of clusters; Divide the training data corresponding to each final cluster into a class of training samples, and train a load prediction model using each class of training samples.
2. The method of claim 1, wherein, Training a load prediction model using each class of training samples, comprising: Assign a load prediction model to each class of training samples, respectively, and the load prediction model includes multiple network layers; For each class of training samples, use the training samples to train the corresponding load prediction model to obtain a set of training model parameters and upload them to the server.
3. A federated learning model training method based on a cluster-driven mode, characterized in that, Comprising: Server: Receive the cluster center sent by the plurality of clients; Aggregate the cluster centers sent by the plurality of clients to obtain an aggregated cluster center; Send the aggregated cluster center to each of the clients; In response to the feedback information of each of the clients, the feedback information includes the training model parameters of the load prediction model; Attention aggregation is performed on the training model parameters of the load prediction model sent by the plurality of clients to obtain global model parameters of the load prediction model; Distribute the global model parameters of the load prediction model to each of the clients; Attention aggregation is performed on the training model parameters of the load prediction model sent by the plurality of clients, comprising: Obtain initial model parameters; The similarity between the initial model parameter and the training model parameter of the load prediction model corresponding to the same type of training sample of each client is calculated respectively; The global model parameter of the load prediction model corresponding to the same type of training sample of each client is determined according to the similarity and the training model parameter of the load prediction model corresponding to the same type of training sample of each client; The global model parameter of the load prediction model corresponding to the same type of training sample of each client includes the layer global model parameter of each network layer in the load prediction model; the training model parameter of the load prediction model corresponding to the same type of training sample of each client includes the layer training model parameter of each network layer in the load prediction model; and the similarity between the training model parameter of the load prediction model corresponding to the same type of training sample of each client and the initial model parameter includes the layer similarity between the training model parameter and the initial model parameter of each network layer in the load prediction model; The global model parameter of the load prediction model corresponding to the same type of training sample of each client is determined according to the similarity and the training model parameter of the load prediction model corresponding to the same type of training sample of each client, including: The layer training model parameter belonging to the same network layer is extracted from the training model parameter of the load prediction model corresponding to the same type of training sample of each client, and the layer similarity corresponding to the layer training model parameter belonging to the same network layer is extracted from the similarity; The weight parameter attention value of the layer training model parameter of the same network layer of the load prediction model corresponding to the same type of training sample of each client is determined according to the layer similarity; The layer global model parameter of the same network layer of the load prediction model corresponding to the same type of training sample of each client is determined according to the weight parameter attention value and the layer training model parameter.
4. The method of claim 3, wherein, The class cluster centers sent by the plurality of clients are aggregated to obtain aggregated class cluster centers, including: The class cluster centers uploaded by each client are aggregated to obtain aggregated class cluster centers; If it is judged that the change value of the aggregated class cluster center meets the preset change range, the aggregated class cluster center is determined as the final class cluster center, and the aggregation of the class cluster centers fed back by each client is stopped. 5.A device for training a federated learning model based on a cluster-driven mode, characterized in that, Including: The first response module is configured to respond to the joint learning model training; The clustering module is configured to use a preset clustering method to perform data clustering on the local data and obtain class cluster centers, and upload the class cluster centers to the server; The first training module is configured to perform joint learning model training on the local data when receiving the aggregated class cluster centers obtained by aggregating the plurality of class cluster centers fed back by the server; The second training module is configured to stop training to obtain a clustering driven model when the joint learning model training using the local data meets a preset condition; The preset condition is that the iteration number is met or the class cluster center no longer changes. a third training module configured to train a load prediction model according to the cluster-driven model; a second response module configured to respond to feedback from the server; a fourth training module configured to locally train the load prediction model until a convergence condition is reached, thereby obtaining a target federated learning model; performing data clustering on the local data using a preset clustering method to obtain cluster centers, and uploading the cluster centers to the server, including: obtaining a local data set, the local data set including a plurality of training data subsets, each training data subset including a series of training data; decomposing the series of training data in each training data subset respectively to obtain a plurality of decomposition components corresponding to each training data subset, one decomposition component corresponding to one clustering feature; arbitrarily selecting one clustering feature as a clustering target to cluster the training data in the local data set to obtain at least one cluster; extracting cluster centers of each cluster and uploading them to the server; training a load prediction model according to the cluster-driven model, including: clustering the training data in the local data set according to the final cluster centers corresponding to the cluster-driven model to obtain at least one final cluster, the number of final clusters being the same as the number of clusters; dividing the training data corresponding to each final cluster into a class of training samples, and training one load prediction model using each class of training samples. 6.A device for training a federated learning model based on a cluster-driven mode, characterized in that, including: a receiving module configured to receive cluster centers sent by a plurality of clients; a first aggregation module configured to aggregate the cluster centers sent by the plurality of clients to obtain aggregated cluster centers; a first delivery module configured to send the aggregated cluster centers to each of the clients; a response module configured to respond to feedback information from each of the clients, the feedback information including training model parameters of a load prediction model; a second aggregation module configured to perform attention aggregation on the training model parameters of the load prediction model sent by the plurality of clients to obtain global model parameters of the load prediction model; a second delivery module configured to deliver the global model parameters of the load prediction model to each of the clients; performing attention aggregation on the training model parameters of the load prediction model sent by the plurality of clients, including: obtaining initial model parameters; calculating the similarity between the initial model parameters and the training model parameters of each of the clients for the load prediction model corresponding to the same class of training samples; determining the global model parameters of the load prediction model corresponding to the same class of training samples for each of the clients according to the similarity and the training model parameters of the load prediction model corresponding to the same class of training samples for each of the clients; The global model parameters of the load prediction model corresponding to the same type of training sample of each client include layer global model parameters of each network layer in the load prediction model; the training model parameters of the load prediction model corresponding to the same type of training sample of each client include layer training model parameters of each network layer in the load prediction model; and the similarity between the training model parameters of the load prediction model corresponding to the same type of training sample of each client and the initial model parameters includes layer similarity between the training model parameters and the initial model parameters of each network layer in the load prediction model; According to the similarity and the training model parameters of the load prediction model corresponding to the same type of training sample of each client, the global model parameters of the load prediction model corresponding to the same type of training sample of each client are determined, including: Respectively extracting layer training model parameters belonging to the same network layer from the training model parameters of the load prediction model corresponding to the same type of training sample of each client, and extracting layer similarity corresponding to the layer training model parameters belonging to the same network layer from the similarity; According to the layer similarity, a weight parameter attention value of the layer training model parameters of the same network layer of the load prediction model corresponding to the same type of training sample of each client is determined; According to the weight parameter attention value and the layer training model parameters, layer global model parameters of the same network layer of the load prediction model corresponding to the same type of training sample of each client are determined.
Citation Information
Patent Citations
Joint learning method and device for data isomerism
CN113887745A
Training method and device of gas load prediction model
CN113988434A