Sample selection method, system, electronic device and medium based on federated learning

By dynamically selecting training samples in federated learning, and using the federated learning algorithm, gradient descent algorithm, and Pareto algorithm to partition the sample set, the problem of imbalanced data is solved, and the model accuracy and convergence speed are improved.

CN116468130BActive Publication Date: 2026-03-24PING AN TECH (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-05-06
Publication Date
2026-03-24

AI Technical Summary

Technical Problem

Existing traditional data sampling methods cannot perform sample label-based sampling in longitudinal federated learning, resulting in imbalanced sample data, which affects model accuracy and reduces the accuracy of randomly selecting users in each round.

Method used

By acquiring training task samples, local updates and calculations are performed using a pre-defined federated learning algorithm and gradient descent algorithm. The Pareto algorithm is then used to partition the sample set and dynamically select data samples to participate in training, thereby reducing data imbalance.

Benefits of technology

It improves the accuracy and convergence speed of model analysis, reduces computational costs, and solves the data imbalance problem in federated learning, thereby improving model accuracy.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116468130B_ABST
    Figure CN116468130B_ABST
Patent Text Reader

Abstract

The embodiment of the application provides a sample selection method and system based on federated learning, an electronic device and a medium, and belongs to the technical field of artificial intelligence. The method is applied to a server participating in federated learning, the server is in communication connection with a plurality of sub-devices, and the method comprises the following steps: obtaining a training task sample, wherein the training task sample comprises a sample subset; sending the training task sample to each sub-device based on a preset federated learning algorithm for local updating, so as to obtain a local loss function; calculating the local loss function based on a preset gradient descent algorithm, so as to obtain a predicted loss function; iteratively processing the predicted loss function according to the sample subset, so as to obtain model parameters of federated learning; and selecting the sample subset according to the model parameters, so as to obtain target samples. According to the embodiment of the application, data samples participating in training can be dynamically selected, and the data imbalance in federated learning can be reduced.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of artificial intelligence, and in particular to a sample selection method and system based on federated learning, an electronic device, and a medium. BACKGROUND

[0002] With the continuous development of computer software and artificial intelligence, especially the continuous development of Internet technology finance, more and more technologies (such as distributed, blockchain, artificial intelligence, etc.) are applied in the financial field, and therefore the financial industry has put forward higher requirements for related technologies.

[0003] In the process of data processing in the financial industry, machine learning modeling is widely used in the process of data processing. Federated learning is a user-centered computing mode, and federated learning in machine learning modeling usually needs to obtain sample data and rely on multi-node local training and uploading of parameters for sharing to achieve data interconnection. At present, when obtaining sample data, the sample sampling method used is a traditional data sampling method, for example, random up-sampling, random down-sampling, etc. However, the traditional data sampling method cannot be used for sampling based on sample labels in vertical federated learning, which leads to the problem of unbalanced sample data after sampling. Therefore, the heterogeneity of users is a bottleneck that affects the performance of federated learning. Such sample data will greatly affect the model accuracy, and the greater the difference between classes, the greater the difference in sample distribution between users, and the lower the accuracy of randomly selecting users for training each round. SUMMARY

[0004] The main purpose of the embodiments of the present application is to provide a sample selection method and system based on federated learning, which can dynamically select data samples participating in training and reduce data imbalance in federated learning.

[0005] To achieve the above purpose, a first aspect of the embodiments of the present application provides a sample selection method based on federated learning, the federated learning comprising a plurality of sub-devices, the method comprising:

[0006] obtaining a training task sample, wherein the training task sample comprises a sample subset, and the training task sample is divided from an initial sample set collected by the sub-devices;

[0007] sending the training task sample to each of the sub-devices based on a preset federated learning algorithm for local updating to obtain a local loss function;

[0008] calculating the local loss function based on a preset gradient descent algorithm to obtain a predicted loss function;

[0009] iterating the prediction loss function according to the sample subsets, to obtain model parameters of the federated learning;

[0010] selecting the sample subsets according to the model parameters, to obtain target samples.

[0011] In some embodiments, the obtaining the training task samples comprises:

[0012] receiving an initial sample set collected by the sub-devices;

[0013] dividing the initial sample set based on a preset Pareto algorithm and a sample distribution threshold, to obtain a plurality of the sample subsets;

[0014] generating the training task samples according to the sample subsets.

[0015] In some embodiments, the sending the training task samples to each of the sub-devices for local updating based on the preset federated learning algorithm, to obtain a local loss function, comprises:

[0016] allocating the training task samples to the plurality of sub-devices, so that each of the sub-devices locally updates the allocated training task samples, to obtain a plurality of allocated sample numbers and sample weight values;

[0017] calculating the allocated sample numbers and the sample weight values based on the preset federated learning algorithm and a preset local loss prediction parameter, to obtain the local loss function.

[0018] In some embodiments, the calculating the local loss function based on the preset gradient descent algorithm, to obtain a prediction loss function, comprises:

[0019] calculating the local loss function based on the preset gradient descent algorithm, to obtain a prediction function of the local loss function;

[0020] obtaining the prediction loss function according to the prediction function.

[0021] In some embodiments, the iterating the prediction loss function according to the sample subsets, to obtain model parameters of the federated learning, comprises:

[0022] screening the sample subsets, to obtain a first sample subset of the sample subsets;

[0023] iterating the prediction loss function according to the first sample subset, to obtain an iteration result;

[0024] determining the model parameters of the federated learning according to the iteration result.

[0025] In some embodiments, determining the model parameters of the federated learning based on the iteration results includes:

[0026] When the iteration result satisfies the preset iteration parameter conditions, a second sample subset corresponding to the first sample subset is determined in the sample subset. The prediction loss function is iterated according to the second sample subset to determine all iterative sample subsets that satisfy the preset termination conditions. The model parameters of the federated learning are determined according to the iterative sample subsets.

[0027] If the iteration result does not meet the preset iteration parameter conditions, the first sample subset is expanded to obtain a convergence formula, and the model parameters of the federated learning are determined according to the convergence formula.

[0028] In some embodiments, selecting the sample subset based on the model parameters to obtain the target sample includes:

[0029] The sample subset is filtered according to the model parameters to obtain the predicted sample subset;

[0030] The loss function that minimizes the predicted sample subset is calculated.

[0031] The target sample is determined based on the minimized loss function.

[0032] To achieve the above objectives, a second aspect of this application proposes a sample selection system based on federated learning. The system is applied to a server participating in federated learning, the server being communicatively connected to multiple sub-devices. The system includes:

[0033] The sample acquisition module is used to acquire training task samples, wherein the training task samples include a sample subset, and the training task samples are obtained by partitioning the initial sample set collected by the sub-device;

[0034] The local update module is used to send the training task samples to each of the sub-devices for local update based on a preset federated learning algorithm to obtain a local loss function;

[0035] The gradient descent module is used to calculate the local loss function based on a preset gradient descent algorithm to obtain the predicted loss function;

[0036] The sample iteration module is used to iterate the prediction loss function based on the sample subset to obtain the model parameters of the federated learning.

[0037] The target selection module is used to select the sample subset according to the model parameters to obtain the target sample.

[0038] To achieve the above objectives, a third aspect of this application proposes an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the federated learning-based sample selection method as described in the first aspect.

[0039] To achieve the above objectives, a fourth aspect of the present application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the federated learning-based sample selection method as described in the first aspect.

[0040] This application proposes a sample selection method, system, electronic device, and storage medium based on federated learning. First, training task samples, including a subset of samples, are acquired. Then, based on a pre-defined federated learning algorithm, the training task samples are sent to each sub-device in the federated learning system for local updates, thereby obtaining a local loss function. This facilitates the selection of a suitable training sample size in subsequent iterations, solving the problem of expensive evaluation of local loss functions for large datasets. By sending training task samples to each sub-device of the federated learning system, the global learning objective is coordinated. Next, a pre-defined gradient descent algorithm is used to calculate the local loss function, obtaining a predicted loss function. The predicted loss function is iterated based on the sample subset to obtain the model parameters of the federated learning system, thereby improving the accuracy of model analysis and increasing the convergence speed of the sample subset. Finally, the sample subset is selected based on the model parameters to obtain the target samples. This achieves dynamic selection of data samples participating in training, reducing data imbalance in federated learning and achieving high model accuracy while saving computational power. Attached Figure Description

[0041] Figure 1 This is a flowchart of the sample selection method based on federated learning provided in the embodiments of this application;

[0042] Figure 2 yes Figure 1 The flowchart of step S101 in the text;

[0043] Figure 3 yes Figure 1 The flowchart of step S102 in the document;

[0044] Figure 4 yes Figure 1 The flowchart of step S103 in the process;

[0045] Figure 5 yes Figure 1 The flowchart of step S104 in the process;

[0046] Figure 6 yes Figure 5The flowchart of step S503 in the process;

[0047] Figure 7 yes Figure 1 The flowchart of step S105 in the process;

[0048] Figure 8 This is a schematic diagram of the structure of the sample selection system based on federated learning provided in an embodiment of this application;

[0049] Figure 9 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation

[0050] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative and not intended to limit the scope of this application.

[0051] It should be noted that although functional modules are divided in the system diagram and the logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the system or the order in the flowchart. The terms "first," "second," etc., in the specification, claims, and the aforementioned drawings are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.

[0052] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.

[0053] First, let's analyze some of the terms used in this application:

[0054] Natural Language Processing (NLP): NLP uses computers to process, understand, and utilize human language (such as Chinese and English). NLP is a branch of artificial intelligence and an interdisciplinary field of computer science and linguistics, often referred to as computational linguistics. NLP includes syntactic analysis, semantic analysis, and discourse understanding. It is commonly used in machine translation, handwritten and printed character recognition, speech recognition and text-to-speech conversion, intent recognition, information extraction and filtering, text classification and clustering, sentiment analysis, and opinion mining. It involves data mining, machine learning, knowledge acquisition, knowledge engineering, artificial intelligence research, and linguistic research related to language computation.

[0055] Federated Learning: Federated learning is a distributed machine learning technique. Its core idea is to train a model in a distributed manner across multiple data sources that have local data. Without exchanging local individual or sample data, it constructs a global model based on virtual fused data by exchanging model parameters or intermediate results. This achieves a balance between data privacy protection and data sharing computation, namely, a new application paradigm of "data is available but not visible" and "the model moves while the data does not move".

[0056] Gradient descent (Steepest Descent): Gradient descent is an iterative method used to solve least squares problems (both linear and nonlinear). It is one of the most commonly used methods for solving unconstrained optimization problems in machine learning algorithms, alongside least squares. To find the minimum of the loss function, gradient descent can be used iteratively step-by-step to obtain the minimized loss function and model parameter values. Conversely, to find the maximum of the loss function, gradient ascent is used iteratively. In machine learning, two gradient descent methods have been developed based on the basic gradient descent method: stochastic gradient descent and batch gradient descent.

[0057] Loss Function: A loss function, also known as a cost function, maps the values ​​of a random event or its related random variables to non-negative real numbers to represent the "risk" or "loss" of that random event. In applications, the loss function is often used as a learning criterion in relation to optimization problems; that is, the model is solved and evaluated by minimizing the loss function. For example, it is used for parametric estimation in statistics and machine learning, for risk management and decision-making in macroeconomics, and for optimal control theory in control theory.

[0058] The Pareto Principle, also known as the 80 / 20 rule, the critical few rule, or the 80 / 20 principle, is a management principle proposed by Romanian management scholar Joseph Juran. It is named after the Italian economist Vilfredo Pareto. In 1906, Pareto famously concluded from his research on the distribution of wealth in Italian society that 20% of the population controlled 80% of the social wealth. This conclusion holds true for the distribution of social wealth in most countries. Therefore, it is also known as the 80 / 20 rule. Dr. Juran adopted this idea in management, believing that in any situation, the main outcome depends on only a small number of factors. This idea has been frequently applied to different fields and, after extensive testing, has proven to be correct in most cases. Therefore, this principle is very helpful in guiding management activities.

[0059] Hypertext Transfer Protocol (HTTP): HTTP is a protocol used for transferring text and files over networks, between networks, or between computer users. It plays a crucial role in computer and network security. HTTP is a simple request-response protocol that typically runs on top of TCP. It specifies what messages a client might send to a server and what responses it might receive.

[0060] Google Remote Procedure Calls (gRPC): gRPC is an open-source remote procedure call system initiated by Google. In gRPC, client applications can directly call server application methods from other computers as if they were local objects, making it easier to create distributed applications and services. Like many RPC systems, gRPC revolves around defining services, specifying methods that can be invoked remotely through their parameters and return types. On the server side, the server implements this interface and runs a gRPC server to handle client calls.

[0061] Based on this, embodiments of this application provide a sample selection method and system, electronic device and storage medium based on federated learning, which can reduce data imbalance in federated learning by dynamically selecting data samples to participate in training.

[0062] The sample selection method, system, electronic device, and storage medium based on federated learning provided in this application are specifically described through the following embodiments. First, the sample selection method based on federated learning in this application embodiment is described.

[0063] The embodiments of this application can acquire and process relevant data based on artificial intelligence technology. Artificial intelligence (AI) refers to the theories, methods, technologies, and application systems that use digital computers or machines controlled by digital computers to simulate, extend, and expand human intelligence, perceive the environment, acquire knowledge, and use that knowledge to obtain optimal results.

[0064] Foundational artificial intelligence technologies generally include sensors, dedicated AI chips, cloud computing, distributed storage, big data processing, operating / interactive systems, and mechatronics. AI software technologies mainly encompass computer vision, robotics, biometrics, federated learning-based sample selection, natural language processing, and machine learning / deep learning.

[0065] The federated learning-based sample selection method provided in this application relates to the field of artificial intelligence technology. This federated learning-based sample selection method can be applied to a terminal, a server, or software running on either a terminal or a server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, etc.; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms; the software can be an application implementing the federated learning-based sample selection method, but is not limited to the above forms.

[0066] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0067] It should be noted that in all specific embodiments of this application, when processing data related to user identity or characteristics, such as user information, user behavior data, user historical data, and user location information, user permission or consent is obtained first. Furthermore, the collection, use, and processing of this data comply with relevant laws, regulations, and standards of the relevant countries and regions. In addition, when embodiments of this application require access to sensitive personal information of users, separate permission or consent from the user is obtained through pop-ups or redirects to confirmation pages. Only after obtaining the user's separate permission or consent is the necessary user-related data for the proper functioning of the embodiments of this application obtained.

[0068] Figure 1 This is an optional flowchart of the sample selection method based on federated learning provided in the embodiments of this application. Figure 1 The method may include, but is not limited to, steps S101 to S105.

[0069] It should be noted that the sample selection method based on federated learning is applied to the server participating in federated learning. The server communicates with multiple sub-devices, which communicate with the server periodically. The communication method can be HTTP communication or gRPC communication.

[0070] Step S101: Obtain training task samples;

[0071] It should be noted that the training task samples p k Including sample subsets Furthermore, the training task samples are obtained by partitioning the initial sample set collected by the sub-devices.

[0072] In step S101 of some embodiments, multiple sample subsets are obtained. Training task samples p k This facilitates the dynamic distribution of federated learning and solves the problem of expensive evaluation of local loss functions for large datasets.

[0073] Step S102: Based on the preset federated learning algorithm, the training task samples are sent to each sub-device for local updates to obtain the local loss function;

[0074] In step S102 of some embodiments, training task samples are sent to each sub-device for local updates based on a preset federated learning algorithm to obtain a local loss function f(w). This allows the sub-devices to use different data distributions to measure the risk of local experience, thereby improving the prediction accuracy of federated learning.

[0075] Step S103: Calculate the local loss function based on the preset gradient descent algorithm to obtain the predicted loss function;

[0076] In step S103 of some embodiments, the local loss function f(w) is calculated based on a preset gradient descent algorithm to obtain the prediction loss function l(f(w; x). i ),y i This facilitates subsequent gradient iteration, improves convergence in the federated learning data processing process, and thus enhances the analytical accuracy of federated learning.

[0077] Step S104: Iterate the prediction loss function based on the sample subset to obtain the model parameters of federated learning;

[0078] In step S104 of some embodiments, the prediction loss function l(f(w;x) is adjusted according to the sample subset S. i ),y i The process iterates to obtain the model parameters of federated learning, thereby ensuring that the parameters of federated learning are always maintained in a state that allows gradient descent and thus maintains the convergence of federated learning.

[0079] Step S105: Select a subset of samples based on the model parameters to obtain the target samples.

[0080] In step S105 of some embodiments, a subset of samples is selected according to the model parameters to obtain target samples, thereby solving the problem of expensive evaluation of local loss functions for large datasets, analyzing the convergence when learning big data from imbalanced distributions, effectively improving the convergence speed for heterogeneous data, and maintaining low computational cost while achieving the desired accuracy.

[0081] Steps S101 to S105 as illustrated in this embodiment first involve acquiring training task samples including a sample subset, and then sending the training task samples to each sub-device in the federated learning process for local updates based on a preset federated learning algorithm. This yields a local loss function, facilitating the selection of a suitable training sample size during subsequent iterations and addressing the problem of expensive evaluation of local loss functions for large datasets. By sending training task samples to each sub-device in the federated learning process, the global learning objective is coordinated. Next, the local loss function is calculated based on a preset gradient descent algorithm to obtain a predicted loss function. The predicted loss function is then iterated based on the sample subset to obtain the model parameters for the federated learning process. This improves the accuracy of model analysis and increases the convergence speed of the sample subset. Finally, the sample subset is selected based on the model parameters to obtain the target samples. This achieves the reduction of data imbalance in the federated learning process by dynamically selecting data samples for training, saving computational power while enabling the model to achieve higher accuracy.

[0082] Please see Figure 2 In some embodiments, step S101 may include, but is not limited to, steps S201 to S203:

[0083] It's important to note that user heterogeneity is a bottleneck affecting federated learning performance. This heterogeneity includes both user data heterogeneity and user resource heterogeneity. User resource heterogeneity mainly manifests as differences in network bandwidth and computational performance, primarily affecting efficiency, and there are many solutions for this. However, data heterogeneity is reflected in different user sample sizes, non-independent and identically distributed user data, and an overall imbalanced data distribution, typically with a much smaller proportion of negative samples than positive samples. Therefore, dynamically selecting data samples is necessary to reduce data imbalance in federated learning.

[0084] Step S201: Receive the initial sample set collected by the sub-device;

[0085] Step S202: The initial sample set is divided based on the preset Pareto algorithm and sample distribution threshold to obtain multiple sample subsets;

[0086] Step S203: Generate training task samples based on the sample subset.

[0087] In some embodiments, steps S201 to S203 involve obtaining an initial sample set and a sample distribution threshold V. k Then, based on the preset Pareto algorithm and the sample distribution threshold V, k The initial sample set is divided into multiple sample subsets, which allows the dataset to be divided into large and small datasets. Training task samples are then generated based on these multiple sample subsets, which facilitates subsequent model training and increases the accuracy of model training.

[0088] It should be noted that, in order to effectively analyze data heterogeneity, a sample distribution threshold V is set. k To differentiate sample size, based on the Pareto principle, 80% of the resources can be allocated to 20% of the devices, i.e., the sub-devices in federated learning. Therefore, the threshold in the power-law distribution can be set to 20 / 80. This will serve as a standard for measuring the size of the sample subset, and further dynamic distribution will be based on this.

[0089] Please see Figure 3 In some embodiments, step S102 may include, but is not limited to, steps S301 to S302:

[0090] Step S301: The training task samples are distributed to multiple sub-devices, so that each sub-device performs local updates on the distributed training task samples to obtain multiple distributed sample numbers and sample weight values.

[0091] In step S301 of some embodiments, training task samples are allocated to multiple sub-devices, such that each sub-device performs a local update on the allocated training task samples to obtain multiple allocated sample numbers n. k and sample weight q k This facilitates the server to aggregate and average the updates of all sub-devices, making it easier to obtain model parameters later.

[0092] Step S302: Calculate the number of assigned samples and sample weights based on the preset federated learning algorithm and preset local loss prediction parameters to obtain the local loss function.

[0093] In step S302 of some embodiments, the number of samples n is allocated based on a preset federated learning algorithm and a preset local loss prediction parameter w. k and sample weight q k The local loss function f(w) is calculated, which facilitates the subsequent acquisition of model parameters and minimizes the global learning loss.

[0094] It should be noted that the process of obtaining the local loss function based on the preset federated learning algorithm and the preset local loss prediction parameters is shown in the following formula (1):

[0095]

[0096] Where K is the number of deployed sub-devices, w is the preset local loss prediction parameter, and q k It is the sample weight value, n k It is the number of samples to be allocated, F k (w) is the target value under the local loss prediction parameters.

[0097] Please see Figure 4 In some embodiments, step S103 may include, but is not limited to, steps S401 to S402:

[0098] Step S401: Calculate the local loss function based on the preset gradient descent algorithm to obtain the prediction function of the local loss function;

[0099] Step S402: Obtain the prediction loss function based on the prediction function.

[0100] In steps S401 to S402 as shown in the embodiments of this application, the local loss function f(w) is calculated based on a preset gradient descent algorithm to obtain the prediction function f(w; x) of the local loss function f(w). i Then, the prediction function f(w; x) is then evaluated. i The calculation is performed to obtain the prediction loss function l(f(w;x)). i ),yi The prediction loss function is a convex loss function, which facilitates the subsequent selection of sample subsets, ensuring data security while making the model more flexible and improving the analytical accuracy of federated learning.

[0101] Please see Figure 5 In some embodiments, step S104 may also include, but is not limited to, steps S501 to S503:

[0102] Step S501: Filter the sample subset to obtain the first sample subset;

[0103] In step S501 of some embodiments, the sample subset is... After filtering, the first sample subset |S| is obtained, where the first sample subset |S| is the sample subset with a small sample size in the sample subset.

[0104] Step S502: Iterate the prediction loss function based on the first sample subset to obtain the iteration result;

[0105] In step S502 of some embodiments, the prediction loss function is iterated according to the first sample subset |S| to obtain the iteration result, which facilitates the subsequent judgment of the convergence of federated learning.

[0106] Step S503: Determine the model parameters for federated learning based on the iteration results.

[0107] In step S503 of some embodiments, the model parameters of federated learning are determined based on the iteration results, so that the model parameters are always maintained in a state that allows the gradient to decrease, i.e., the model to converge.

[0108] Please see Figure 6 In some embodiments, step S503 includes, but is not limited to, steps S601 to S602:

[0109] Step S601: When the iteration result satisfies the preset iteration parameter conditions, determine the second sample subset corresponding to the first sample subset in the sample subset, iterate the prediction loss function according to the second sample subset to determine all iterative sample subsets that satisfy the preset termination conditions, and determine the model parameters of federated learning according to the iterative sample subsets.

[0110] In step S601 of some embodiments, when the iteration result satisfies the preset iteration parameter conditions, in the sample subset The second sample subset corresponding to the first sample subset |S| is determined. The prediction loss function is iterated based on the second sample subset to determine all iterative sample subsets that meet the preset termination condition. The model parameters of federated learning are determined based on the iterative sample subsets, so that the model always remains in the state of model convergence.

[0111] It should be noted that if the iteration results meet the preset iteration parameter conditions, it indicates that federated learning has improved. Therefore, a second sample subset of the same size as the first sample subset needs to be selected for further iteration. This process determines all iteration sample subsets that meet the preset termination conditions, and the model parameters for federated learning are determined based on these subsets. This ensures the model remains convergent. This embodiment dynamically selects the training sample size based on the available local data size to address the problem of expensive evaluation of local objective functions for large datasets. Furthermore, the convergence of learning from imbalanced distributions of large datasets is analyzed, effectively improving the convergence speed for heterogeneous data while maintaining low computational cost to achieve the desired accuracy.

[0112] Step S602: When the iteration result does not meet the preset iteration parameter conditions, the first sample subset is expanded to obtain the convergence formula, and the model parameters of federated learning are determined according to the convergence formula.

[0113] In step S602 of some embodiments, if the iteration result does not meet the preset iteration parameter conditions, the first sample subset |S| is expanded to increase the value of the first sample subset |S|, thereby obtaining the convergence formula. Then, the model parameters of federated learning are determined according to the convergence formula to improve the computational accuracy of federated learning.

[0114] It should be noted that the preset iteration parameter conditions in this embodiment are as follows: Where θ∈[0,1), when the iteration result does not meet the preset iteration parameter condition, it means that a larger sample is needed for federated learning to converge. The specific relationship between the iteration result and the iteration parameter can be shown by the following formula (2):

[0115]

[0116] Where |S| represents a small sample size within the sample subset, for example, it can be the first sample subset in this embodiment. The parameters for gradient descent in federated learning are f(w), which is the local loss function, and i is the index of the current subset in the sample subset.

[0117] Understandable It is obtained by minimizing the loss function based on a subset of samples.

[0118] It should be noted that if the iteration result does not satisfy the formula shown in formula (2) above, the first sample subset |S| needs to be expanded to increase the value of the first sample subset |S|, thereby obtaining the convergence formula. Then, the sample subset required for subsequent iterations is obtained through the convergence formula. The model parameters of federated learning are determined based on the first sample subset and the subset obtained through the convergence formula. The specific convergence formula is shown in formula (3) below:

[0119]

[0120] in, This is the sample subset obtained through the convergence formula. Given the preset iteration parameter conditions, p k For training task samples, The parameters for gradient descent in federated learning are f(w), which is the local loss function, and i is the index of the current subset in the sample subset.

[0121] Please see Figure 7 In some embodiments, step S105 includes, but is not limited to, steps S701 to S703:

[0122] Step S701: Filter the sample subset according to the model parameters to obtain the predicted sample subset;

[0123] Step S702: Calculate the loss function that minimizes the predicted sample subset;

[0124] Step S703: Determine the target sample based on minimizing the loss function.

[0125] In steps S701 to S703 of some embodiments, the sample subset S is filtered according to the model parameters to obtain the predicted sample subset. Then, the predicted sample subset is calculated to obtain the minimized loss function of the predicted sample subset. Finally, the target sample is determined according to the minimized loss function. This can save federated learning computation while achieving higher accuracy in federated learning.

[0126] It should be noted that the loss function for minimizing the predicted sample subset is calculated as shown in the following formula (4):

[0127] |S|·J s (w)=∑ i∈S l(f(w;x i ),y i (4)

[0128] Where f(w) is the local loss function, f(w; x) i ) is the prediction function of the local loss function, l(f(w;x)i ),y i ) is the prediction loss function, where the prediction loss function is a convex loss function, which facilitates the subsequent selection of sample subsets, ensuring data security while making the model more flexible and improving the analytical accuracy of federated learning.

[0129] Please see Figure 8 This application also provides a sample selection system based on federated learning, which can implement the above-mentioned sample selection method based on federated learning. The system is applied to a server participating in federated learning, and the server is communicatively connected to multiple sub-devices. The system includes:

[0130] The sample acquisition module 801 is used to acquire training task samples, wherein the training task samples include a sample subset, and the training task samples are obtained by partitioning the initial sample set collected by the sub-device;

[0131] The local update module 802 is used to send training task samples to each sub-device for local update based on a preset federated learning algorithm to obtain a local loss function;

[0132] The gradient descent module 803 is used to calculate the local loss function based on a preset gradient descent algorithm to obtain the predicted loss function;

[0133] The sample iteration module 804 is used to iterate the prediction loss function based on a subset of samples to obtain the model parameters for federated learning.

[0134] The target selection module 805 is used to select a subset of samples based on model parameters to obtain the target samples.

[0135] The specific implementation of this federated learning-based sample selection system is basically the same as the specific implementation of the federated learning-based sample selection method described above, and will not be repeated here.

[0136] This application also provides an electronic device, which includes: a memory, a processor, a program stored in the memory and executable on the processor, and a data bus for communication between the processor and the memory. When the program is executed by the processor, it implements the aforementioned federated learning-based sample selection method. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.

[0137] Please see Figure 9 , Figure 9 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes:

[0138] The processor 901 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.

[0139] The memory 902 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 902 can store the operating system and other application programs. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 902 and is called and executed by the processor 901 to execute the federated learning-based sample selection method of the embodiments of this application.

[0140] The input / output interface 903 is used to implement information input and output;

[0141] The communication interface 904 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, Ethernet cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).

[0142] Bus 905 transmits information between various components of the device (e.g., processor 901, memory 902, input / output interface 903, and communication interface 904);

[0143] The processor 901, memory 902, input / output interface 903, and communication interface 904 are connected to each other within the device via bus 905.

[0144] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described federated learning-based sample selection method.

[0145] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.

[0146] The sample selection method, system, electronic device, and storage medium based on federated learning provided in this application first acquire training task samples including a sample subset. Then, based on a preset federated learning algorithm, the training task samples are sent to each sub-device in the federated learning process for local updates, thereby obtaining a local loss function. This facilitates the selection of a suitable training sample size during subsequent iterations, solving the problem of expensive evaluation of local loss functions for large datasets. By sending training task samples to each sub-device in the federated learning process, the global learning objective is coordinated. Next, a preset gradient descent algorithm is used to calculate the local loss function, obtaining a predicted loss function. The predicted loss function is then iterated based on the sample subset to obtain the model parameters for federated learning, thereby improving the accuracy of model analysis and increasing the convergence speed of the sample subset. Finally, the sample subset is selected based on the model parameters to obtain the target samples. This achieves dynamic selection of data samples participating in training, reducing data imbalance in federated learning and saving computational power while achieving high model accuracy.

[0147] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.

[0148] It will be understood by those skilled in the art that Figures 1-7 The technical solutions shown do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.

[0149] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; 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.

[0150] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.

[0151] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.

[0152] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.

[0153] In the embodiments provided in this application, it should be understood that the disclosed systems and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be through some interfaces; the indirect coupling or communication connection between systems or units may be electrical, mechanical, or other forms.

[0154] The units described above 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 units can be selected to achieve the purpose of this embodiment according to actual needs.

[0155] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.

[0156] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or 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 multiple 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 of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.

[0157] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.

Claims

1. A sample selection method based on federated learning, the method being applied to a server participating in federated learning, the server being communicatively connected to multiple sub-devices, characterized in that, The method includes: Acquire training task samples, wherein the training task samples include a sample subset, and the training task samples are obtained by partitioning the initial sample set collected from the sub-device; The training task samples are allocated to multiple sub-devices, such that each sub-device performs a local update on the allocated training task samples to obtain multiple allocated sample numbers and sample weight values. Based on a preset federated learning algorithm and preset local loss prediction parameters, the number of allocated samples and the sample weight values ​​are calculated to obtain a local loss function, wherein, ,in, It is a local loss function. This refers to the number of the deployed sub-devices. These are the local loss prediction parameters. It is the sample weight value. That is the number of allocated samples. It is the target value under the local loss prediction parameters; The local loss function is calculated based on a preset gradient descent algorithm to obtain the predicted loss function; The model parameters of the federated learning are obtained by iterating the prediction loss function based on the sample subset. The target sample is obtained by selecting the sample subset based on the model parameters.

2. The sample selection method based on federated learning according to claim 1, characterized in that, The acquisition of training task samples includes: Receive the initial sample set collected by the sub-device; The initial sample set is divided based on a preset Pareto algorithm and a sample distribution threshold to obtain multiple sample subsets; The training task samples are generated based on the subset of samples.

3. The sample selection method based on federated learning according to claim 1, characterized in that, The local loss function is calculated based on a preset gradient descent algorithm to obtain a predicted loss function, including: The local loss function is calculated based on a preset gradient descent algorithm to obtain the prediction function of the local loss function; The prediction loss function is obtained based on the prediction function.

4. The sample selection method based on federated learning according to claim 1, characterized in that, The step of iterating the prediction loss function based on the sample subset to obtain the model parameters of the federated learning includes: The sample subset is filtered to obtain the first sample subset of the sample subset; The prediction loss function is iterated based on the first sample subset to obtain the iteration result; The model parameters for federated learning are determined based on the iteration results.

5. The sample selection method based on federated learning according to claim 4, characterized in that, Determining the model parameters of the federated learning based on the iteration results includes: When the iteration result satisfies the preset iteration parameter conditions, a second sample subset corresponding to the first sample subset is determined in the sample subset. The prediction loss function is iterated according to the second sample subset to determine all iterative sample subsets that satisfy the preset termination conditions. The model parameters of the federated learning are determined according to the iterative sample subsets. If the iteration result does not meet the preset iteration parameter conditions, the first sample subset is expanded to obtain a convergence formula, and the model parameters of the federated learning are determined according to the convergence formula.

6. The sample selection method based on federated learning according to claim 1, characterized in that, The step of selecting the sample subset based on the model parameters to obtain the target sample includes: The sample subset is filtered according to the model parameters to obtain the predicted sample subset; The loss function that minimizes the predicted sample subset is calculated. The target sample is determined based on the minimized loss function.

7. A sample selection system based on federated learning, the system being applied to a server participating in federated learning, the server being communicatively connected to multiple sub-devices, characterized in that, The system includes: The sample acquisition module is used to acquire training task samples, wherein the training task samples include a sample subset, and the training task samples are obtained by partitioning the initial sample set collected by the sub-device; The local update module is configured to: distribute the training task samples to multiple sub-devices, such that each sub-device performs a local update on the distributed training task samples to obtain multiple allocated sample numbers and sample weight values; calculate the allocated sample numbers and sample weight values ​​based on a preset federated learning algorithm and preset local loss prediction parameters to obtain a local loss function, wherein... ,in, It is a local loss function. This refers to the number of the deployed sub-devices. These are the local loss prediction parameters. It is the sample weight value. That is the number of allocated samples. It is the target value under the local loss prediction parameters; The gradient descent module is used to calculate the local loss function based on a preset gradient descent algorithm to obtain the predicted loss function; The sample iteration module is used to iterate the prediction loss function based on the sample subset to obtain the model parameters of the federated learning. The target selection module is used to select the sample subset according to the model parameters to obtain the target sample.

8. An electronic device, characterized in that, The electronic device includes a memory and a processor, the memory storing a computer program, and the processor executing the computer program to implement the sample selection method based on federated learning as described in any one of claims 1 to 6.

9. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the sample selection method based on federated learning as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Networked ICU intelligent medical decision-making method based on federated learning and storage medium

    CN115881306A