Federal learning global class distribution optimization method and device, storage medium and equipment
Patent Information
- Application Number
- CN202610983871.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-03
- Publication Date
- 2026-09-08
- Estimated Expiration
- 2046-07-03
AI Technical Summary
[0004]本申请的目的旨在至少能解决上述的技术缺陷之一,特别是现有技术中各站点或终端形成的数据类别分布通常具有明显长尾特征,少数故障类别和稀有异常工况样本不足会导致联邦模型对关键风险类别的识别能力下降的技术缺陷
[0042]The federated learning global class distribution optimization method, apparatus, storage medium, and device provided in this application first calculate the global distribution balance by a central server before federated learning training. When the balance is not up to standard, the target client with the greatest impact on the global class imbalance is accurately located by the skew contribution score. Then, the optimal resampling method is adaptively selected for the target client based on the benefit-cost ratio of oversampling and undersampling. The global distribution balance is iteratively updated based on the local distribution after resampling. When the target client reaches the correction limit, a new target client is selected for continuous correction. Thus, without sharing the original data or leaking the local distribution of the client, the global class imbalance problem is accurately alleviated with less communication cost. This effectively improves the sample support capability of a few fault categories and rare abnormal conditions. In addition, it can avoid unnecessary data disturbance caused by uniform sampling of all clients.
Smart Images

Figure CN122508246B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of machine learning technology, and in particular to a method, apparatus, storage medium and device for global class distribution optimization in federated learning. Background Technology
[0002] Federated learning enables distributed model training without sharing raw data, thus meeting data security and privacy protection requirements. In power grid scenarios, distribution terminals, substation monitoring devices, electricity consumption data acquisition equipment, and various edge sensing nodes continuously collect data such as load behavior, equipment status, fault recordings, alarm events, equipment health status, and user energy consumption behavior for federated learning.
[0003] However, due to differences in power grid structure, equipment type, operating conditions, fault probability, and maintenance strategies in different regions, the data category distribution formed by each station or terminal usually has obvious long-tail characteristics. Insufficient samples of a few fault categories and rare abnormal operating conditions will lead to a decrease in the ability of the federated model to identify key risk categories. Summary of the Invention
[0004] The purpose of this application is to at least address one of the aforementioned technical deficiencies, particularly the technical deficiency in the prior art where the data category distribution formed by each site or terminal typically exhibits a significant long-tail characteristic, and the insufficient sample size of a few fault categories and rare abnormal operating conditions leads to a decline in the ability of the federated model to identify key risk categories.
[0005] Firstly, this application provides a global class distribution optimization method for federated learning, the method comprising:
[0006] Before performing federated learning, the global distribution balance is calculated based on the global distribution of the central server;
[0007] When the global distribution balance is lower than a preset threshold, the skew contribution score of each client participating in the global class optimization of federated learning is determined, and the client with the highest skew contribution score is selected as the target client.
[0008] Calculate the oversampling benefit-cost ratio and the undersampling benefit-cost ratio for the target client respectively, and perform corresponding resampling operations on the local distribution of the target client based on the oversampling benefit-cost ratio and the undersampling benefit-cost ratio.
[0009] Obtain the local distribution of the target client after resampling, and recalculate the global distribution balance based on the local distribution. When the target client reaches the maximum correction capability, return to the step of determining the skew contribution score of each client participating in the global class optimization of federated learning and continue execution.
[0010] When the target client does not reach its maximum correction capability, the process returns to the steps of calculating the oversampling benefit-cost ratio and undersampling benefit-cost ratio of the target client respectively, until the recalculated global distribution balance is not lower than the preset threshold.
[0011] In one embodiment, calculating the global distribution balance based on the global distribution of the central server includes:
[0012] Obtain the globally distributed ciphertext formed by the circular accumulation of each client participating in federated learning. The globally distributed ciphertext is formed by the local distributed accumulation of the virtual circular message passing link formed by each client.
[0013] The global distribution ciphertext is decrypted to obtain the global distribution of the central server, and the ratio between the number of samples corresponding to the class with the fewest samples and the number of samples corresponding to the class with the most samples in the global distribution is calculated to form the global distribution balance.
[0014] In one embodiment, determining the skew contribution score of each client participating in the global class optimization of federated learning includes:
[0015] Calculate the global skew vector based on the global distribution and the preset equilibrium distribution;
[0016] For each client participating in the global class optimization of federated learning, the contribution of the client's local distribution to the global skew direction is calculated using the ciphertext domain inner product method based on the global skew vector, thus obtaining the client's skew contribution score.
[0017] In one embodiment, calculating the oversampling benefit-cost ratio and undersampling benefit-cost ratio of the target client respectively includes:
[0018] Determine the oversampling candidate operation and undersampling candidate operation for the target client;
[0019] Calculate the expected balance lift for the oversampling candidate operation and the undersampling candidate operation respectively;
[0020] The storage cost, information loss risk, and communication overhead of the oversampling candidate operation and the undersampling candidate operation are determined respectively to determine the operation cost of the oversampling candidate operation and the undersampling candidate operation;
[0021] The quotient of the expected balance lift of the oversampled candidate operation and its operating cost is determined as the oversampling benefit-cost ratio, and the quotient of the expected balance lift of the undersampled candidate operation and its operating cost is determined as the undersampling benefit-cost ratio.
[0022] In one embodiment, the step of performing a corresponding resampling operation on the local distribution of the target client based on the oversampling benefit-cost ratio and the undersampling benefit-cost ratio includes:
[0023] If the oversampling benefit-cost ratio is greater than the undersampling benefit-cost ratio, then the minority class in the current global distribution is determined;
[0024] Data augmentation is performed for the minority class in the local distribution of the target client.
[0025] In one embodiment, the step of performing a corresponding resampling operation on the local distribution of the target client based on the oversampling benefit-cost ratio and the undersampling benefit-cost ratio includes:
[0026] If the oversampling benefit-cost ratio is not greater than the undersampling benefit-cost ratio, then the majority class in the current global distribution is determined, and the feature vector corresponding to each data sample in the majority class is extracted from the local distribution of the target client.
[0027] Calculate the intra-class density of each feature vector, as well as the mean cosine similarity and variance of its similarity with other feature vectors, and determine multiple redundant candidate samples based on the intra-class density, mean cosine similarity, and variance of the similarity of each feature vector.
[0028] The similarity between each redundant candidate sample and the corresponding data sample in other clients is calculated, and the redundant candidate samples with a similarity higher than a preset redundancy threshold with at least N other clients are identified as redundant samples, and the redundant samples are removed from the local distribution.
[0029] In one embodiment, recalculating the global distribution balance based on the local distribution includes:
[0030] Calculate the difference vector between this local distribution and the local distribution before the resampling operation;
[0031] The difference vectors are accumulated into the current global distribution to obtain a new global distribution. The ratio between the number of samples corresponding to the class with the fewest samples and the number of samples corresponding to the class with the most samples in the new global distribution is calculated to obtain the balance of the new global distribution.
[0032] Secondly, this application provides a global class distribution optimization device for federated learning, the device comprising:
[0033] The balance calculation module is used to calculate the global distribution balance based on the global distribution of the central server before performing federated learning.
[0034] The client determination module is used to determine the skew contribution score of each client participating in the global class optimization of federated learning when the global distribution balance is lower than a preset threshold, and select the client with the highest skew contribution score as the target client.
[0035] The resampling module is used to calculate the oversampling benefit-cost ratio and the undersampling benefit-cost ratio of the target client respectively, and to perform corresponding resampling operations on the local distribution of the target client based on the oversampling benefit-cost ratio and the undersampling benefit-cost ratio.
[0036] The first iteration module is used to obtain the local distribution of the target client after the resampling operation, and recalculate the global distribution balance based on the local distribution. When the target client reaches the maximum correction capability, it returns to the step of determining the skew contribution score of each client participating in the global class optimization of federated learning to continue execution.
[0037] The second iteration module is used to return to the steps of calculating the oversampling benefit-cost ratio and undersampling benefit-cost ratio of the target client respectively when the target client has not reached the maximum correction capability, and continue to execute until the recalculated global distribution balance is not lower than the preset threshold.
[0038] Thirdly, this application provides a storage medium storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the federated learning global class distribution optimization method as described in any of the above embodiments.
[0039] Fourthly, this application provides a computer device, including: one or more processors, and a memory;
[0040] The memory stores computer-readable instructions, and when the one or more processors execute the computer-readable instructions, they perform the steps of the federated learning global class distribution optimization method as described in any of the above embodiments.
[0041] As can be seen from the above technical solutions, the embodiments of this application have the following advantages:
[0042] The federated learning global class distribution optimization method, apparatus, storage medium, and device provided in this application first calculate the global distribution balance by a central server before federated learning training. When the balance is not up to standard, the target client with the greatest impact on the global class imbalance is accurately located by the skew contribution score. Then, the optimal resampling method is adaptively selected for the target client based on the benefit-cost ratio of oversampling and undersampling. The global distribution balance is iteratively updated based on the local distribution after resampling. When the target client reaches the correction limit, a new target client is selected for continuous correction. Thus, without sharing the original data or leaking the local distribution of the client, the global class imbalance problem is accurately alleviated with less communication cost. This effectively improves the sample support capability of a few fault categories and rare abnormal conditions. In addition, it can avoid unnecessary data disturbance caused by uniform sampling of all clients. Attached Figure Description
[0043] To more clearly illustrate the technical solutions in the embodiments of this application 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 only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0044] Figure 1 A flowchart illustrating a global class distribution optimization method for federated learning provided in this application embodiment;
[0045] Figure 2 This is a flowchart illustrating the process of performing corresponding resampling operations on the local distribution of the target client based on the oversampling benefit-cost ratio and the undersampling benefit-cost ratio, as provided in an embodiment of this application.
[0046] Figure 3 A schematic diagram of the structure of a federated learning global class distribution optimization device provided in an embodiment of this application;
[0047] Figure 4 This is an internal structural diagram of a computer device provided in an embodiment of this application. Detailed Implementation
[0048] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.
[0049] Specifically, federated learning is a privacy-preserving distributed machine learning framework. Its advantage lies in the fact that participating parties do not need to share raw data; they only exchange model parameters or intermediate computation results in an encrypted manner. This allows them to collaboratively complete global model training while protecting data privacy and ensuring security compliance. This distributed machine learning framework typically includes a central server and multiple clients. Each client holds a local, private dataset and does not disclose the raw data. During training, the central server distributes initial model parameters. After each client completes model training based on its local data, it only uploads the updated model parameters or gradient information to the central server in encrypted form. The central server then securely aggregates and globally updates the parameters from all parties and sends the optimized global model back to each client for the next iteration. Through multiple rounds of collaborative training, a global model with performance comparable to centralized learning is finally obtained.
[0050] In one embodiment, this application provides a global class distribution optimization method for federated learning. The following embodiments illustrate the application of this method to a federated learning system. It is understood that the system includes a central server and multiple clients, and the system can be deployed in a computer device to execute the global class distribution optimization method for federated learning provided in this application. Based on this, as... Figure 1 As shown, this application provides a global class distribution optimization method for federated learning, the method comprising:
[0051] S101: Before performing federated learning, calculate the global distribution balance based on the global distribution of the central server.
[0052] Here, global distribution refers to the overall sample size distribution vector obtained by securely aggregating the local class distributions of all clients participating in federated learning. Global distribution balance is an evaluation metric used to quantify the uniformity of the global distribution; the closer the global distribution balance is to 1, the more balanced the class distribution is in the corresponding global distribution.
[0053] In this step, before starting federated learning training, the central server can coordinate the aggregation of the global distribution to obtain the global distribution of the central server. Based on this, the global distribution balance is calculated according to the number of samples in each category in the global distribution. This global distribution balance is used to determine whether global class distribution optimization is needed before federated learning.
[0054] Specifically, each client transmits its local category distribution information in a circular manner using encryption without revealing its original local data or plaintext distribution. Finally, the client at the end of the circular transmits the information to the central server, thus obtaining the global distribution corresponding to the central server.
[0055] S102: Determine whether the global distribution balance is lower than the preset threshold.
[0056] The preset threshold is an empirical value and can be adjusted according to actual business requirements and computing resources. This application does not impose specific restrictions on it.
[0057] S103: When the global distribution balance is lower than the preset threshold, determine the skew contribution score of each client participating in the global class optimization of federated learning, and select the client with the highest skew contribution score as the target client.
[0058] Among them, the skew contribution score is used to quantify the degree of influence of a single client's local class distribution on the global class imbalance.
[0059] In this step, when the global distribution balance is below a preset threshold, the central server first calculates a global skew vector based on the global distribution and the target balanced distribution, distinguishing between the majority class direction with excessive samples and the minority class direction with insufficient samples. Then, the global skew-related parameters are encrypted and distributed to each client. Each client calculates the similarity between its local distribution and the global skew direction, the balance improvement that local correction can bring, and the corresponding storage and communication overhead within the encrypted domain, thus obtaining its own skew contribution score. Finally, the central server sorts the skew contribution scores of each client and selects the client with the highest score as the target client for priority resampling correction.
[0060] Furthermore, when determining the clients participating in the global class optimization of federated learning, the clients participating in federated learning are first identified, and among the identified clients, those that have already performed resampling and reached their maximum correction capacity are removed. The remaining clients are the clients participating in the global class optimization of federated learning.
[0061] For example, in a power grid federated learning scenario, assuming each client corresponds to a different distribution terminal, substation, or data acquisition node, the skew contribution score can accurately identify the site where the problem of excessive normal operation samples or scarce fault samples is most prominent. For instance, if a client has an extremely high proportion of normal samples and a severe shortage of fault samples, its contribution to global skew is significantly higher than that of other clients, and its corresponding skew contribution score will be at the highest level, thus being selected as the target client. Furthermore, the entire calculation process is completed in the encrypted domain, without revealing any client's local plaintext distribution information, while ensuring the objectivity and accuracy of the target client selection.
[0062] S104: Calculate the oversampling benefit-cost ratio and undersampling benefit-cost ratio for the target client respectively, and perform corresponding resampling operations on the local distribution of the target client based on the oversampling benefit-cost ratio and undersampling benefit-cost ratio.
[0063] Resampling operations include oversampling and undersampling. The oversampling benefit-cost ratio refers to the ratio between the global balance improvement gained by oversampling minority class samples on the target client and the storage increase, information risk, and communication overhead incurred by oversampling; it is used to measure the overall cost-effectiveness of oversampling candidate operations. The undersampling benefit-cost ratio refers to the ratio between the global balance improvement gained by undersampling majority class samples on the target client and the sample deletion risk, feature loss, and computational overhead incurred by undersampling; it is used to measure the overall cost-effectiveness of undersampling operations.
[0064] In this step, after identifying the target client, the target client estimates the global balance improvement gains from oversampling and undersampling, and simultaneously calculates the corresponding operational costs. The global balance improvement gains are then compared to the operational costs to obtain the oversampling benefit-cost ratio and the undersampling benefit-cost ratio, respectively. Subsequently, the method with the higher ratio is selected to perform resampling on the target client's local distribution. Furthermore, the local distribution refers to the vector representing the number of samples corresponding to each category within the dataset held by a single client participating in federated learning; it characterizes the category composition and distribution characteristics of the client's local data.
[0065] Specifically, by calculating and comparing the benefit-cost ratio of oversampling and the benefit-cost ratio of undersampling respectively, the more cost-effective resampling method is dynamically selected for the target client, achieving the optimal balance between correction benefits and resource overhead. This avoids blind oversampling leading to storage expansion of edge devices and prevents the loss of key power grid operation characteristics caused by undiscriminative undersampling.
[0066] S105: Obtain the local distribution of the target client after the resampling operation, and recalculate the global distribution balance based on the local distribution.
[0067] In this step, after the target client completes the resampling operation (either oversampling or undersampling), it obtains the updated local category sample count, i.e., the new local distribution. After obtaining the new local distribution, the difference vector between the new local distribution and the old local distribution before the resampling operation is calculated. The target client then encrypts this difference vector using a homomorphic encryption public key. Subsequently, a homomorphic addition is performed on the existing global distribution ciphertext to update it, resulting in the updated global distribution ciphertext. The central server decrypts this global distribution ciphertext using its private key to obtain the new global distribution. Finally, the global distribution balance is recalculated based on the new global distribution.
[0068] S106: Determine whether the recalculated global distribution balance is lower than the preset threshold.
[0069] S107: If the global distribution balance is lower than the preset threshold, determine whether the target client has reached the maximum correction capability.
[0070] The maximum correction capability refers to the maximum adjustment limit that the target client can perform oversampling or undersampling operations under the common constraints of sample increment budget, maximum deletion ratio and global distribution optimization objective.
[0071] In this step, if the global distribution balance has not yet reached the preset threshold, the system enters the target client correction capability judgment stage. At this time, based on the preset maximum number of correction rounds, the target client's local sample increment budget, the maximum sample deletion ratio, and the number of corrections and sample adjustments already completed, the system comprehensively determines whether the target client has reached its maximum correction capability. The judgment criteria include whether the target client has exhausted its quota of new samples, whether it has reached the upper limit of deletable samples, whether it has completed the maximum allowed number of correction rounds, or whether continued correction cannot bring about an effective improvement in global balance. When any one of the judgment criteria is met, the target client can be considered to have reached its maximum correction capability; otherwise, the target client can be considered not to have reached its maximum correction capability.
[0072] S108: If the maximum correction capability is reached, return to the step of determining the skew contribution scores of each client participating in the global class optimization of federated learning to continue execution.
[0073] In this step, when the target client reaches its maximum correction capability, it indicates that the target client has reached the resampling adjustment limit. At this time, return to S103 to continue execution, so as to reposition the target client and perform the resampling operation.
[0074] S109: If the maximum correction capability is not reached, return to the steps of calculating the oversampling benefit-cost ratio and undersampling benefit-cost ratio for the target client respectively and continue execution.
[0075] In this step, if the target client has not reached its maximum correction capability, it indicates that the target client has not yet reached the resampling adjustment limit and can still perform the next round of resampling operation. At this time, return to S104 to continue execution, so as to redetermine the resampling method to be used by the target client in the next round.
[0076] S110: If the global distribution balance is not lower than the preset threshold, then federated learning is started.
[0077] In this step, when the calculated global distribution balance is not lower than a preset threshold, it indicates that after multiple rounds of adaptive resampling correction, the global category distribution formed by the secure aggregation of local data from all clients participating in federated learning has reached a balanced state. At this point, the data distribution optimization process can be terminated, and the federated learning training process can be formally started. It can be understood that starting federated learning after global class optimization allows the model trained collaboratively by each client to accurately identify various fault conditions, effectively reducing the risk of missed or incorrect judgments.
[0078] In the above embodiments, before federated learning training, the central server calculates the global distribution balance. When the balance is not up to standard, the skew contribution score is used to accurately locate the target client that has the greatest impact on the global class imbalance. Then, based on the benefit-cost ratio of oversampling and undersampling, the optimal resampling method is adaptively selected for the target client. The global distribution balance is iteratively updated based on the local distribution after resampling. When the target client reaches the correction limit, a new target client is selected for continuous correction. In this way, without sharing the original data or leaking the local distribution of the client, the global class imbalance problem is accurately alleviated with less communication cost. This effectively improves the sample support capability of a few fault categories and rare abnormal conditions. In addition, it can also avoid unnecessary data disturbance caused by uniform sampling of all clients.
[0079] In one embodiment, calculating the global distribution balance based on the global distribution of the central server includes:
[0080] S1: Obtain the globally distributed ciphertext formed by the circular accumulation of each client participating in federated learning.
[0081] S2: Decrypt the global distribution ciphertext to obtain the global distribution of the central server, and calculate the ratio between the number of samples corresponding to the class with the fewest samples and the number of samples corresponding to the class with the most samples in the global distribution to form the global distribution balance.
[0082] The globally distributed ciphertext is formed by local distribution and accumulation through a virtual ring message passing link formed by various clients.
[0083] In this embodiment, a virtual ring message passing link is first established, formed by the clients participating in federated learning. The first client in this link encrypts its local distribution information (including sample count, category labels, etc.) and passes it to the next client. The next client then adds its local distribution information to the ciphertext transmitted by the previous client. This process continues through the ring link, completing the transmission and accumulation of local distribution information to ultimately form the globally distributed encrypted ciphertext. Subsequently, the central server decrypts this globally distributed ciphertext to reconstruct the complete global distribution data, clarifying the quantity distribution of samples in each category. Then, the global distribution balance is obtained by calculating the ratio between the number of samples in the category with the fewest samples and the number of samples in the category with the most samples.
[0084] In one example, the central server generates the CKKS homomorphic encryption public key. and private key , public key Broadcast to all clients, private key It is stored only by the central server. A virtual ring message passing chain is formed based on the random ring order generated by each client. The client at the head of the virtual ring message passing chain uses... Its local distribution Encryption is performed to obtain the encrypted local distribution. and will Send it to the next client. Subsequent clients do not decrypt the received ciphertext and instead distribute their local data within the ciphertext field. Homomorphic superposition In the process, the client at the end of the link will eventually accumulate the encrypted message. The encrypted message was sent to the central server. satisfy:
[0085] ;
[0086] In the formula, Indicates the use of a public key Encryption, This indicates the number of clients participating in federated learning. Indicates client Local distribution.
[0087] The process of calculating the global distribution balance based on the decrypted global distribution can be expressed as:
[0088] ;
[0089] in, Indicates the global distribution balance. Indicates global distribution. Represents the categories in the global distribution The number of samples, This represents the number of samples corresponding to the class with the fewest samples in the global distribution. This represents the number of samples corresponding to the class with the most samples in the global distribution. Indicates the number of categories.
[0090] Specifically, when a circular accumulation is used to obtain the global distribution, the central server only receives the final aggregated ciphertext, instead of receiving the ciphertext distribution uploaded individually by each client. This reduces the risk of the server making differential inferences about the distribution of individual clients based on communication sources, message sizes, and round-by-round relationships. Intermediate clients can only see the uncrackable aggregated ciphertext and cannot obtain the plaintext distribution of preceding clients.
[0091] In one embodiment, the skew contribution score of each client participating in the global class optimization of federated learning is determined, including:
[0092] S1: Calculate the global skew vector based on the global distribution and the preset equilibrium distribution.
[0093] S2: For each client participating in the global class optimization of federated learning, the contribution of the client's local distribution to the global skew direction is calculated by the ciphertext domain inner product based on the global skew vector, and the skew contribution score of the client is obtained.
[0094] The preset equilibrium distribution refers to the pre-defined standard vector of sample quantity ratios for each category. The global skew vector is the difference vector obtained by subtracting the preset equilibrium distribution from the global distribution. The positive and negative values in the vector correspond to the degree of surplus and shortage of each category of samples compared to the ideal state, i.e., the positive skew component and the negative skew component.
[0095] In this embodiment, the acquired global distribution data is first compared with a pre-defined equilibrium distribution, and then a global skew vector is generated to characterize the degree and direction of the overall data deviation from the ideal state. Positive and negative skew components are then determined based on this global skew vector. Next, the central server encrypts and distributes the positive and negative skew components to each client participating in the federated learning global class optimization. Each client directly performs inner product operations on its local distribution vector with the received positive and negative skew components within the encrypted computation environment. The correlation between the local distribution and the global skew trend is matched using the encrypted domain secure computation mode. Finally, the computation results are aggregated and converted into a skew contribution score for the corresponding client. This allows for precise identification of the target client causing the global data class imbalance, providing a clear target for subsequent data distribution correction and effectively reducing unnecessary data adjustment operations on unrelated clients.
[0096] In one example, the central server is based on a global distribution. and preset balanced distribution Calculate the global skew vector :
[0097] ;
[0098] For the majority class with an excessive number of samples, construct a positive skew component. For minority classes with insufficient samples, construct a negative skew component. The server will , Use public key with necessary normalization parameters After encryption, the data is broadcast to each client. Each client calculates its local distribution's contribution to the global skew direction using the ciphertext domain inner product, without disclosing its local distribution vector to the server. .
[0099] No. The calculation process for the skew contribution score of each client can be expressed as follows:
[0100] ;
[0101] In the formula, Indicates the first Scoring of skew contribution from each client Indicates the first The cosine similarity between the local distribution of each client and the positive skew component. Indicates the first The local distribution of each client and the cosine similarity of the negative skew component. Indicates the first The expected improvement in global distribution balance after each client performs a correction within its sample budget. Indicates the first Each client performs a correction, incurring storage, communication, and computational overhead. , , , Preset weights.
[0102] In one embodiment, the oversampling benefit-cost ratio and undersampling benefit-cost ratio of the target client are calculated, including:
[0103] S1: Determine the oversampling candidate operation and undersampling candidate operation for the target client.
[0104] S2: Calculate the expected balance lift for oversampled candidate operations and undersampled candidate operations, respectively.
[0105] S3: Determine the storage cost, information loss risk, and communication overhead of oversampled and undersampled candidate operations respectively, in order to determine the operational cost of oversampled and undersampled candidate operations.
[0106] S4: The quotient of the expected balance lift of an oversampled candidate operation to its operating cost is determined as the oversampling benefit-cost ratio, and the quotient of the expected balance lift of an undersampled candidate operation to its operating cost is determined as the undersampling benefit-cost ratio.
[0107] Among them, oversampling candidate operation refers to a sample generation or duplication correction operation to be performed by the target client to supplement the global minority class sample gap. Undersampling candidate operation refers to a sample screening and deletion correction operation to be performed by the target client to reduce the global majority class sample redundancy. Expected balance improvement refers to the expected improvement in the global distribution balance after performing a candidate operation.
[0108] In this embodiment, after identifying the target client, two correction schemes to be evaluated are first constructed: oversampling candidate operation and undersampling candidate operation. The oversampling candidate operation specifies the number of minority class samples to be generated and the target class, while the undersampling candidate operation specifies the number of majority class samples to be deleted and the selection criteria. Based on the current global distribution and the preset equilibrium distribution, the expected improvement in the global distribution balance after performing oversampling or undersampling is calculated, thus obtaining the expected balance improvement. Simultaneously, the corresponding operational costs for each candidate operation are evaluated. Finally, the oversampling benefit-cost ratio and the undersampling benefit-cost ratio are obtained based on the quotient of the expected balance improvement and the operational cost, respectively.
[0109] Specifically, for oversampling candidate operations, the storage cost is determined by the storage space occupied by the newly added samples, the information loss risk mainly comes from the noise or bias that may be introduced by the generated samples, and the communication overhead comes from the encryption and interaction process of the generated sample features. For undersampling candidate operations, the storage cost is mainly the space release after the sample deletion (usually regarded as a positive benefit or negative cost), the information loss risk comes from the possibility of key boundary samples or high-value samples being mistakenly deleted, and the communication overhead comes from the encrypted interaction in the redundant verification process. By weighting and summing these three costs according to preset weights, the operation costs of the two candidate operations can be obtained.
[0110] By constructing two candidate operations—oversampling and undersampling—for the target client, and calculating their expected balance improvement and operational costs, the benefit-cost ratio of the two operations is obtained. This allows for adaptive selection of the correction method with higher benefits and lower costs for the target client, avoiding the resource waste or data quality degradation that might result from blindly implementing a single sampling method.
[0111] In one example, the oversampling benefit-cost ratio and the undersampling benefit-cost ratio can be calculated using the following expressions:
[0112] ;
[0113] In the formula, This indicates the benefit-cost ratio of oversampling or undersampling. This indicates the expected balance lift of the sampling candidate operation or undersampling candidate operation. This represents the storage cost of a sampling candidate operation or an undersampled candidate operation. This indicates the risk of information loss in sampling candidate operations or undersampling candidate operations. This represents the communication overhead of a sampling candidate operation or an undersampled candidate operation. , , As weight.
[0114] In one embodiment, the federated learning global class distribution optimization method further includes, before performing the calculation of the oversampling benefit-cost ratio and undersampling benefit-cost ratio for the target client, respectively:
[0115] S1: Calculate the local balance of the target client and its expected marginal improvement to the global distributed balance.
[0116] S2: When the local balance reaches the preset value and the expected marginal improvement is less than the minimum improvement threshold, the target client is re-determined to perform the resampling operation; otherwise, the calculation of the oversampling benefit-cost ratio and undersampling benefit-cost ratio of the target client and subsequent steps are continued.
[0117] In this embodiment, the calculation method for local balance can refer to the calculation method for global distributed balance, and will not be repeated here.
[0118] like Figure 2 As shown, in one embodiment, a resampling operation is performed on the local distribution of the target client based on the oversampling benefit-cost ratio and the undersampling benefit-cost ratio, including:
[0119] S201: Determine whether the oversampling benefit-cost ratio is greater than the undersampling benefit-cost ratio.
[0120] S202: If the oversampling benefit-cost ratio is greater than the undersampling benefit-cost ratio, then the minority class in the current global distribution is determined.
[0121] S203: Perform data augmentation for minority classes in the local distribution of the target client.
[0122] S204: If the oversampling benefit-cost ratio is not greater than the undersampling benefit-cost ratio, then determine the majority class in the current global distribution and extract the feature vector corresponding to each data sample in the majority class from the local distribution of the target client.
[0123] S205: Calculate the intra-class density of each feature vector, as well as the mean cosine similarity and variance of its similarity with other feature vectors, and determine multiple redundant candidate samples based on the intra-class density, mean cosine similarity, and variance of the similarity of each feature vector.
[0124] S206: Calculate the similarity between each redundant candidate sample and the corresponding data samples in other clients, and identify the redundant candidate samples whose similarity with at least N other clients is higher than the preset redundancy threshold as redundant samples, and remove the redundant samples from the local distribution.
[0125] Here, the intra-class density refers to the density of the class to which the feature vector belongs, where N is a positive integer. The mean cosine similarity is obtained by calculating the cosine similarity between the corresponding feature vector and the feature vectors of all other samples in the same class, and then taking the arithmetic mean of all cosine similarity results. It is used to quantify the overall similarity between the corresponding data sample and other samples in the same class. The variance of similarity is obtained by calculating the variance of the cosine similarity between the corresponding feature vector and the feature vectors of all other samples in the same class, and then calculating the variance based on all similarity results. It is used to quantify the dispersion of the similarity between the data sample and other samples in the same class.
[0126] In this embodiment, when the oversampling benefit-cost ratio of the target client is greater than the undersampling benefit-cost ratio, the system determines that the overall cost-effectiveness of performing the oversampling operation is higher. At this point, the central server can identify the minority classes with insufficient sample numbers in the current global distribution based on the global distribution and the preset equilibrium distribution. These are the target classes that need additional samples. The server then sends the class identifier and oversampling configuration parameters of these minority classes to the target client. Upon receiving the instruction, the target client performs data augmentation operations on these minority classes in its local distribution, generating new samples with distribution characteristics consistent with the original samples, thus completing local oversampling correction. Furthermore, during the data augmentation process, the generated data cannot exceed the target client's single sample increment budget and is constrained by the preset equilibrium distribution.
[0127] Furthermore, for power grid image, waveform, or time-series data, data augmentation methods that preserve physical meaning can be used, such as slight shifting of fault recording time windows, noise disturbances, amplitude normalization disturbances, or reassembly of segments with consistent operating conditions; for structured alarms or status features, nearest neighbor interpolation of the same category or lightweight SMOTE methods can be used.
[0128] For example, if the number of rare operating condition samples such as short-circuit faults and grounding faults in the global distribution is much lower than the standard in the preset equilibrium distribution, and the oversampling benefit-cost ratio of the target client is higher, the system will determine these fault categories as minority classes. The target client will then use a safe generative data augmentation method to generate new fault samples based on the locally collected fault waveforms and equipment status data, such as generating simulated samples that match the features of real fault data based on the SMOTE algorithm or conditional GAN.
[0129] When the oversampling benefit-cost ratio for the target client is no greater than the undersampling benefit-cost ratio, it indicates that performing undersampling is more cost-effective overall. First, the central server, combining the current global distribution and a preset equilibrium distribution, identifies the majority class with an excess of samples in the global distribution and sends the target class requiring sample reduction to the target client. Upon receiving the instruction, the target client extracts the feature vectors corresponding to all data samples in that majority class from its local distribution.
[0130] Subsequently, for each feature vector, its intra-class density, mean cosine similarity, and variance are calculated. Data samples corresponding to feature vectors with high intra-class density, high mean cosine similarity, and low variance are identified as redundant candidate samples. Next, the target client encrypts the feature vectors of each redundant candidate sample and sends them to the central server. The server forwards them to other clients participating in federated learning. Each client calculates the similarity between its local corresponding data sample and these redundant candidate samples within the encrypted domain, and returns the encrypted similarity results to the central server. The central server decrypts and summarizes all similarity results, determining whether each redundant candidate sample has a similarity higher than a preset redundancy threshold with at least N corresponding samples from other clients. Redundant candidate samples meeting this condition are identified as globally redundant samples. Finally, the target client removes these globally redundant samples from its local distribution, completing undersampling correction.
[0131] Furthermore, before removing redundant samples in the local distribution, redundant samples that do not belong to minority classes, boundary conditions, or high-risk fault labels can be screened out from the redundant samples, and the screened redundant samples are used as the final redundant samples to be removed.
[0132] The two-stage mechanism of local redundancy screening and encrypted global redundancy verification is understandable. In the first stage, redundant candidate samples are screened using the mean, variance, and intra-class density of similarity to local features of the target client. In the second stage, other clients participate in similarity verification in the encrypted domain. Only majority class samples that are proven to be highly repetitive globally and do not belong to boundary conditions or high-risk fault labels are deleted. This approach overcomes the problem of easily deleting key samples using traditional random sampling or clustering methods, ensuring that only truly redundant samples without critical value are removed, thus preserving boundary samples and high-value samples in the majority class.
[0133] In one embodiment, recalculating the global distribution balance based on the local distribution includes:
[0134] S1: Calculate the difference vector between the local distribution and the local distribution before the resampling operation.
[0135] S2: Accumulate the difference vectors into the current global distribution to obtain a new global distribution, and calculate the ratio between the number of samples corresponding to the class with the fewest samples and the number of samples corresponding to the class with the most samples in the new global distribution to obtain the balance of the new global distribution.
[0136] Here, the difference vector refers to the vector formed by performing element-wise difference operations on the new local distribution and the local distribution before the resampling operation, according to the corresponding categories.
[0137] In this embodiment, the difference vectors of the local distributions before and after resampling are calculated, and then the incremental difference vectors are accumulated into the current global distribution to update the global distribution balance. This process eliminates the need to re-aggregate the complete local distributions of all clients; instead, it significantly reduces the computational burden on the central server and the communication overhead of each client by using only incremental updates of the encrypted difference vectors, thereby improving the efficiency of updating the global distribution and balance.
[0138] In one example, after the target client completes one round of resampling, it calculates the old local distribution. and new local distribution Difference vector between :
[0139] ;
[0140] The target client uses the public key Encrypted Differential Vector And in the previous round of global distribution of ciphertext Perform encrypted enhancement update based on:
[0141] ;
[0142] In the formula, This represents a new globally distributed ciphertext.
[0143] The central server decrypts the updated global distribution and recalculates the global balance based on the new global distribution.
[0144] In one embodiment, to verify the effectiveness of the present invention in a global class imbalance scenario of power grid federated learning, a set of simulation examples for power distribution equipment status identification are constructed. The experiment sets up 10 clients, simulating different substations, distribution rooms, or edge acquisition terminals; each client retains local samples and does not upload raw data to the server. The classification task is set to 5 classes: normal operation, minor anomaly, overload, ground fault, and short circuit fault. Samples from each client are distributed in a long-tail manner, with normal operation samples accounting for a higher proportion, while ground fault and short circuit fault are minority classes. The initial global sample size is 12,000, the initial global class distribution is [7200, 2400, 1500, 600, 300], and the global distribution balance is:
[0145] ;
[0146] The experiment compared five processing methods: First, no data balancing was performed, and federated training was executed directly; second, each client independently performed oversampling based on its local distribution; third, each client performed majority class undersampling based on its local K-means clustering; fourth, all clients uniformly performed mixed sampling based on global statistics; and fifth, the federated learning global class distribution optimization method provided in this invention was adopted. All schemes used the same number of federated training rounds, model structure, and learning rate. The final comparisons were made regarding global balance, overall accuracy, macro-average F1 score, minority class average recall, sample size change rate, encrypted communication overhead, and preprocessing time.
[0147] After six rounds of correction, the method of this invention primarily selects three clients that contribute significantly to redundancy in normal operation and gaps in fault conditions as target clients. It adds 860 minority class samples and deletes 1050 globally redundant majority class samples. The corrected global class distribution is [6150, 2400, 1700, 980, 630], improving the global distribution balance.
[0148] ;
[0149] While maintaining a relatively stable total sample size, this invention increases the effective proportion of fault-related samples and avoids the accidental deletion of boundary condition samples due to simple undersampling.
[0150] Compared to uncorrected federated training, the method of this invention improves the minority class average recall from 51.8% to 70.5% and the macro average F1 score from 0.641 to 0.739. Compared to unified mixed sampling across all clients, this invention improves overall accuracy, macro average F1 score, and minority class recall, while the sample size change rate is only -1.6%, significantly lower than the sample inflation caused by local independent oversampling. Compared to local K-means clustering undersampling, this invention avoids the direct deletion of critical fault boundary samples through encrypted global redundancy verification, thus achieving higher overall accuracy and macro average F1 score. These results demonstrate that this invention can improve the identification capability of minority fault categories in the power grid while maintaining data privacy and controlling the storage overhead of edge devices.
[0151] It should be understood that although the steps in the flowcharts of the embodiments described above are shown sequentially according to the arrows, these steps are not necessarily executed in the order indicated by the arrows. Unless explicitly stated herein, there is no strict order restriction on the execution of these steps, and they can be executed in other orders. Moreover, at least some steps in the flowcharts of the embodiments described above may include multiple steps or multiple stages. These steps or stages are not necessarily completed at the same time, but can be executed at different times. The execution order of these steps or stages is not necessarily sequential, but can be performed alternately or in turn with other steps or at least some of the steps or stages of other steps.
[0152] The following describes the global class distribution optimization apparatus for federated learning provided in the embodiments of this application. The global class distribution optimization apparatus for federated learning described below can be referred to in correspondence with the global class distribution optimization method for federated learning described above.
[0153] like Figure 3 As shown, this application provides a federated learning global class distribution optimization device 300, the device comprising:
[0154] The balance calculation module 301 is used to calculate the global distribution balance based on the global distribution of the central server before performing federated learning.
[0155] The client determination module 302 is used to determine the skew contribution score of each client participating in the global class optimization of federated learning when the global distribution balance is lower than a preset threshold, and select the client with the highest skew contribution score as the target client.
[0156] The resampling module 303 is used to calculate the oversampling benefit-cost ratio and the undersampling benefit-cost ratio of the target client respectively, and to perform corresponding resampling operations on the local distribution of the target client based on the oversampling benefit-cost ratio and the undersampling benefit-cost ratio.
[0157] The first iteration module 304 is used to obtain the local distribution of the target client after the resampling operation, and recalculate the global distribution balance based on the local distribution. When the target client reaches the maximum correction capability, it returns to the step of determining the skew contribution score of each client participating in the global class optimization of federated learning to continue execution.
[0158] The second iteration module 305 is used to return to the steps of calculating the oversampling benefit-cost ratio and undersampling benefit-cost ratio of the target client respectively when the target client has not reached the maximum correction capability, and continue to execute until the recalculated global distribution balance is not lower than the preset threshold.
[0159] In the above embodiments, before federated learning training, the central server calculates the global distribution balance. When the balance is not up to standard, the skew contribution score is used to accurately locate the target client that has the greatest impact on the global class imbalance. Then, based on the benefit-cost ratio of oversampling and undersampling, the optimal resampling method is adaptively selected for the target client. The global distribution balance is iteratively updated based on the local distribution after resampling. When the target client reaches the correction limit, a new target client is selected for continuous correction. In this way, without sharing the original data or leaking the local distribution of the client, the global class imbalance problem is accurately alleviated with less communication cost. This effectively improves the sample support capability of a few fault categories and rare abnormal conditions. In addition, it can also avoid unnecessary data disturbance caused by uniform sampling of all clients.
[0160] In one embodiment, the balance calculation module includes:
[0161] The ciphertext acquisition submodule is used to acquire the globally distributed ciphertext formed by the circular accumulation of each client participating in federated learning. The globally distributed ciphertext is formed by the local distribution accumulation through the virtual circular message passing link formed by each client.
[0162] The ciphertext decryption submodule is used to decrypt the globally distributed ciphertext to obtain the global distribution of the central server, and calculate the ratio between the number of samples corresponding to the class with the fewest samples and the number of samples corresponding to the class with the most samples in the global distribution to form the global distribution balance.
[0163] In one embodiment, the client determination module includes:
[0164] The skew determination submodule is used to calculate the global skew vector based on the global distribution and the preset equilibrium distribution.
[0165] The contribution calculation submodule is used to calculate the contribution of the client's local distribution to the global skew direction by using the ciphertext domain inner product method based on the global skew vector for each client participating in the global class optimization of federated learning, and obtain the skew contribution score of the client.
[0166] In one embodiment, the resampling module includes:
[0167] The operation determination submodule is used to determine the oversampling candidate operation and the undersampling candidate operation for the target client;
[0168] The first calculation submodule is used to calculate the expected balance lift of oversampled candidate operations and undersampled candidate operations, respectively.
[0169] The second calculation submodule is used to determine the storage cost, information loss risk and communication overhead of oversampled candidate operations and undersampled candidate operations, respectively, so as to determine the operation cost of oversampled candidate operations and undersampled candidate operations.
[0170] The third calculation submodule is used to determine the quotient of the expected balance lift of an oversampled candidate operation and its operating cost as the oversampling benefit-cost ratio, and to determine the quotient of the expected balance lift of an undersampled candidate operation and its operating cost as the undersampling benefit-cost ratio.
[0171] In one embodiment, the resampling module includes:
[0172] The class determination submodule is used to determine the minority class in the current global distribution if the oversampling benefit-cost ratio is greater than the undersampling benefit-cost ratio.
[0173] The data augmentation submodule is used to perform data augmentation on a minority of classes in the local distribution of the target client.
[0174] In one embodiment, the resampling module includes:
[0175] The feature extraction submodule is used to determine the majority class in the current global distribution if the oversampling benefit-cost ratio is not greater than the undersampling benefit-cost ratio, and extract the feature vector corresponding to each data sample in the majority class from the local distribution of the target client.
[0176] The sample selection submodule is used to calculate the intra-class density of each feature vector, as well as the mean cosine similarity and variance of its similarity with other feature vectors, and to determine multiple redundant candidate samples based on the intra-class density, mean cosine similarity and variance of each feature vector.
[0177] The redundancy determination submodule is used to calculate the similarity between each redundant candidate sample and the corresponding data samples in other clients, and to determine the redundant candidate samples whose similarity with at least N other clients is higher than the preset redundancy threshold as redundant samples, and remove the redundant samples from the local distribution.
[0178] In one embodiment, the first iteration module includes:
[0179] The difference calculation submodule is used to calculate the difference vector between the local distribution and the local distribution before the resampling operation;
[0180] The balance calculation submodule is used to accumulate the difference vector into the current global distribution to obtain a new global distribution, and to calculate the ratio between the number of samples corresponding to the class with the fewest samples and the number of samples corresponding to the class with the most samples in the new global distribution, thus obtaining the balance of the new global distribution.
[0181] The division of modules in the above-described federated learning global class distribution optimization device is merely illustrative. In other embodiments, the federated learning global class distribution optimization device can be divided into different modules as needed to complete all or part of its functions. Each module in the above-described federated learning global class distribution optimization device can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in a computer device in hardware form, or stored in the memory of a computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0182] In one embodiment, this application also provides a storage medium storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the federated learning global class distribution optimization method as described in any of the above embodiments.
[0183] In one embodiment, this application also provides a computer device storing computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the federated learning global class distribution optimization method as described in any of the above embodiments.
[0184] Indicatively, such as Figure 4 As shown, Figure 4 This is a schematic diagram of the internal structure of a computer device 400 provided in an embodiment of this application. The computer device 400 can be provided as a server. (Refer to...) Figure 4 The computer device 400 includes a processing component 402, which further includes one or more processors, and memory resources represented by memory 401 for storing instructions, such as application programs, that can be executed by the processing component 402. The application programs stored in memory 401 may include one or more modules, each corresponding to a set of instructions. Furthermore, the processing component 402 is configured to execute instructions to perform the federated learning global class distribution optimization method of any of the above embodiments.
[0185] The computer device 400 may also include a power supply component 403 configured to perform power management of the computer device 400, a wired or wireless network interface 404 configured to connect the computer device 400 to a network, and an input / output (I / O) interface 405. The computer device 400 may operate on an operating system stored in memory 401, such as Windows Server™, Mac OS X™, Unix™, Linux™, Free BSD™, or similar.
[0186] Those skilled in the art will understand that Figure 4 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the computer device to which the present application is applied. Specific computer devices may include more or fewer components than those shown in the figure, or combine certain components, or have different component arrangements.
[0187] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or apparatus. Without further limitations, an element defined by the phrase "comprising a…" does not exclude the presence of other identical elements in the process, method, article, or apparatus that includes said element. In this document, the singular forms "a," "an," and "the" may also include the plural forms unless the context clearly indicates otherwise. It should also be understood that the terms “comprising / including” or “having” specify the presence of the stated features, wholes, steps, operations, components, parts or combinations thereof, but do not exclude the possibility of the presence or addition of one or more other features, wholes, steps, operations, components, parts or combinations thereof. Meanwhile, the term “and / or” as used in this specification includes any and all combinations of the associated listed items.
[0188] The various embodiments in this specification are described in a progressive manner. Each embodiment focuses on the differences from other embodiments. The various embodiments can be combined as needed, and the same or similar parts can be referred to each other.
[0189] The above description of the disclosed embodiments enables those skilled in the art to make or use this application. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the general principles defined herein may be implemented in other embodiments without departing from the spirit or scope of this application. Therefore, this application is not to be limited to the embodiments shown herein, but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.
Claims
1. A global class distribution optimization method for federated learning, characterized in that, The method includes: Before performing federated learning, the global distribution balance is calculated based on the global distribution of the central server; When the global distribution balance is lower than a preset threshold, the skew contribution score of each client participating in the global class optimization of federated learning is determined, and the client with the highest skew contribution score is selected as the target client. Calculate the oversampling benefit-cost ratio and the undersampling benefit-cost ratio for the target client respectively, and perform corresponding resampling operations on the local distribution of the target client based on the oversampling benefit-cost ratio and the undersampling benefit-cost ratio. Obtain the local distribution of the target client after resampling, and recalculate the global distribution balance based on the local distribution. When the target client reaches the maximum correction capability, return to the step of determining the skew contribution score of each client participating in the global class optimization of federated learning and continue execution. When the target client does not reach the maximum correction capability, the process returns to the step of calculating the oversampling benefit-cost ratio and undersampling benefit-cost ratio of the target client respectively, and continues until the recalculated global distribution balance is not lower than the preset threshold. The calculation of global distribution balance based on the global distribution of the central server includes: Obtain the globally distributed ciphertext formed by the circular accumulation of each client participating in federated learning. The globally distributed ciphertext is formed by the local distributed accumulation of the virtual circular message passing link formed by each client. The global distribution ciphertext is decrypted to obtain the global distribution of the central server, and the ratio between the number of samples corresponding to the class with the fewest samples and the number of samples corresponding to the class with the most samples in the global distribution is calculated to form the global distribution balance.
2. The federated learning global class distribution optimization method according to claim 1, characterized in that, The determination of the skew contribution score of each client participating in the global class optimization of federated learning includes: Calculate the global skew vector based on the global distribution and the preset equilibrium distribution; For each client participating in the global class optimization of federated learning, the contribution of the client's local distribution to the global skew direction is calculated using the ciphertext domain inner product method based on the global skew vector, thus obtaining the client's skew contribution score.
3. The federated learning global class distribution optimization method according to claim 1, characterized in that, The calculation of the oversampling benefit-cost ratio and undersampling benefit-cost ratio for the target client includes: Determine the oversampling candidate operation and undersampling candidate operation for the target client; Calculate the expected balance lift for the oversampling candidate operation and the undersampling candidate operation respectively; The storage cost, information loss risk, and communication overhead of the oversampling candidate operation and the undersampling candidate operation are determined respectively to determine the operation cost of the oversampling candidate operation and the undersampling candidate operation; The quotient of the expected balance lift of the oversampled candidate operation and its operating cost is determined as the oversampling benefit-cost ratio, and the quotient of the expected balance lift of the undersampled candidate operation and its operating cost is determined as the undersampling benefit-cost ratio.
4. The federated learning global class distribution optimization method according to claim 1, characterized in that, The step of performing a corresponding resampling operation on the local distribution of the target client based on the oversampling benefit-cost ratio and the undersampling benefit-cost ratio includes: If the oversampling benefit-cost ratio is greater than the undersampling benefit-cost ratio, then the minority class in the current global distribution is determined; Data augmentation is performed for the minority class in the local distribution of the target client.
5. The federated learning global class distribution optimization method according to any one of claims 1 to 4, characterized in that, The step of performing a corresponding resampling operation on the local distribution of the target client based on the oversampling benefit-cost ratio and the undersampling benefit-cost ratio includes: If the oversampling benefit-cost ratio is not greater than the undersampling benefit-cost ratio, then the majority class in the current global distribution is determined, and the feature vector corresponding to each data sample in the majority class is extracted from the local distribution of the target client. Calculate the intra-class density of each feature vector, as well as the mean cosine similarity and variance of its similarity with other feature vectors, and determine multiple redundant candidate samples based on the intra-class density, mean cosine similarity, and variance of the similarity of each feature vector. The similarity between each redundant candidate sample and the corresponding data sample in other clients is calculated, and the redundant candidate samples with a similarity higher than a preset redundancy threshold with at least N other clients are identified as redundant samples, and the redundant samples are removed from the local distribution.
6. The federated learning global class distribution optimization method according to claim 1, characterized in that, The step of recalculating the global distribution balance based on the local distribution includes: Calculate the difference vector between this local distribution and the local distribution before the resampling operation; The difference vectors are accumulated into the current global distribution to obtain a new global distribution. The ratio between the number of samples corresponding to the class with the fewest samples and the number of samples corresponding to the class with the most samples in the new global distribution is calculated to obtain the balance of the new global distribution.
7. A global class distribution optimization device for federated learning, characterized in that, The device includes: The balance calculation module is used to calculate the global distribution balance based on the global distribution of the central server before performing federated learning. The client determination module is used to determine the skew contribution score of each client participating in the global class optimization of federated learning when the global distribution balance is lower than a preset threshold, and select the client with the highest skew contribution score as the target client. The resampling module is used to calculate the oversampling benefit-cost ratio and the undersampling benefit-cost ratio of the target client respectively, and to perform corresponding resampling operations on the local distribution of the target client based on the oversampling benefit-cost ratio and the undersampling benefit-cost ratio. The first iteration module is used to obtain the local distribution of the target client after the resampling operation, and recalculate the global distribution balance based on the local distribution. When the target client reaches the maximum correction capability, it returns to the client determination module to continue execution. The second iteration module is used to return to the resampling module to continue execution when the target client has not reached the maximum correction capability, until the recalculated global distribution balance is not lower than the preset threshold. The balance calculation module includes: The ciphertext acquisition submodule is used to acquire the globally distributed ciphertext formed by the circular accumulation of each client participating in federated learning. The globally distributed ciphertext is formed by the local distribution accumulation through the virtual circular message passing link formed by each client. The ciphertext decryption submodule is used to decrypt the globally distributed ciphertext to obtain the global distribution of the central server, and to calculate the ratio between the number of samples corresponding to the class with the fewest samples and the number of samples corresponding to the class with the most samples in the global distribution, thus forming the global distribution balance.
8. A storage medium, characterized in that: The storage medium stores computer-readable instructions that, when executed by one or more processors, cause the one or more processors to perform the steps of the federated learning global class distribution optimization method as described in any one of claims 1 to 6.
9. A computer device, characterized in that, include: One or more processors, and memory; The memory stores computer-readable instructions that, when executed by the one or more processors, perform the steps of the federated learning global class distribution optimization method as described in any one of claims 1 to 6.
Citation Information
Patent Citations
Federal learning contribution degree evaluation and income distribution system and method
CN121562857A
Federal learning method and device and storage medium
CN122154975A