Federated learning method, data classification method, device, electronic equipment and medium
By comparing the differences in model parameters among participants in federated learning, and employing a parameter aggregation method for classifiers and feature extractors, the problem of imbalanced sample data categories is solved, thereby improving data security and model performance. This approach is applicable to fields such as smart terminals, intelligent transportation, smart healthcare, autonomous driving, and smart cities.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- IFLYTEK CO LTD
- Filing Date
- 2022-11-23
- Publication Date
- 2026-04-17
AI Technical Summary
Existing federated learning methods have limited applicability and low data security when dealing with imbalanced sample data, especially when the local data class distribution is not exposed, making it difficult to effectively solve the problems of model non-convergence and poor performance.
By comparing the differences between the classifier parameters in the first and second model parameters of the participants, the second model parameters are updated. The model parameters are updated by aggregating the classifier parameters with weights and the feature extractor parameters, combined with the distance adjustment between each pair of classes, thus ensuring data security.
By balancing the sample data of each category without needing to obtain the sample category distribution of all participants, the data security of federated learning is improved, and it is applicable to situations where the data category distribution of all participants is unbalanced, thus expanding the scope of application.
Smart Images

Figure CN115907032B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of machine learning technology, and more particularly to a federated learning method, a data classification method, an apparatus, an electronic device, and a medium. Background Technology
[0002] Federated learning (FL) is a distributed machine learning technique in which the data used to train the model can be distributed across multiple participants. However, the local sample data held by different participants is often imbalanced, and this imbalance in training data can lead to poor federated learning performance and model non-convergence.
[0003] To address the issue of imbalanced data categories, existing solutions mostly involve selecting participants for model aggregation based on their data distribution or employing server-side optimization techniques. However, these solutions have limited applicability, being unsuitable for situations where all participants have poorly distributed data categories, or requiring the exposure of local data category distributions, thus reducing data security in federated learning. Summary of the Invention
[0004] This invention provides a federated learning method, a data classification method, an apparatus, an electronic device, and a medium to address the shortcomings of existing solutions for imbalanced sample data categories, such as limited applicability and low security.
[0005] This invention provides a federated learning method, comprising:
[0006] The system receives first model parameters sent by the participant, which are obtained by the participant through parameter iteration on second model parameters based on local sample data.
[0007] Update the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters;
[0008] The updated second model parameters are sent to the participants, so that the participants can iterate the updated second model parameters based on the local sample data to obtain the updated first model parameters and return them, until the federated learning is completed.
[0009] According to the federated learning method provided by the present invention, updating the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters includes:
[0010] Based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters, the aggregate weight of the classifier parameters is determined.
[0011] Based on the aggregated weights of the classifier parameters, the classifier parameters in the first model parameters are aggregated to obtain the aggregated classifier parameters in the second model parameters;
[0012] Update the classifier parameters in the second model parameters based on the classifier aggregation parameters in the second model parameters.
[0013] According to the federated learning method provided by the present invention, updating the classifier parameters in the second model parameters based on the classifier aggregation parameters in the second model parameters includes:
[0014] Based on the distance between the classifier aggregation parameters of each two categories in the second model parameters, the classifier aggregation parameters in the second model parameters are adjusted to obtain the classifier adjustment parameters in the second model parameters;
[0015] Based on the classifier parameters in the second model parameters, adjust the classifier parameters and update the classifier parameters in the second model parameters.
[0016] According to the federated learning method provided by the present invention, adjusting the classifier aggregation parameters in the second model parameters based on the distance between the classifier aggregation parameters of every two categories in the second model parameters to obtain the classifier adjustment parameters in the second model parameters includes:
[0017] The classifier parameter loss function in the second model parameters is determined with the objective of maximizing the distance between the classifier aggregation parameters of each pair of categories.
[0018] Based on the classifier parameter loss function, the classifier aggregation parameter in the second model parameters is adjusted.
[0019] According to the federated learning method provided by the present invention, updating the classifier parameters in the second model parameters based on the classifier aggregation parameters in the second model parameters further includes:
[0020] Based on the amount of local sample data, the feature extractor parameters in the first model parameters are aggregated to obtain the feature extractor aggregated parameters in the second model parameters.
[0021] Update the feature extractor parameters in the second model parameters based on the feature extractor aggregation parameters in the second model parameters.
[0022] This invention also provides a federated learning method, comprising:
[0023] The second model parameters are iterated based on local sample data to obtain the first model parameters, and the first model parameters are returned to the service provider so that the service provider can update the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters.
[0024] The system receives the updated second model parameters sent by the service provider and iterates the updated second model parameters based on the local sample data until the federated learning is completed.
[0025] The present invention also provides a data classification method, comprising:
[0026] Identify the data to be classified;
[0027] The data to be classified is input into the classification model to obtain the classification result output by the classification model. The model parameters of the classification model are obtained based on the federated learning method described above.
[0028] The present invention also provides a federated learning device, comprising:
[0029] The model parameter receiving unit is used to receive the first model parameters sent by the participant, wherein the first model parameters are obtained by the participant through parameter iteration on the second model parameters based on local sample data.
[0030] The model parameter update unit is used to update the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters;
[0031] The model parameter sending unit is used to send the updated second model parameters to the participant, so that the participant can perform parameter iteration on the updated second model parameters based on the local sample data, obtain the updated first model parameters and return them, until the federated learning is completed.
[0032] The present invention also provides a federated learning device, comprising:
[0033] The parameter iteration unit is used to perform parameter iteration on the second model parameters based on local sample data to obtain the first model parameters, and return the first model parameters to the service provider so that the service provider updates the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters.
[0034] The parameter receiving unit is used to receive the updated second model parameters sent by the service provider, and to perform parameter iteration on the updated second model parameters based on the local sample data until the federated learning is completed.
[0035] The present invention also provides a data classification device, comprising:
[0036] Data determination unit, used to determine the data to be classified;
[0037] A data classification unit is used to input the data to be classified into a classification model to obtain the classification result output by the classification model. The model parameters of the classification model are obtained based on the federated learning method described in any of the above.
[0038] The present invention also provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the program to implement any of the federated learning methods or data classification methods described above.
[0039] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the federated learning method or data classification method as described above.
[0040] The present invention also provides a computer program product, including a computer program that, when executed by a processor, implements any of the federated learning methods or data classification methods described above.
[0041] The federated learning method, data classification method, apparatus, electronic device, and medium provided by this invention address the problem of imbalanced sample data. By comparing the differences between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters, the method balances the sample data of each class during the updating of the second model parameters without needing to obtain the sample class distribution of the participants, thereby improving the data security of federated learning. Furthermore, it is applicable to situations where the data class distribution of all participants is imbalanced, thus having a wide range of applications. Attached Figure Description
[0042] To more clearly illustrate the technical solutions in this invention or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of this invention. For those skilled in the art, other drawings can be obtained from these drawings without creative effort.
[0043] Figure 1 This is one of the flowcharts of the federated learning method provided by the present invention;
[0044] Figure 2 This is a flowchart illustrating step 120 in the federated learning method provided by the present invention;
[0045] Figure 3This is the second flowchart of the federated learning method provided by the present invention;
[0046] Figure 4 This is the third flowchart of the federated learning method provided by the present invention;
[0047] Figure 5 This is the fourth flowchart of the federated learning method provided by this invention;
[0048] Figure 6 This is the fifth flowchart of the federated learning method provided by the present invention;
[0049] Figure 7 This is a schematic diagram of the structure of the federated learning system provided by the present invention;
[0050] Figure 8 This is a schematic diagram of the interaction process of the federated learning system provided by the present invention;
[0051] Figure 9 This is a flowchart illustrating the data classification method provided by the present invention;
[0052] Figure 10 This is a schematic diagram of the structure of the federated learning device provided by the present invention;
[0053] Figure 11 This is a schematic diagram of the structure of the federated learning device provided by the present invention;
[0054] Figure 12 This is a schematic diagram of the structure of the data classification device provided by the present invention;
[0055] Figure 13 This is a schematic diagram of the structure of the electronic device provided by the present invention. Detailed Implementation
[0056] To make the objectives, technical solutions, and advantages of this invention clearer, the technical solutions of this invention will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some, not all, of the embodiments of this invention. All other embodiments obtained by those skilled in the art based on the embodiments of this invention without creative effort are within the scope of protection of this invention.
[0057] Federated learning is a distributed training process involving multiple participants. In most cases, the local data sources of different participants are imbalanced, and the imbalance of training data among the participants may lead to poor federated learning performance and model non-convergence. For example, a hospital in a certain region needs to use federated learning to train a disease classification model based on electrocardiogram (ECG). (1) Due to the different strengths of each hospital, Hospital A has many patients with atrial fibrillation and few patients with other disease types, while Hospital B has most patients with myocardial infarction. (2) Due to the different sizes of the hospitals, Hospital C has 100,000 data points, while Hospital D only has 5,000 data points. (3) Since Hospital E is a children's hospital, its patients' ECG data are different from those of patients in non-children's hospitals. This situation is a typical federated learning scenario with imbalanced data.
[0058] Imbalanced data in machine learning has a long history of research in the field of unfederated learning. However, the class imbalance problem in federated learning is significantly different from that in unfederated learning. Specifically, the class imbalance problem in federated learning manifests as: (1) the training data stored locally by each participant is imbalanced; (2) there is global data imbalance. If all participants are considered as a whole, the training data is imbalanced, that is, the data of each participant are not independent and identically distributed.
[0059] For global imbalanced data categories, most existing methods either select participants for model aggregation based on their data distribution or employ server-side optimization techniques to address the problem. These methods have significant drawbacks: (1) they are not suitable for situations where all participants have poorly distributed data categories; (2) they require exposing local data category distributions, which is not permitted in strictly secure federated learning. Due to security requirements, secure federated learning only allows the server to access the number of training samples from each participant.
[0060] In view of the above problems, this invention provides a federated learning method that can be applied to federated learning in scenarios with imbalanced sample classes. The technical concept of this method is that, in order to ensure privacy and security, the service provider cannot obtain the sample class distribution of each participant. The service provider updates the model parameters of the global model by comparing the differences between the classifier parameters of each class before and after training based on local samples, thereby solving the problem of imbalanced data classes without exposing the local data class distribution.
[0061] The federated learning model trained using this method can be applied to various application areas such as smart terminals, intelligent transportation, smart healthcare, autonomous driving, and smart cities to achieve classification functions. The trained federated learning model can process image samples, discrete data samples, text samples, or speech samples, etc., without exhaustive list. Furthermore, the federated learning model can be any type of machine learning model, specifically a neural network, a linear model, or other types of machine learning models.
[0062] The technical solution of the federated learning method of the present invention is described below with reference to the accompanying drawings. Figure 1 This is one of the flowcharts illustrating the federated learning method provided by this invention. This method is applied to service providers within a federated learning framework, and the service provider can specifically be a central server. For example... Figure 1 As shown, the method may include the following steps:
[0063] Step 110: Receive the first model parameters sent by the participant. The first model parameters are obtained by the participant through parameter iteration on the second model parameters based on local sample data.
[0064] Specifically, in the process of federated learning, there are two main roles: the service provider and at least two participants.
[0065] In each iteration of federated learning, the service provider sends the second model parameters (the service provider's model parameters) to the participants. The participants then iterate through the second model parameters based on their local sample data. After the iteration is complete, they obtain the first model parameters (the participant's model parameters after the iteration is complete). In other words, the second model parameters are the participant's model parameters before model training, and the first model parameters are the participant's model parameters after model training.
[0066] Subsequently, each participant sends the first model parameters obtained after training the model based on local sample data to the service provider, which then receives the first model parameters sent by the participants.
[0067] It should be noted that when the service provider sends the second model parameters to the participants, it sends all parameters included in the second model parameters, such as all classifier parameters and feature extractor parameters, but not necessarily all participants. For example, the server can send all parameters to some participants, or it can send all parameters to all participants, depending on the needs.
[0068] Step 120: Update the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters.
[0069] Specifically, in the traditional federated learning process, after receiving the first model parameters sent by the participants, the service provider aggregates these parameters and updates the second model parameters based on the aggregated parameters. To address the global data class imbalance problem, participants are selected for model parameter aggregation based on their data distribution. However, this method requires exposing the local data class distribution of each participant, reducing data security in federated learning.
[0070] Considering that the federated learning method provided in this embodiment of the invention is mainly applied to scenarios with imbalanced sample data, and the trained model can achieve classification functionality, the model can be split into a feature extractor and a classifier. Accordingly, both the first model parameters and the second model parameters include feature extractor parameters and classifier parameters. Therefore, in the process of updating the second model parameters, the method provided in this embodiment of the invention can first update the feature extractor parameters and classifier parameters separately, and then update the second model parameters based on the updated feature extractor parameters and classifier parameters.
[0071] Furthermore, there can be multiple types of classifiers, and the classifier parameters can specifically include the classifier parameters for each category. During the update of classifier parameters, to ensure privacy and security, the service provider cannot obtain the sample category distribution of the participants. Moreover, during the aggregation of classifier parameters, the category with the larger number of samples should have a higher aggregation weight.
[0072] Considering that during parameter iteration by the participants, the larger the number of samples for a class, the higher the prediction accuracy for that class, the smaller the gradient for that class, and the smaller the update of the classifier parameters for that class. Therefore, during a round of federated learning iteration, the magnitude of the update of the classifier parameters for a certain class can, to some extent, reflect the number of samples for that class.
[0073] Since the classifier parameters in the second model parameters are the classifier parameters of the participants before model training, and the classifier parameters in the first model parameters are the classifier parameters of the participants after model training, the difference between the classifier parameters of a certain category in the first model parameters and the corresponding classifier parameters of the second model parameters can characterize the magnitude of the update of the classifier parameters of that category during a round of federated learning iterations.
[0074] It should be noted that the differences here refer to the classifier parameters of the same participant and the same category. The greater the difference between the classifier parameters of one category in the first model parameters and the corresponding classifier parameters of the second model parameters, the fewer the samples in that category. Therefore, when updating the second model parameters, the aggregate weight of the classifier parameters of that participant for that category will be smaller. Conversely, the smaller the difference between the classifier parameters of one category in the first model parameters and the corresponding classifier parameters of the second model parameters, the more the samples in that category will be. Therefore, when updating the second model parameters, the aggregate weight of the classifier parameters of that participant for that category will be larger.
[0075] Step 130: The updated second model parameters are sent to the participants so that they can iterate on the updated second model parameters based on local sample data to obtain the updated first model parameters and return them, until federated learning is completed.
[0076] Specifically, the service provider obtains the updated second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters, and then sends the updated second model parameters to the participants. The participants use the updated second model parameters as the initial parameters for model training in the next iteration.
[0077] Subsequently, each participant iterates over the updated second model parameters based on its local sample data to obtain the updated first model parameters, which are then returned to the server until the federated learning process is complete. The completion of federated learning can be achieved either by the convergence of the local models of each participant or by reaching a pre-defined number of iterations.
[0078] The method provided in this invention addresses the problem of imbalanced sample data. By comparing the differences between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters, it balances the sample data of each class during the update of the second model parameters without needing to obtain the sample class distribution of the participants, thereby improving the data security of federated learning. Furthermore, it is applicable to situations where the data class distribution of all participants is imbalanced, making it widely applicable.
[0079] Based on the above embodiments, Figure 2 This is a flowchart illustrating step 120 in the federated learning method provided by this invention, as shown below. Figure 2 As shown, step 120 specifically includes:
[0080] Step 121: Determine the aggregate weight of the classifier parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters;
[0081] Step 122: Aggregate the classifier parameters in the first model parameters based on the aggregated weights of the classifier parameters to obtain the aggregated classifier parameters in the second model parameters;
[0082] Step 123: Update the classifier parameters in the second model parameters based on the classifier aggregation parameters in the second model parameters.
[0083] Specifically, the classifier parameters may include classifier parameters for each category. As described in the previous embodiment, the greater the difference between the classifier parameters for any category in the first model parameters and the classifier parameters for that category in the second model parameters, the smaller the aggregate weight of the classifier parameters for that category; conversely, the smaller the difference between the classifier parameters for any category in the first model parameters and the classifier parameters for that category in the second model parameters, the larger the aggregate weight of the classifier parameters for that category. This allows determination of the aggregate weight of the classifier parameters for any category in the first model parameters sent by any participant.
[0084] Based on the aggregated weights of the classifier parameters for each category in the first model parameters of each participant, the classifier parameters in the first model parameters of each participant can be aggregated to obtain the aggregated classifier parameters in the second model parameters.
[0085] Subsequently, the classifier parameters in the second model parameters are updated based on the classifier aggregation parameters in the second model parameters. The classifier aggregation parameters in the second model parameters can be used as the updated classifier parameters, or the classifier aggregation parameters can be further adjusted and optimized to obtain the updated classifier parameters. This embodiment of the invention does not specifically limit this approach.
[0086] In one embodiment, the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters can be represented by a difference value. The classifier parameter aggregation process can then be represented as follows:
[0087]
[0088]
[0089]
[0090]
[0091] in, Let represent the classifier parameters for class j in the second model parameters during the t-th iteration of federated learning; This represents the classifier parameter of category j in the first model parameter of the i-th participant in the t-th iteration; a represents the second norm of the difference between the classifier parameter of class j in the first model parameters and the classifier parameter of class j in the second model parameters of the i-th participant in the t-th iteration; ij This represents the aggregate weights of the classifier parameters for class j in the first model parameters of the i-th participant, where m represents the number of participants. This represents the classifier aggregation parameter for class j in the second model parameters during the (t+1)th iteration of federated learning. This represents the classifier aggregation parameter in the second model parameters, where C represents the number of classes in the classifier.
[0092] Based on any of the above embodiments Figure 3 This is the second flowchart of the federated learning method provided by this invention, as shown below. Figure 3 As shown, step 123 specifically includes:
[0093] Step 123-1: Based on the distance between the classifier aggregation parameters of each pair of categories in the second model parameters, adjust the classifier aggregation parameters in the second model parameters to obtain the classifier adjustment parameters in the second model parameters;
[0094] Step 123-2: Adjust the classifier parameters based on the classifier parameters in the second model parameters, and update the classifier parameters in the second model parameters.
[0095] Specifically, considering that some participants may only have data for some categories—meaning that a certain category may not have any sample data at all—the classifier parameters for that category cannot be updated and may even interfere with the update of classifier parameters for other categories. To improve the classification performance of the classifier and avoid the impact of missing participant categories on model aggregation, the service provider can further adjust and optimize the classifier aggregation parameters based on the classifier aggregation parameters obtained from the second model parameters.
[0096] The specific adjustment method is based on the distance between the aggregated parameters of the classifiers for each pair of categories in the second model parameters. The larger the distance between the aggregated parameters of the classifiers for each pair of categories, the lower the probability of adjustment; conversely, the smaller the distance, the higher the probability of adjustment. This ensures that the distance between the classifiers of each category is greater after adjustment, preventing mutual interference. For example, a minimum distance between the aggregated parameters of the classifiers for each pair of categories can be preset. If the distance between the aggregated parameters of the classifiers for any two categories is greater than this preset minimum distance, it is considered that the aggregated parameters of the classifiers for those two categories maintain a good distribution; otherwise, it is considered that the aggregated parameters of the classifiers for those two categories need to be adjusted.
[0097] Based on this, the classifier parameters in the second model parameters are updated by adjusting the classifier parameters. For example, the adjusted classifier parameters can be used as the classifier parameters in the updated second model parameters.
[0098] The method provided in this embodiment of the invention adjusts the classifier aggregation parameters in the second model parameters based on the distance between the classifier aggregation parameters of every two categories. This can avoid the impact of missing participant categories on model aggregation, resulting in better model aggregation performance when solving the class imbalance problem.
[0099] Based on any of the above embodiments Figure 4 This is the third flowchart of the federated learning method provided by this invention, as shown below. Figure 4 As shown, step 123-1 specifically includes:
[0100] Steps 123-11: Determine the classifier parameter loss function in the second model parameters with the goal of maximizing the distance between the classifier aggregation parameters of each pair of categories.
[0101] Steps 123-12: Based on the classifier parameter loss function, adjust the classifier aggregation parameter in the second model parameters.
[0102] Specifically, in order to adjust the classifier aggregation parameters in the second model parameters, the gradient of the classifier parameters can be calculated through the classifier parameter loss function. The classifier parameter loss function can be determined with the goal of maximizing the distance between the classifier aggregation parameters of each two categories.
[0103] In one embodiment, the classifier parameter loss function can be expressed as follows:
[0104]
[0105]
[0106] in, This represents the sum of distance losses between the aggregate parameters of the classifiers for each pair of categories; This represents the classifier aggregation parameter for class c in the second model parameters during the (t+1)th iteration of federated learning. This indicates that in the (t+1)th iteration of federated learning, the class c in the second model parameters... ′ The classifier aggregation parameters; margin represents the minimum distance between the predefined classifier aggregation parameters of every two categories; C represents the number of categories in the classifier; d represents the distance formula (e.g., cosine distance, Euclidean distance, etc.); This represents the classifier aggregation parameter in the second model parameters; w t+1This represents the classifier parameters in the updated second model parameters; β represents the update step size of the classifier parameters in the second model parameters. Indicates according to Calculated The gradient.
[0107] Based on any of the above embodiments Figure 5 This is the fourth flowchart of the federated learning method provided by this invention, as follows: Figure 5 As shown, the method also includes:
[0108] Step 510: Based on the amount of local sample data, aggregate the feature extractor parameters in the first model parameters to obtain the aggregated feature extractor parameters in the second model parameters;
[0109] Step 520: Update the feature extractor parameters in the second model parameters based on the feature extractor aggregation parameters in the second model parameters.
[0110] Specifically, in addition to updating the classifier parameters in the second model parameters, the feature extractor parameters in the second model parameters can also be updated. To update the feature extractor, the feature extractors of each participant can first be aggregated, and the update can be performed based on the parameter set of the feature extractor.
[0111] The aggregation of feature extractors can be based on the amount of local sample data from each participant. The larger the amount of local sample data, the greater the aggregation weight; conversely, the smaller the amount of local sample data, the smaller the aggregation weight.
[0112] In one embodiment, the aggregation weight of the feature extractor parameters for each participant is the ratio of the amount of local sample data for each participant to the total amount of all sample data. The aggregation process can be represented as follows:
[0113]
[0114]
[0115] Then, W t+1 =[θ t+1 ,w t+1 ].
[0116] Where, n i Let m represent the amount of local sample data for the i-th participant, and m represent the number of participants. Let θ represent the feature extractor parameters in the first model parameters of the i-th participant in the t-th iteration of federated learning. t+1W represents the feature extractor aggregation parameter in the second model parameters in the t-th iteration, i.e., the feature extractor parameter in the second model parameters in the (t+1)-th iteration; t+1 This represents the updated parameters of the second model.
[0117] The method provided in this embodiment of the invention updates both the classifier parameters and the feature extractor parameters in the second model parameters, which can better solve the problem of imbalanced sample data classes.
[0118] Based on any of the above embodiments Figure 6 This is the fifth flowchart of the federated learning method provided by this invention. This method applies to participating parties, such as... Figure 6 As shown, the method may include the following steps:
[0119] Step 610: Iterate the parameters of the second model based on the local sample data to obtain the first model parameters, and send the first model parameters to the service provider so that the service provider can update the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters.
[0120] Step 620: Receive the updated second model parameters returned by the service provider, and iterate the updated second model parameters based on the local sample data until federated learning is completed.
[0121] Specifically, in the process of federated learning, there are two main roles: the service provider and at least two participants.
[0122] In each iteration of federated learning, the service provider sends the second model parameters (the service provider's model parameters) to the participants. The participants then iterate through the second model parameters based on their local sample data. After the iteration is complete, they obtain the first model parameters (the participant's model parameters after the iteration is complete). In other words, the second model parameters are the participant's model parameters before model training, and the first model parameters are the participant's model parameters after model training.
[0123] Subsequently, the participant sends the first model parameters obtained after training the model based on local sample data to the service provider, and the service provider receives the first model parameters sent by the participant.
[0124] In traditional federated learning processes, after receiving the first set of model parameters from the participants, the service provider aggregates these parameters and updates the second set of model parameters based on the aggregated parameters. To address the global imbalance in data categories, participants are selected for model parameter aggregation based on their data distribution. However, this method requires exposing the local data category distribution of each participant, reducing data security in federated learning.
[0125] Considering that the federated learning method provided in this embodiment of the invention is mainly applied to scenarios with imbalanced sample data, and the trained model can achieve classification functionality, the model can be split into a feature extractor and a classifier. Accordingly, both the first model parameters and the second model parameters include feature extractor parameters and classifier parameters. Therefore, in the process of updating the second model parameters, the method provided in this embodiment of the invention can first update the feature extractor parameters and classifier parameters separately, and then update the second model parameters based on the updated feature extractor parameters and classifier parameters.
[0126] Furthermore, there can be multiple types of classifiers, and the classifier parameters can specifically include the classifier parameters for each category. During the update of classifier parameters, to ensure privacy and security, the service provider cannot obtain the sample category distribution of the participants. Moreover, during the aggregation of classifier parameters, the category with the larger number of samples should have a higher aggregation weight.
[0127] Considering that during parameter iteration by the participants, the larger the number of samples for a class, the higher the prediction accuracy for that class, the smaller the gradient for that class, and the smaller the update of the classifier parameters for that class. Therefore, during a round of federated learning iteration, the magnitude of the update of the classifier parameters for a certain class can, to some extent, reflect the number of samples for that class.
[0128] Since the classifier parameters in the second model parameters are the classifier parameters of the participants before model training, and the classifier parameters in the first model parameters are the classifier parameters of the participants after model training, the difference between the classifier parameters of a certain category in the first model parameters and the corresponding classifier parameters of the second model parameters can characterize the magnitude of the update of the classifier parameters of that category during a round of federated learning iterations.
[0129] It should be noted that the differences here refer to the classifier parameters of the same participant and the same category. The greater the difference between the classifier parameters of one category in the first model parameters and the corresponding classifier parameters of the second model parameters, the fewer the samples in that category. Therefore, when updating the second model parameters, the aggregate weight of the classifier parameters of that participant for that category will be smaller. Conversely, the smaller the difference between the classifier parameters of one category in the first model parameters and the corresponding classifier parameters of the second model parameters, the more the samples in that category will be. Therefore, when updating the second model parameters, the aggregate weight of the classifier parameters of that participant for that category will be larger.
[0130] Based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters, the service provider obtains the updated second model parameters and returns the updated second model parameters to each participant. The participants use the updated second model parameters as the initial parameters for model training in the next iteration.
[0131] Subsequently, each participant iterates over the updated second model parameters based on its local sample data to obtain the updated first model parameters, which are then returned to the server until the federated learning process is complete. The completion of federated learning can be achieved either by the convergence of the local models of each participant or by reaching a pre-defined number of iterations.
[0132] The method provided in this invention addresses the problem of imbalanced sample data. By comparing the differences between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters, it balances the sample data of each class during the update of the second model parameters without needing to obtain the sample class distribution of the participants, thereby improving the data security of federated learning. Furthermore, it is applicable to situations where the data class distribution of all participants is imbalanced, making it widely applicable.
[0133] Furthermore, to further alleviate the class imbalance problem among participating parties, each party can process the original local sample data, specifically through data augmentation or sampling, to obtain processed sample data. Data augmentation methods include, but are not limited to, geometric transformations, color transformations, and generating new samples; sampling includes, but is not limited to, upsampling and downsampling. This can be specifically represented as follows:
[0134]
[0135] in, D represents the local sample data processed by the i-th participant; i S represents the original local sample data of the i-th participant; S(·) represents the data augmentation or sampling method.
[0136] Optionally, participants can iterate the parameters of the second model based on local sample data, and can set a cost-sensitive learning method. In the t-th iteration of federated learning, the process of parameter iteration by the participants can be represented as:
[0137] W i t =W t
[0138] W i t =W i t -ηg(W i t )
[0139]
[0140] Among them, W t W represents the second model parameter in the t-th iteration; i t Represents the first model parameters of the i-th participant; η represents the model update step size of the i-th participant, g(W i t ) represents the model gradient of the i-th participant; This represents the feature extractor parameters in the first model parameters of the i-th participant; This represents the classifier parameters in the first model parameters of the i-th participant.
[0141] It can be represented as a c×d matrix, where c represents the number of classes in the classifier and d represents the feature dimension extracted by the feature extractor, with each row corresponding to a class.
[0142] Based on any of the above embodiments, the present invention also provides a federated learning system. Figure 7 This is a schematic diagram of the structure of the federated learning system provided by the present invention, as shown below. Figure 7 As shown, the system includes participants and service providers, where the participants include a data acquisition module and a model training module, and the service providers include a parameter aggregation module and a parameter update module.
[0143] The system comprises three modules: a data acquisition module for enhancing and sampling local sample data; a model training module for iterating the parameters of the second model based on the local sample data to obtain the parameters of the first model; a parameter aggregation module for aggregating the first model parameters sent by each participant; and a parameter update module for updating the second model parameters. The data acquisition and model training modules address data imbalance within each participant, while the parameter aggregation and parameter update modules address global data imbalance.
[0144] Figure 8 This is a schematic diagram of the interaction process of the federated learning system provided by the present invention. For detailed descriptions of each process in the system, please refer to the description of the above embodiments, which will not be repeated here.
[0145] The system provided by this invention can simultaneously solve the problems of client-side data imbalance and global data imbalance, while ensuring data security.
[0146] Based on any of the above embodiments Figure 9 This is a flowchart illustrating the data classification method provided by the present invention, as shown below. Figure 9 As shown, the method may include:
[0147] Step 910: Determine the data to be classified;
[0148] Step 920: Input the data to be classified into the classification model to obtain the classification result output by the classification model. The model parameters of the classification model are obtained based on the federated learning method described above.
[0149] Specifically, an initial model can be constructed first. The model structure of the initial model can be any type of machine learning model, specifically a neural network, a linear model, or other types of machine learning model, and the model parameters of the initial model can be set. The initial model can be deployed on the participating party or on the service provider; this embodiment of the invention does not specifically limit this.
[0150] Based on this, the initial model is trained to obtain a classification model after training. The model parameters of the classification model are the second model parameters obtained according to the federated learning method described above.
[0151] Here, the application areas of the data to be classified can be various sub-business scenarios in fields such as smart terminals, intelligent transportation, smart healthcare, autonomous driving, and smart cities. The data to be classified can be various types of data such as image data, discrete data, text, or voice. By inputting the data to be classified into a classification model trained based on the federated learning method, the classification result output by the classification model can be obtained.
[0152] The data classification method provided in this invention can improve the accuracy of data classification while ensuring data security.
[0153] In one embodiment, several experiments were conducted on the CIFAR10 public dataset to verify the effectiveness of the federated learning method provided by the present invention and to compare it with federated learning methods in the prior art.
[0154] Two imbalanced datasets were obtained using CIFAR10 sampling, belonging to Participant 1 and Participant 2 respectively. The number of samples in each class is imbalanced in both Participant 1 and Participant 2; specifically, Participant 2 is missing samples from one class. In the implementation, a set of data augmentation techniques involving ensemble transformations and cost-sensitive learning methods were implemented. The model used was LeNet, and the optimizer was SGD.
[0155] The experimental results of participant 1 and participant 2 under the same training and testing environment are shown in Table 1.
[0156] Table 1
[0157]
[0158]
[0159] Among them, Scheme 1, Scheme 2 and Scheme 3 are all federated learning schemes in the existing technology, and the F1 score refers to the combined value of precision and recall.
[0160] Additionally, training was performed on datasets owned by both Participant 1 and Participant 2, and the test results are shown in Local Training (LT). The accuracy, precision, recall, and F1 score of LT are 0.77, 0.75, 0.75, and 0.75, respectively.
[0161] Based on the above results, it can be seen that the federated learning provided by the embodiments of the present invention outperforms existing federated learning methods on the imbalanced dataset and is lower than LT. The results effectively demonstrate that the present invention has significant advantages in solving the federated learning problem of imbalanced samples.
[0162] Based on any of the above embodiments Figure 10 This is a schematic diagram of the structure of the federated learning device provided by the present invention, as shown below. Figure 10 As shown, the federated learning device includes:
[0163] The model parameter receiving unit 1010 is used to receive the first model parameters sent by the participant. The first model parameters are obtained by the participant through parameter iteration on the second model parameters based on local sample data.
[0164] The model parameter update unit 1020 is used to update the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters.
[0165] The model parameter sending unit 1030 is used to send the updated second model parameters to the participants, so that the participants can perform parameter iteration on the updated second model parameters based on local sample data, obtain the updated first model parameters and return them, until the federated learning is completed.
[0166] The federated learning apparatus provided in this invention addresses the problem of imbalanced sample data. By comparing the differences between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters, it balances the sample data of each class during the updating of the second model parameters without needing to obtain the sample class distribution of the participants, thereby improving the data security of federated learning. Furthermore, it is applicable to situations where the data class distribution of all participants is imbalanced, making it widely applicable.
[0167] Based on any of the above embodiments, the model parameter update unit 1020 is specifically used for:
[0168] Based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters, the aggregate weight of the classifier parameters is determined.
[0169] Based on the aggregated weights of the classifier parameters, the classifier parameters in the first model parameters are aggregated to obtain the aggregated classifier parameters in the second model parameters;
[0170] Update the classifier parameters in the second model parameters based on the classifier aggregation parameters in the second model parameters.
[0171] Based on any of the above embodiments, the model parameter update unit 1020 is specifically used for:
[0172] Based on the distance between the classifier aggregation parameters of each two categories in the second model parameters, the classifier aggregation parameters in the second model parameters are adjusted to obtain the classifier adjustment parameters in the second model parameters;
[0173] Based on the classifier parameters in the second model parameters, adjust the classifier parameters and update the classifier parameters in the second model parameters.
[0174] Based on any of the above embodiments, the model parameter update unit 1020 is specifically used for:
[0175] The classifier parameter loss function in the second model parameters is determined with the objective of maximizing the distance between the classifier aggregation parameters of each pair of categories.
[0176] Based on the classifier parameter loss function, the classifier aggregation parameter in the second model parameters is adjusted.
[0177] Based on any of the above embodiments, the model parameter update unit 1020 is specifically used for:
[0178] Based on the amount of local sample data, the feature extractor parameters in the first model parameters are aggregated to obtain the feature extractor aggregated parameters in the second model parameters.
[0179] Update the feature extractor parameters in the second model parameters based on the feature extractor aggregation parameters in the second model parameters.
[0180] Based on any of the above embodiments Figure 11 This is a schematic diagram of the structure of the federated learning device provided by the present invention, as shown below. Figure 11 As shown, the federated learning device includes:
[0181] The parameter iteration unit 1110 is used to perform parameter iteration on the second model parameters based on local sample data to obtain the first model parameters, and return the first model parameters to the service provider so that the service provider can update the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters.
[0182] The parameter receiving unit 1120 is used to receive the updated second model parameters sent by the service provider, and to perform parameter iteration on the updated second model parameters based on local sample data until federated learning is completed.
[0183] Based on any of the above embodiments Figure 12 This is a schematic diagram of the data classification device provided by the present invention, as shown below. Figure 12 As shown, the data classification device includes:
[0184] Data determination unit 1210 is used to determine the data to be classified;
[0185] The data classification unit 1220 is used to input the data to be classified into the classification model and obtain the classification result output by the classification model. The model parameters of the classification model are obtained based on the federated learning method described above.
[0186] The data classification device provided in this embodiment of the invention can improve the accuracy of data classification while ensuring data security.
[0187] Figure 13 An example is a schematic diagram of the physical structure of an electronic device, such as... Figure 13As shown, the electronic device may include: a processor 1310, a communications interface 1320, a memory 1330, and a communication bus 1340, wherein the processor 1310, the communications interface 1320, and the memory 1330 communicate with each other via the communication bus 1340. The processor 1310 can call logical instructions in the memory 1330 to execute a federated learning method, which includes:
[0188] The system receives first model parameters sent by the participant, which are obtained by the participant through parameter iteration on second model parameters based on local sample data.
[0189] Update the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters;
[0190] The updated second model parameters are sent to the participants, so that the participants can iterate the updated second model parameters based on the local sample data to obtain the updated first model parameters and return them, until the federated learning is completed.
[0191] Furthermore, the logical instructions in the aforementioned memory 1330 can be implemented as software functional units and, when sold or used as independent products, can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present invention, essentially, or the part that contributes to the prior art, or a part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of the present invention. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0192] On the other hand, the present invention also provides a computer program product, the computer program product comprising a computer program that can be stored on a non-transitory computer-readable storage medium, wherein when the computer program is executed by a processor, the computer is able to execute the federated learning method provided by the above methods, the method comprising:
[0193] The system receives first model parameters sent by the participant, which are obtained by the participant through parameter iteration on second model parameters based on local sample data.
[0194] Update the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters;
[0195] The updated second model parameters are sent to the participants, so that the participants can iterate the updated second model parameters based on the local sample data to obtain the updated first model parameters and return them, until the federated learning is completed.
[0196] In another aspect, the present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, is implemented to perform the federated learning method provided by the methods described above, the method comprising:
[0197] The system receives first model parameters sent by the participant, which are obtained by the participant through parameter iteration on second model parameters based on local sample data.
[0198] Update the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters;
[0199] The updated second model parameters are sent to the participants, so that the participants can iterate the updated second model parameters based on the local sample data to obtain the updated first model parameters and return them, until the federated learning is completed.
[0200] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs. Those skilled in the art can understand and implement this without any creative effort.
[0201] Through the above description of the embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus necessary general-purpose hardware platforms, and of course, it can also be implemented by hardware. Based on this understanding, the above technical solutions, in essence or the part that contributes to the prior art, can be embodied in the form of a software product. This computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, magnetic disk, optical disk, etc., and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute the methods described in the various embodiments or some parts of the embodiments.
[0202] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of the present invention.
Claims
1. A federated learning method, characterized in that, include: The system receives first model parameters sent by the participant, which are obtained by the participant through parameter iteration on second model parameters based on local sample data. The second model parameter is the model parameter of the participant before model training, and the first model parameter is the model parameter of the participant after model training. Update the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters; The updated second model parameters are sent to the participants, so that the participants can perform parameter iteration on the updated second model parameters based on the local sample data to obtain the updated first model parameters and return them, until the federated learning is completed; The step of updating the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters includes: For the same participant, the aggregate weight of the classifier parameters of any category in the first model parameters is determined based on the difference between the classifier parameters of any category in the first model parameters and the classifier parameters of any category in the second model parameters; wherein, the smaller the difference, the larger the aggregate weight. Based on the aggregated weights of the classifier parameters of any category of each participant, the classifier parameters of any category in the first model parameters of each participant are aggregated to obtain the aggregated classifier parameters of any category in the second model parameters. Based on the classifier aggregation parameters of all categories in the second model parameters, update the classifier parameters in the second model parameters; The classifier parameter aggregation process is represented as follows: ; ; ; ; in, The first sign of federated learning In the round of iteration, the categories in the second model parameters The classifier parameters; Indicates the first In the first iteration, the... The category in the first model parameter of each participant The classifier parameters; Representing the In the first iteration, the... The category in the first model parameter of each participant The classifier parameters, and the categories in the second model parameters. The second norm of the difference between the classifier parameters; Indicates the first The category in the first model parameter of each participant The aggregate weights of the classifier parameters, Indicates the number of participants. The first sign of federated learning In the round of iteration, the categories in the second model parameters The classifier aggregation parameters; This represents the classifier aggregation parameter in the second model parameters. This indicates the number of categories in the classifier.
2. The federated learning method of claim 1, wherein, The step of updating the classifier parameters in the second model parameters based on the classifier aggregation parameters in the second model parameters includes: Based on the distance between the classifier aggregation parameters of every two categories in the second model parameters, the classifier aggregation parameters in the second model parameters are adjusted to obtain the classifier adjustment parameters in the second model parameters; Based on the classifier parameters in the second model parameters, adjust the classifier parameters and update the classifier parameters in the second model parameters.
3. The federated learning method of claim 2, wherein, The adjustment of the classifier aggregation parameters in the second model parameters based on the distance between the classifier aggregation parameters of every two categories includes: The classifier parameter loss function in the second model parameters is determined with the objective of maximizing the distance between the classifier aggregation parameters of each pair of categories. Based on the classifier parameter loss function, the classifier aggregation parameter in the second model parameters is adjusted.
4. The federated learning method of claim 1, wherein, The step of updating the classifier parameters in the second model parameters based on the classifier aggregation parameters in the second model parameters further includes: Based on the amount of local sample data, the feature extractor parameters in the first model parameters are aggregated to obtain the feature extractor aggregated parameters in the second model parameters. Update the feature extractor parameters in the second model parameters based on the feature extractor aggregation parameters in the second model parameters.
5. A federated learning method, comprising: include: The second model parameters are iterated based on local sample data to obtain the first model parameters, and the first model parameters are sent to the service provider so that the service provider updates the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters; wherein, the smaller the difference, the larger the aggregation weight; Receive the updated second model parameters returned by the service provider, and perform parameter iteration on the updated second model parameters based on the local sample data until the federated learning is completed; When updating the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters, the service provider first determines the aggregate weight of the classifier parameters of any category in the first model parameters of the same participant based on the difference between the classifier parameters of any category in the first model parameters of the same participant and the classifier parameters of any category in the second model parameters; then, based on the aggregate weight of the classifier parameters of any category in the first model parameters of each participant, the classifier parameters of any category in the first model parameters of each participant are aggregated to obtain the aggregated classifier parameters of any category in the second model parameters; finally, the classifier parameters in the second model parameters are updated based on the aggregated classifier parameters of all categories in the second model parameters. The classifier parameter aggregation process is represented as follows: ; ; ; ; in, The first sign of federated learning In the round of iteration, the categories in the second model parameters The classifier parameters; Indicates the first In the first iteration, the... The category in the first model parameter of each participant The classifier parameters; Representing the In the first iteration, the... The category in the first model parameter of each participant The classifier parameters, and the categories in the second model parameters. The second norm of the difference between the classifier parameters; Indicates the first The category in the first model parameter of each participant The aggregate weights of the classifier parameters, Indicates the number of participants. The first sign of federated learning In the round of iteration, the categories in the second model parameters The classifier aggregation parameters; This represents the classifier aggregation parameter in the second model parameters. This indicates the number of categories in the classifier.
6. A data classification method characterized by, include: Identify the data to be classified; The data to be classified is input into the classification model to obtain the classification result output by the classification model. The model parameters of the classification model are obtained based on the federated learning method as described in any one of claims 1 to 5.
7. A federated learning apparatus, comprising: include: The model parameter receiving unit is used to receive first model parameters sent by the participant, wherein the first model parameters are obtained by the participant through parameter iteration on second model parameters based on local sample data; the second model parameters are the model parameters of the participant before model training, and the first model parameters are the model parameters of the participant after model training. The model parameter update unit is used to update the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters; The model parameter sending unit is used to send the updated second model parameters to the participant, so that the participant can perform parameter iteration on the updated second model parameters based on the local sample data, obtain the updated first model parameters and return them, until the federated learning is completed; The model parameter update unit is specifically used for: For the same participant, the aggregate weight of the classifier parameters of any category in the first model parameters is determined based on the difference between the classifier parameters of any category in the second model parameters and the classifier parameters of any category in the first model parameters; wherein, the smaller the difference, the larger the aggregate weight. Based on the aggregated weights of the classifier parameters of any category of each participant, the classifier parameters of any category in the first model parameters of each participant are aggregated to obtain the aggregated classifier parameters of any category in the second model parameters. Based on the classifier aggregation parameters of all categories in the second model parameters, update the classifier parameters in the second model parameters; The classifier parameter aggregation process is represented as follows: ; ; ; ; in, The first sign of federated learning In the round of iteration, the categories in the second model parameters The classifier parameters; Indicates the first In the first iteration, the... The category in the first model parameter of each participant The classifier parameters; Representing the In the first iteration, the... The category in the first model parameter of each participant The classifier parameters, and the categories in the second model parameters. The second norm of the difference between the classifier parameters; Indicates the first The category in the first model parameter of each participant The aggregate weights of the classifier parameters, Indicates the number of participants. The first sign of federated learning In the round of iteration, the categories in the second model parameters The classifier aggregation parameters; This represents the classifier aggregation parameter in the second model parameters. This indicates the number of categories in the classifier.
8. A federated learning apparatus, comprising: include: The parameter iteration unit is used to iterate the second model parameters based on local sample data to obtain the first model parameters, and send the first model parameters to the service provider so that the service provider updates the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters; wherein, the smaller the difference, the larger the aggregation weight; The parameter receiving unit is used to receive the updated second model parameters returned by the service provider, and to perform parameter iteration on the updated second model parameters based on the local sample data until the federated learning is completed. When updating the second model parameters based on the difference between the classifier parameters in the first model parameters and the classifier parameters in the second model parameters, the service provider first determines the aggregate weight of the classifier parameters of any category in the first model parameters of the same participant based on the difference between the classifier parameters of any category in the first model parameters of the same participant and the classifier parameters of any category in the second model parameters; then, based on the aggregate weight of the classifier parameters of any category in the first model parameters of each participant, the classifier parameters of any category in the first model parameters of each participant are aggregated to obtain the aggregated classifier parameters of any category in the second model parameters; finally, the classifier parameters in the second model parameters are updated based on the aggregated classifier parameters of all categories in the second model parameters. The classifier parameter aggregation process is represented as follows: ; ; ; ; in, The first sign of federated learning In the round of iteration, the categories in the second model parameters The classifier parameters; Indicates the first In the first iteration, the... The category in the first model parameter of each participant The classifier parameters; Representing the In the first iteration, the... The category in the first model parameter of each participant The classifier parameters, and the categories in the second model parameters. The second norm of the difference between the classifier parameters; Indicates the first The category in the first model parameter of each participant The aggregate weights of the classifier parameters, Indicates the number of participants. The first sign of federated learning In the round of iteration, the categories in the second model parameters The classifier aggregation parameters; This represents the classifier aggregation parameter in the second model parameters. This indicates the number of categories in the classifier.
9. A data classification apparatus characterized by comprising: include: Data determination unit, used to determine the data to be classified; A data classification unit is used to input the data to be classified into a classification model to obtain the classification result output by the classification model, wherein the model parameters of the classification model are obtained based on the federated learning method as described in any one of claims 1 to 5.
10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the program, it implements the federated learning method as described in any one of claims 1 to 5 or the data classification method as described in claim 6. 11.A non-transitory computer-readable storage medium having stored thereon a computer program. When the computer program is executed by a processor, it implements the federated learning method as described in any one of claims 1 to 5 or the data classification method as described in claim 6.
Citation Information
Patent Citations
Federal learning model training method, device, system, storage medium and equipment
CN113837399A
Classification model training and data classification method and device and electronic equipment
CN114648666A