Data processing method, device, equipment and medium
By determining the proportion and prediction weight of the target data in the sample data of the participants, a federated prediction model is constructed, which solves the problems of low federated training efficiency and prediction performance, and achieves more efficient and accurate model training.
Patent Information
- Application Number
- CN202010787792.7
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-08-06
- Publication Date
- 2024-11-15
- Estimated Expiration
- 2040-08-06
AI Technical Summary
In the prior art, the federal training efficiency is inefficient and the prediction performance of the obtained federal standard model is low. It is mainly because each participant has the same training weight or prediction weight, resulting in some invalid data occupying the training weight or prediction weight, affecting the training efficiency and prediction of the model. performance.
By determining the proportion of target data in the sample data of each participant that is consistent with the data characteristics of the first participant, the prediction weight of the participant is determined based on these proportions, and a preset prediction model is constructed through federated learning to ensure the effectiveness of the training data and predict performance.
It improves the federal training efficiency and model prediction performance, avoids invalid data interference, and improves the accuracy of the model.
Smart Images

Figure CN111898768B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of artificial intelligence technology in financial technology (Fintech), and in particular to a data processing method, device, equipment and medium. Background Art
[0002] With the continuous development of financial technology, especially Internet technology finance, more and more technologies (such as distributed, blockchain, artificial intelligence, etc.) are applied in the financial field, but the financial industry also puts forward higher requirements for technology, such as higher requirements for data processing.
[0003] At present, on the one hand, no single participant can collect enough data to accurately build an effective machine learning model. On the other hand, due to the need for privacy protection, one participant uses federated learning to jointly train a model suitable for its own task with different participants, which becomes the main way to build the required target machine learning model.
[0004] In the prior art, when a participant jointly trains its own model with other participants, each participant has the same training weight or prediction weight, which causes some invalid training data in the data of a participant to occupy the training weight or prediction weight, resulting in low training efficiency and poor prediction performance of the target model. Summary of the invention
[0005] The main purpose of this application is to provide a data processing method, device, equipment and medium, aiming to solve the technical problems in the prior art that the efficiency of federated training is low and the prediction performance of the obtained federated label model is low.
[0006] To achieve the above-mentioned purpose, the present application provides a data processing method, which is applied to a first participant, the first participant is connected to a second participant for communication, and there are multiple second participants. The data processing method includes:
[0007] Determine, in the second sample data of each of the second participants, a data proportion of the target data having the same characteristics as the first participant's data in the second sample data;
[0008] Determine the first participant prediction weight of each second sample data based on the proportion of each data;
[0009] Based on the prediction weight of the first participant and the first sample data of the first participant, a preset prediction model of the first participant is determined through federated learning.
[0010] Optionally, the step of determining the data proportion of target data consistent with the data characteristics of the first party in the second sample data of each of the second participants includes:
[0011] Receiving the data ratio sent by each second participant, wherein each second participant inputs the corresponding second sample data into the corresponding preset field classification model, and then performs prediction processing on the second sample data to obtain the data ratio of the target data in the second sample data that is consistent with the data characteristics of the first participant;
[0012] Among them, the preset domain classification model is based on training sample data with preset participant source labels. By executing the first preset federal process and iteratively training the first preset prediction model to be trained, the first target model for predicting the proportion of data sources of each participant is obtained.
[0013] Optionally, the sample data of the first participant is first sample data, and the step of determining the preset prediction model of the first participant through federated learning based on the prediction weight of the first participant and the first sample data of the first participant includes:
[0014] Based on the prediction weight of the first participant and the first sample data of the first participant, iteratively train the second preset prediction model to be trained by executing a second preset federated process to obtain a second target model;
[0015] The second target model is set as the preset prediction model of the first participant.
[0016] Optionally, the step of iteratively training a second preset prediction model to be trained based on the prediction weight of the first participant and the first sample data of the first participant to obtain a second target model by executing a second preset federated process includes:
[0017] Receiving a second model initial gradient sent by a second participant, wherein the second model initial gradient is determined by each second participant based on corresponding second sample data during execution of a second preset federated process;
[0018] Based on the initial gradient of the second model and the corresponding prediction weight of the first participant, obtaining the second model update gradient of each second participant;
[0019] Based on the second model update gradient and the first model update gradient determined by the first participant based on the first sample data in executing the second preset federated process, determining a replacement update model parameter;
[0020] Based on the replacement and updating of the model parameters, the model parameters in the second preset prediction model to be trained are iteratively updated to obtain a second target model.
[0021] Optionally, the first participant and the second participant are connected in communication via a preset intermediary;
[0022] The step of iteratively training the second preset prediction model to be trained based on the prediction weight of the first participant and the first sample data of the first participant to obtain the second target model by executing a second preset federated process includes:
[0023] In executing the second preset federated process, determining a first model update gradient based on the first sample data, and sending the first model update gradient to a preset intermediary;
[0024] Receiving the initial gradient of the second model sent by the preset intermediary, corresponding to the predicted weight of the first participant and the updated gradient of the first model, and determining the replacement updated model parameters;
[0025] The second participant determines the initial gradient of the second model based on the second sample data, and encrypts the initial gradient of the second model and sends it to the preset intermediary;
[0026] Based on the replacement and updating of the model parameters, the model parameters in the second preset prediction model to be trained are iteratively updated to obtain a second target model.
[0027] Optionally, the step of receiving the replacement and update model parameters determined based on the initial gradient of the second model and corresponding to the prediction weight of the first participant and the update gradient of the first model sent by the preset intermediary includes:
[0028] Receive the replacement update model parameters determined based on the initial gradient of the second model, corresponding to the predicted weight of the first participant and the updated gradient of the first model, sent encrypted by a preset intermediary.
[0029] Optionally, after the step of determining the preset prediction model of the first participant based on the prediction weight of the first participant and the first sample data of the first participant, the step further includes:
[0030] Acquire data to be processed, and input the data to be processed into the preset prediction model;
[0031] Based on the preset prediction model, the data to be processed is predicted and processed to obtain a target prediction result.
[0032] The present application also provides a data processing device, applied to a first participant, the first participant is connected to a second participant for communication, there are multiple second participants, and the data processing device includes:
[0033] A first determination module is used to determine the data proportion of target data consistent with the data characteristics of the first party in the second sample data of each of the second participants;
[0034] A second determination module is used to determine the first participant prediction weight of each second sample data based on the proportion of each data;
[0035] The third determination module is used to determine the preset prediction model of the first participant through federated learning based on the prediction weight of the first participant and the first sample data of the first participant.
[0036] Optionally, the first determining module includes:
[0037] A receiving unit, configured to receive a data ratio sent by each second participant, wherein each second participant inputs the corresponding second sample data into a corresponding preset domain classification model, and then performs prediction processing on the second sample data to obtain a data ratio of target data in the second sample data that is consistent with the data features of the first participant;
[0038] Among them, the preset domain classification model is based on training sample data with preset participant source labels. By executing the first preset federal process and iteratively training the first preset prediction model to be trained, the first target model for predicting the proportion of data sources of each participant is obtained.
[0039] Optionally, the sample data in the first participant is first sample data, and the third determination module includes:
[0040] A first execution unit is configured to iteratively train a second preset prediction model to be trained based on the prediction weight of the first participant and the first sample data of the first participant by executing a second preset federated process to obtain a second target model;
[0041] A setting unit is used to set the second target model as a preset prediction model of the first participant.
[0042] Optionally, the first execution unit includes:
[0043] A first receiving subunit is configured to receive a second model initial gradient sent by a second participant, wherein the second model initial gradient is determined by each second participant based on corresponding second sample data during execution of a second preset federated process;
[0044] An acquisition subunit, configured to acquire a second model update gradient of each second participant based on the initial gradient of the second model and the corresponding prediction weight of the first participant;
[0045] a determination subunit, configured to determine a replacement update model parameter based on the second model update gradient, and the first participant, in executing the second preset federated process, determining the first model update gradient determined based on the first sample data;
[0046] The first updating subunit is used to iteratively update the model parameters in the second preset prediction model to be trained based on the replacement updating model parameters to obtain a second target model.
[0047] Optionally, the first participant and the second participant are connected in communication via a preset intermediary;
[0048] The first execution unit further includes:
[0049] a sending subunit, configured to determine a first model update gradient based on the first sample data during execution of a second preset federated process, and send the first model update gradient to a preset intermediary;
[0050] A second receiving subunit is used to receive a replacement update model parameter determined by a preset intermediary based on the initial gradient of the second model and the first model update gradient corresponding to the predicted weight of the first participant;
[0051] The second participant determines the initial gradient of the second model based on the second sample data, and encrypts the initial gradient of the second model and sends it to the preset intermediary;
[0052] The second updating subunit is used to iteratively update the model parameters in the second preset prediction model to be trained based on the replacement update model parameters to obtain a second target model.
[0053] Optionally, the second receiving subunit is used to implement:
[0054] Receive the replacement update model parameters determined based on the initial gradient of the second model, corresponding to the predicted weight of the first participant and the updated gradient of the first model, sent encrypted by a preset intermediary.
[0055] Optionally, the data processing device further includes:
[0056] A first acquisition module, used for acquiring data to be processed, and inputting the data to be processed into the preset prediction model;
[0057] The second acquisition module is used to perform prediction processing on the data to be processed based on the preset prediction model to obtain a target prediction result.
[0058] The present application also provides a data processing device, which is a physical device, and includes: a memory, a processor, and a program of the data processing method stored in the memory and executable on the processor. When the program of the data processing method is executed by the processor, the steps of the data processing method as described above can be implemented.
[0059] The present application also provides a medium, on which is stored a program for implementing the above-mentioned data processing method, and when the program of the data processing method is executed by a processor, the steps of the above-mentioned data processing method are implemented.
[0060] The present application determines the data proportion of target data consistent with the data characteristics of the first participant in the second sample data of each of the second participants; determines the first participant prediction weight of each second sample data based on each of the data proportions; and determines the preset prediction model of the first participant through federated learning based on the first participant prediction weight and the first sample data of the first participant. The present application determines the prediction weight of the first participant of each second sample data by determining the data proportion of the target data consistent with the data characteristics of the first participant in the second sample data of each of the second participants, and determines the preset prediction model of the first participant by federation. That is, the present application determines the prediction weight with actual effective training function for the first participant in the second sample data of each different distribution by adding the data proportion, and obtains the preset prediction model of the first participant by federation. Compared with the prior art in which each participant has the same training proportion or prediction proportion, resulting in some invalid training data in the data of a certain participant occupying the training proportion or prediction proportion, the present application jointly trains the federal model based on the actual effective (occupying training proportion or prediction proportion) training data of each participant, thereby avoiding efficiency interference caused by invalid data and improving federal training efficiency. Since the training data is valid, the model accuracy of the federal model is improved to improve the prediction performance of the model. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.
[0062] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, for ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative labor.
[0063] Figure 1 This is a flow chart of the first embodiment of the data processing method of the present application;
[0064] Figure 2 This is a schematic flow chart of the detailed steps of performing speech recognition on speech data to be recognized to obtain candidate results of the speech data to be recognized in the first embodiment of the data processing method of the present application;
[0065] Figure 3 A schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application;
[0066] Figure 4 This is a schematic diagram of the first scenario in the data processing method of this application;
[0067] Figure 5 This is a schematic diagram of the second scenario in the data processing method of this application;
[0068] Figure 6 This is a schematic diagram of the third scenario in the data processing method of this application.
[0069] The purpose, features and advantages of this application will be further described in conjunction with the embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0070] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0071] The present application embodiment provides a data processing method. In the first embodiment of the data processing method of the present application, refer to Figure 1 , applied to a first participant, the first participant is in communication connection with a second participant, there are multiple second participants, and the data processing method includes:
[0072] Step S10, determining the data proportion of target data consistent with the data characteristics of the first party in the second sample data of each of the second participants;
[0073] Step S20, determining the first participant prediction weight of each second sample data based on the proportion of each data;
[0074] Step S30, based on the prediction weight of the first participant and the first sample data of the first participant, determine the preset prediction model of the first participant through federated learning.
[0075] The specific steps are as follows:
[0076] Step S10, determining the data proportion of target data consistent with the data characteristics of the first party in the second sample data of each of the second participants;
[0077] In general, the preset prediction model is based on a plurality of second participant data (second sample data) with prediction weights of the first participant and the first sample data of the first participant, and the first preset prediction model to be trained is iteratively trained through federated learning to obtain a first target model;
[0078] In this embodiment, after obtaining the preset prediction model, the data to be processed is obtained and input into the preset prediction model, wherein the preset prediction model is a trained model that can accurately predict the data to be processed. For example, if the data to be processed includes the user's age, weight, blood sugar content, and insulin level data, then after the data to be processed is input into the preset prediction model, it can be determined to output whether the user has diabetes.
[0079] It should be noted that, in this embodiment, federated learning includes horizontal federated learning or vertical federated learning, and the federated process includes horizontal federated process and vertical federated process. In this embodiment, the horizontal federated learning application is taken as an example for specific description.
[0080] It should be noted that the first participant includes the data union of all annotated (labeled) data and unlabeled data, which is the number of . For a certain participant (including the first participant and the second participant), X to Y obeys the same conditional distribution, that is, The edge distribution of data from different participants is different. Specifically, for example, the data accumulated by hospitals often comes from the sick population, and the data accumulated by nursing homes are for the elderly population, whose physical disease conditions vary greatly. The machine learning tasks of physical examination centers are mostly for young and middle-aged working adults. When existing hospitals jointly train machine models with nursing homes and physical examination centers, the participants such as hospitals, nursing homes and physical examination centers have the same training weight or prediction weight, that is, the data characteristics of the participants such as hospitals, nursing homes and physical examination centers are assumed to be the same as the characteristics of hospital data. In fact, the data of different participants are heterogeneous. Based on the same training weight or prediction weight, the training data of the hospital machine model is ineffective, resulting in low prediction performance of the model trained by federated learning.
[0081] In this embodiment, the target data consistent with the data features of the first participant in each second sample data can be determined to further determine the data ratio of the target data in the second sample data, or the data ratio of the target data in the second sample data can be directly determined. In this embodiment, the first participant, in addition to training the corresponding local model based on the local training data, also determines the target data in the second sample data of other second participants to determine the data ratio of the target (valid data) in the second sample data to improve the training effectiveness of the local model of the first participant. Specifically, for example, multiple second participants such as participant A and participant C jointly train the model of participant B (the first participant). In order to ensure the privacy of the user and because the initial models are the same, in this embodiment, the method for participant A and participant C to jointly train the model of participant B is as follows: select the target data in participant A that is valid for participant B, and obtain the data ratio in participant A that is valid for participant B, that is, the labeled (preset feature label) data from participant A is determined to be the parameter. The probability of the labeled data from participant A being the labeled data of participant B (or having the data characteristics of the first participant B) is determined, and then the first weight corresponding to the labeled data from participant A in the process of training the model of participant B is obtained, and the target data valid for participant B in participant C is selected to determine the probability that the labeled data from participant C is judged to be the labeled data of participant B (or having the data characteristics of the first participant B), and the corresponding data proportion in the process of training the model of participant B by the second sample data from participant C is obtained. Based on the data proportion of participant A and the data proportion of participant C, the model parameters that need to be aggregated and updated of the first participant can be jointly calculated. For example, the labeled data of participant A itself is multiplied by the data proportion of A to participant B, and the labeled data of participant C itself is multiplied by the data proportion of participant B. Then, the model parameters that need to be aggregated and updated of the first participant B, the model parameters that need to be aggregated and updated of the second participant A, and the model parameters that need to be aggregated and updated of the second participant C can be jointly calculated through the preset calculation formula, as shown in the following figure. Figure 4 , Figure 5 , Figure 6 shown.
[0082] The step of determining the data proportion of target data consistent with the data characteristics of the first party in the second sample data of each of the second participants includes:
[0083] Step S11, receiving the data ratio sent by each second participant, wherein each second participant inputs the corresponding second sample data into the corresponding preset field classification model, and then performs prediction processing on the second sample data to obtain the data ratio of the target data in the second sample data that is consistent with the data characteristics of the first participant;
[0084] Among them, the preset domain classification model is based on training sample data with preset participant source labels. By executing the first preset federal process and iteratively training the first preset prediction model to be trained, the first target model for predicting the proportion of data sources of each participant is obtained.
[0085] In this embodiment, the probability, i.e., the data proportion, of the labeled data from the second participant being determined to be the labeled data of the first participant (consistent with the data characteristics of the first participant) is determined by a preset domain classification model.
[0086] Overall, the preset domain classification model is obtained by horizontally federating the training data of the preset n participants, wherein the output layer in the preset domain classifier is processed by the preset Sigmoid activation function to output a vector of dimension n, and the output value of each dimension is in the range (0,1). The output value of the i-th dimension is used to represent the probability that the input data is trained by the i-th participant, that is, the data proportion.
[0087] In this embodiment, the preset domain classification model is already trained, that is, it is based on training sample data with preset participant source labels. By executing the first preset federal process, the first preset prediction model to be trained is iteratively trained to obtain a first target model for predicting the source ratio of data of each participant. Therefore, after each second participant inputs the corresponding second sample data into the corresponding preset domain classification model, the second sample data is predicted and processed to obtain the data ratio of the target data in the second sample data that is consistent with the data characteristics of the first participant.
[0088] Specifically, in this embodiment, based on the participant data with a preset participant source label, by executing the first preset federated process, the first preset prediction model to be trained is iteratively trained to obtain a first target model for predicting the proportion of participant data source data. For example, the first participant initiates a first federated learning task, and the first participant sends the first preset prediction model to be trained of the first federated learning task to each second participant. The first participant trains the first preset prediction model to be trained based on local training data to obtain the model parameters of the first participant after training. After obtaining the model parameters of the first participant after training, the first preset horizontal federated process is executed. , obtain the first joint model parameters (including some joint model parameters of other second participants), after obtaining the first joint model parameters, continue to perform the first horizontal federal process so that the first participant can obtain the second target joint model parameters, and continue to execute the first horizontal two-help process based on the second target joint model parameters, so as to finally obtain the first target model. In the process of obtaining the first target model, the implicit characteristics of the data of each participant are learned. Therefore, the preset Sigmoid activation function is set in the preset domain classification model, and the output value of the th dimension can be obtained and output to represent the probability or data proportion of the input data being the ith participant.
[0089] Specifically, for example, multiple second participants are participants A and participants C, and the first participant is participant B. Then for participant B, it is necessary to obtain the data ratio of the second sample data of participant A for training participant B's model through the preset domain classification model, and it is necessary to obtain the data ratio of the second sample data of participant C for training participant B's model through the preset domain classification model. For participant A, it is necessary to obtain the data ratio of the first sample data of participant B for training participant A's model through the preset domain classification model, and it is necessary to obtain the data ratio of the second sample data of participant C for training participant A's model through the preset domain classification model. For participant C, it is necessary to obtain the data ratio of the second sample data of participant A for training participant B's model through the preset domain classification model, and it is necessary to obtain the data ratio of the second sample data of participant C for training participant B's model through the preset domain classification model. That is, for each participant, all local labeled data are input into the preset domain classification model to obtain the output value Indicates that it comes from participant P i The labeled samples x i The probability that k is judged to be the participant’s labeled data.
[0090] Step S20, determining the first participant prediction weight of each second sample data based on the proportion of each data;
[0091] After obtaining the data proportion, i.e. probability, the participant P is calculated according to the following calculation formula in the preset field classification model. i The labeled samples x ik For training participants P j The corresponding prediction weight in the model process
[0092] Step S30, based on the prediction weight of the first participant and the first sample data of the first participant, determine the preset prediction model of the first participant through federated learning.
[0093] Based on the prediction weight of the first participant and the first sample data of the first participant, a preset prediction model of the first participant is determined through federated learning, specifically, through horizontal federated learning.
[0094] After the step of determining the preset prediction model of the first participant based on the prediction weight of the first participant and the first sample data of the first participant, the method further comprises:
[0095] Step S40, obtaining data to be processed, and inputting the data to be processed into the preset prediction model;
[0096] Step S50, performing prediction processing on the data to be processed based on the preset prediction model to obtain a target prediction result.
[0097] In this embodiment, after obtaining the preset prediction model, the data to be processed is obtained, and the data to be processed is input into the preset prediction model to obtain the target prediction result.
[0098] The present application determines the data proportion of target data consistent with the data characteristics of the first participant in the second sample data of each of the second participants; determines the first participant prediction weight of each second sample data based on each of the data proportions; and determines the preset prediction model of the first participant through federated learning based on the first participant prediction weight and the first sample data of the first participant. The present application determines the prediction weight of the first participant of each second sample data by determining the data proportion of target data consistent with the data characteristics of the first participant in the second sample data of each of the second participants, and federally determines the preset prediction model of the first participant. That is, the present application determines the prediction weight with actual effective training function for the first participant in the second sample data of each different distribution by adding the data proportion, and federally obtains the preset prediction model of the first participant. Compared with the prior art in which each participant has the same training proportion or prediction proportion, resulting in some invalid training data in the data of a certain participant occupying the training proportion or prediction proportion, the present application jointly trains the federal model based on the actual effective (occupying training proportion or prediction proportion) training data of each participant, thereby avoiding efficiency interference caused by invalid data and improving federal training efficiency. Since the training data is valid, the model accuracy of the federal model is improved to improve the prediction performance of the model.
[0099] The present application embodiment provides a data processing method. In another embodiment of the data processing method of the present application, refer to Figure 2 , the sample data of the first participant is the first sample data, and the step of determining the preset prediction model of the first participant through federated learning based on the prediction weight of the first participant and the first sample data of the first participant includes:
[0100] Step S31, based on the prediction weight of the first participant and the first sample data of the first participant, iteratively train the second preset prediction model to be trained by executing a second preset federated process to obtain a second target model;
[0101] Step S32: setting the second target model as the preset prediction model of the first participant.
[0102] It should be noted that, in this embodiment, based on the prediction weight of the first participant and the first sample data of the first participant, the middle party or a certain participant executes the second preset federal process to iteratively train the second preset prediction model to be trained to obtain the second target model, and the second target model is set as the preset prediction model of the first participant.
[0103] Specifically, in this embodiment, there is a coordinator, which communicates with the first participant and the second participant respectively. Before the federated model is trained, the coordinator may initiate a second federated learning task, and the coordinator sends the initial model of the second federated learning task (the second preset prediction model to be trained) to each participant. For the first participant, the first participant trains the initial model in the first participant based on the second preset prediction model to be trained and the local training data of the first participant to obtain the trained model parameters of the first participant. After obtaining the trained model parameters of the first participant, the second preset horizontal federated process is executed (wherein, each second participant trains the second preset prediction model to be trained based on the initial model and the target data of the prediction weight of the first participant obtained by each second participant to obtain the trained model parameters of each second participant). Specifically, based on the first joint model parameters obtained by the coordinator in conjunction with the trained model parameters (encrypted) of each second participant, the first participant continues to train and execute the second preset horizontal federated process until the preset end condition is reached to obtain the second target model.
[0104] Among them, the process of executing the first preset horizontal federal process can specifically be: iteratively training the second preset prediction model to be trained, judging whether the iteratively trained second preset prediction model to be trained meets the preset replacement and update conditions, such as whether it is iteratively trained 500 times; if the second preset prediction model to be trained meets the preset replacement and update conditions, then by executing the second preset horizontal federal process, the model variables of the trained and updated second preset prediction model to be trained are replaced and updated to obtain the replaced and updated second preset prediction model to be trained.
[0105] The model variables of the second preset prediction model to be trained that are updated during training are encrypted and sent to an intermediary party associated with the first participant to ensure security, so that the intermediary party can aggregate the model variables sent by multiple other first participants to obtain aggregated model variables, and encrypt the model variables and feed them back to each of the first participants. The first participant receives the aggregated model variables fed back by the intermediary party, and replaces and updates the model variables of the second preset prediction model to be trained that are updated during training with the aggregated model variables to obtain the replaced and updated second preset prediction model to be trained.
[0106] Continue to iteratively train and replace and update the second preset prediction model to be trained until the second preset prediction model to be trained meets the preset training completion condition, the preset training completion condition may be that the number of training times reaches a certain data, such as 10,000 times or 5,000 times, or the preset training completion condition may be that the corresponding loss function converges, so as to obtain the second target model.
[0107] In addition, in this embodiment, the first participant may initiate the second federated learning task, and the first participant sends the initial model of the second federated learning task to each second participant. The first participant trains the initial model in the first participant based on the local first sample data (wherein each second participant trains the initial model based on the initial model and the target data to obtain the trained model parameters of each second participant), and obtains the trained model parameters of the first participant. After obtaining the trained model parameters of the first participant, the first preset horizontal federated process is executed. Specifically, based on the first joint model parameters obtained by the first participant and the trained model parameters of each other second participant, the training is continued and the second preset horizontal federated process is executed until the preset end condition is reached to obtain the second target model.
[0108] In this embodiment, based on the prediction weight of the first participant and the first sample data of the first participant, the second preset federated process is executed to iteratively train the second preset prediction model to be trained to obtain a second target model; the second target model is set as the preset prediction model of the first participant. In this embodiment, the preset prediction model is accurately obtained.
[0109] The embodiment of the present application provides a data processing method. In another embodiment of the data processing method of the present application, the step of iteratively training a second preset prediction model to be trained based on the prediction weight of the first participant and the first sample data of the first participant by executing a second preset federated process to obtain a second target model includes:
[0110] Step B1, receiving the second model initial gradient sent by the second participant, wherein the second model initial gradient is determined by each second participant based on the corresponding second sample data during the execution of the second preset federated process;
[0111] Step B2, based on the initial gradient of the second model and the corresponding prediction weight of the first participant, obtaining the second model update gradient of each second participant;
[0112] Step B3, based on the second model update gradient and the first model update gradient determined by the first participant based on the first sample data in executing the second preset federated process, determining a replacement update model parameter;
[0113] Step B4: based on the replacement and update of the model parameters, iteratively update the model parameters in the second preset prediction model to be trained to obtain a second target model.
[0114] In this embodiment, the model parameters may be obtained through gradients. First, the second model initial gradient sent by the second participant is received, wherein the second model initial gradient is determined by each second participant based on the corresponding second sample data during the execution of the second preset federated process. After the second model initial gradient is obtained, the second model update gradient of each second participant is obtained based on the second model initial gradient and the corresponding first participant prediction weight. Specifically, the superscript lb means labeling. Each participant updates all local labeled data (second sample data) Input the domain classification model θ and obtain the output value
[0115] Indicates that it comes from participant P i The labeled samples x i k is judged to be participant P j Annotated datasets The probability of the participant's labeled sample x is calculated according to the following calculation formula in the domain classification model. ik For training participants P j The corresponding weight in the model process That is, the prediction weight of the first participant, where N is the total amount of labeled data of all participants, Nj is the amount of labeled training data of Pj. After obtaining the prediction weight of the first participant, multiply it by the corresponding second model update gradient to obtain the second model update gradient.
[0116] Based on the second model update gradient and the first model update gradient determined by the first participant based on the first sample data in the execution of the second preset federal process, the replacement update model parameters are determined, and based on the replacement update model parameters, the model parameters in the second preset prediction model to be trained are iteratively updated, such as iteratively updated 500 times, to obtain a second target model.
[0117] The first participant is connected to the second participant through a preset intermediary communication connection;
[0118] The step of iteratively training the second preset prediction model to be trained based on the prediction weight of the first participant and the first sample data of the first participant to obtain the second target model by executing a second preset federated process includes:
[0119] Step C1, in executing the second preset federated process, determining a first model update gradient based on the first sample data, and sending the first model update gradient to a preset intermediary;
[0120] Step C2, receiving the initial gradient of the second model sent by the preset intermediary, corresponding to the predicted weight of the first participant and the updated gradient of the first model, and determining the replacement updated model parameters;
[0121] The second participant determines the initial gradient of the second model based on the second sample data, and encrypts the initial gradient of the second model and sends it to the preset intermediary;
[0122] Step C3, based on the replacement and update of the model parameters, iteratively update the model parameters in the second preset prediction model to be trained to obtain a second target model.
[0123] In this embodiment, the first participant and the second participant may aggregate gradients through an intermediary to determine the replacement and update model parameters, so as to finally obtain the target model.
[0124] The step of receiving the information sent by the preset intermediary based on the initial gradient of the second model, corresponding to the prediction weight of the first participant and the updated gradient of the first model, and determining the replacement and update model parameters includes:
[0125] Step D1, receiving the replacement update model parameters determined based on the initial gradient of the second model, corresponding to the predicted weight of the first participant and the updated gradient of the first model, which is encrypted and sent by a preset intermediary.
[0126] In this embodiment, the first participant and the second participant may aggregate the gradients through an intermediary, and after the aggregation, the intermediary encrypts the feedback replacement update model parameters to improve the security in the horizontal federation process.
[0127] In this embodiment, by receiving the second model initial gradient sent by the second participant, wherein the second model initial gradient is determined by each second participant based on the corresponding second sample data during the execution of the second preset federated process; based on the second model initial gradient and the corresponding first participant prediction weight, the second model update gradient of each second participant is obtained; based on the second model update gradient and the first model update gradient determined by the first participant based on the first sample data during the execution of the second preset federated process, the replacement update model parameter is determined; based on the replacement update model parameter, the model parameters in the second preset prediction model to be trained are iteratively updated to obtain the second target model. In this embodiment, the second target model is accurately obtained.
[0128] Reference Figure 3 , Figure 3 It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment of the present application.
[0129] like Figure 3As shown, the data processing device may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002. The communication bus 1002 is used to realize the connection and communication between the processor 1001 and the memory 1005. The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. The memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0130] Optionally, the data processing device may also include a rectangular user interface, a network interface, a camera, an RF (Radio Frequency) circuit, a sensor, an audio circuit, a WiFi module, etc. The rectangular user interface may include a display screen (Display), an input submodule such as a keyboard (Keyboard), and the optional rectangular user interface may also include a standard wired interface and a wireless interface. The network interface may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0131] Those skilled in the art will understand that Figure 3 The data processing device structure shown in the figure does not constitute a limitation of the data processing device, and may include more or less components than shown in the figure, or combine some components, or arrange the components differently.
[0132] like Figure 3 As shown, the memory 1005 as a computer medium may include an operating system, a network communication module and a data processing program. The operating system is a program that manages and controls the hardware and software resources of the data processing device, and supports the operation of the data processing program and other software and / or programs. The network communication module is used to realize the communication between the components inside the memory 1005, and the communication with other hardware and software in the data processing system.
[0133] exist Figure 3 In the data processing device shown, the processor 1001 is used to execute the data processing program stored in the memory 1005 to implement the steps of any of the above-mentioned data processing methods.
[0134] The specific implementation of the data processing device of the present application is basically the same as the various embodiments of the above-mentioned data processing method, and will not be repeated here.
[0135] The present application also provides a data processing device, applied to a first participant, the first participant is connected to a second participant for communication, there are multiple second participants, and the data processing device includes:
[0136] A first determination module is used to determine the data proportion of target data consistent with the data characteristics of the first party in the second sample data of each of the second participants;
[0137] A second determination module is used to determine the first participant prediction weight of each second sample data based on the proportion of each data;
[0138] The third determination module is used to determine the preset prediction model of the first participant through federated learning based on the prediction weight of the first participant and the first sample data of the first participant.
[0139] Optionally, the first determining module includes:
[0140] A receiving unit, configured to receive a data ratio sent by each second participant, wherein each second participant inputs the corresponding second sample data into a corresponding preset domain classification model, and then performs prediction processing on the second sample data to obtain a data ratio of target data in the second sample data that is consistent with the data features of the first participant;
[0141] Among them, the preset domain classification model is based on training sample data with preset participant source labels. By executing the first preset federal process and iteratively training the first preset prediction model to be trained, the first target model for predicting the proportion of data sources of each participant is obtained.
[0142] Optionally, the sample data in the first participant is first sample data, and the third determination module includes:
[0143] A first execution unit is configured to iteratively train a second preset prediction model to be trained based on the prediction weight of the first participant and the first sample data of the first participant by executing a second preset federated process to obtain a second target model;
[0144] A setting unit is used to set the second target model as a preset prediction model of the first participant.
[0145] Optionally, the first execution unit includes:
[0146] A first receiving subunit is configured to receive a second model initial gradient sent by a second participant, wherein the second model initial gradient is determined by each second participant based on corresponding second sample data during execution of a second preset federated process;
[0147] An acquisition subunit, configured to acquire a second model update gradient of each second participant based on the initial gradient of the second model and the corresponding prediction weight of the first participant;
[0148] a determination subunit, configured to determine a replacement update model parameter based on the second model update gradient, and the first participant, in executing the second preset federated process, determining the first model update gradient determined based on the first sample data;
[0149] The first updating subunit is used to iteratively update the model parameters in the second preset prediction model to be trained based on the replacement updating model parameters to obtain a second target model.
[0150] Optionally, the first participant and the second participant are connected in communication via a preset intermediary;
[0151] The first execution unit further includes:
[0152] a sending subunit, configured to determine a first model update gradient based on the first sample data during execution of a second preset federated process, and send the first model update gradient to a preset intermediary;
[0153] A second receiving subunit is used to receive a replacement update model parameter determined by a preset intermediary based on the initial gradient of the second model and the first model update gradient corresponding to the predicted weight of the first participant;
[0154] The second participant determines the initial gradient of the second model based on the second sample data, and encrypts the initial gradient of the second model and sends it to the preset intermediary;
[0155] The second updating subunit is used to iteratively update the model parameters in the second preset prediction model to be trained based on the replacement update model parameters to obtain a second target model.
[0156] Optionally, the second receiving subunit is used to implement:
[0157] Receive the replacement update model parameters determined based on the initial gradient of the second model, corresponding to the predicted weight of the first participant and the updated gradient of the first model, sent encrypted by a preset intermediary.
[0158] Optionally, the data processing device further includes:
[0159] A first acquisition module, used for acquiring data to be processed, and inputting the data to be processed into the preset prediction model;
[0160] The second acquisition module is used to perform prediction processing on the data to be processed based on the preset prediction model to obtain a target prediction result.
[0161] The specific implementation of the data processing device of the present application is basically the same as the various embodiments of the above-mentioned data processing method, and will not be repeated here.
[0162] An embodiment of the present application provides a medium, and the medium stores one or more programs, and the one or more programs can also be executed by one or more processors to implement the steps of any of the above-mentioned data processing methods.
[0163] The specific implementation of the medium of the present application is basically the same as the embodiments of the above-mentioned data processing method, and will not be repeated here.
[0164] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent processing scope of the present application.
Claims
1. A user classification method, It is characterized in that Applied to a first participant, the first participant is in communication connection with a second participant, there are multiple second participants, the first participant and the second participant include at least a hospital, a nursing home and a physical examination center, the user classification method includes: Determine the data proportion of target data having the same data characteristics as the first party in the second sample data of each of the second participants, wherein the second sample data is labeled second participant data, and the target data is data determined to belong to the first participant in the labeled second participant data; Determine the first participant prediction weight of each second sample data based on the proportion of each data; Determining a preset prediction model of the first participant through federated learning based on the prediction weight of the first participant and first sample data of the first participant, wherein the first sample data is labeled data of the first participant, and data edge distributions of the first participant data and the second participant data are different; Acquire data to be processed, and input the data to be processed into the preset prediction model, wherein the data to be processed at least includes the user's age, weight, blood sugar content, and insulin level data; The data to be processed is predicted based on the preset prediction model to obtain a target prediction result, and the target prediction result is used to characterize the user category.
2. The user classification method according to claim 1, It is characterized in that The step of determining the data proportion of target data consistent with the data characteristics of the first party in the second sample data of each of the second participants includes: Receiving the data ratio sent by each second participant, wherein each second participant inputs the corresponding second sample data into the corresponding preset field classification model, and then performs prediction processing on the second sample data to obtain the data ratio of the target data in the second sample data that is consistent with the data characteristics of the first participant; Among them, the preset domain classification model is based on training sample data with preset participant source labels. By executing the first preset federal process and iteratively training the first preset prediction model to be trained, the first target model for predicting the proportion of data sources of each participant is obtained.
3. The user classification method according to claim 1, It is characterized in that The sample data of the first participant is the first sample data, and the step of determining the preset prediction model of the first participant through federated learning based on the prediction weight of the first participant and the first sample data of the first participant includes: Based on the prediction weight of the first participant and the first sample data of the first participant, iteratively train the second preset prediction model to be trained by executing a second preset federated process to obtain a second target model; The second target model is set as the preset prediction model of the first participant.
4. The user classification method according to claim 3, It is characterized in that The step of iteratively training the second preset prediction model to be trained based on the prediction weight of the first participant and the first sample data of the first participant to obtain the second target model by executing a second preset federated process includes: Receiving a second model initial gradient sent by a second participant, wherein the second model initial gradient is determined by each second participant based on corresponding second sample data during execution of a second preset federated process; Based on the initial gradient of the second model and the corresponding prediction weight of the first participant, obtaining the second model update gradient of each second participant; Based on the second model update gradient and the first model update gradient determined by the first participant based on the first sample data in executing the second preset federated process, determining a replacement update model parameter; Based on the replacement and updating of the model parameters, the model parameters in the second preset prediction model to be trained are iteratively updated to obtain a second target model.
5. The user classification method according to claim 4, It is characterized in that The first participant is connected to the second participant through a preset intermediary communication connection; The step of iteratively training the second preset prediction model to be trained based on the prediction weight of the first participant and the first sample data of the first participant to obtain the second target model by executing a second preset federated process includes: In executing the second preset federated process, determining a first model update gradient based on the first sample data, and sending the first model update gradient to a preset intermediary; Receiving a replacement updated model parameter determined by a preset intermediary based on an initial gradient of the second model, corresponding to the predicted weight of the first participant and the updated gradient of the first model; The second participant determines the initial gradient of the second model based on the second sample data, and encrypts the initial gradient of the second model and sends it to the preset intermediary; Based on the replacement and updating of the model parameters, the model parameters in the second preset prediction model to be trained are iteratively updated to obtain a second target model.
6. The user classification method according to claim 5, It is characterized in that The step of receiving the information sent by the preset intermediary based on the initial gradient of the second model, corresponding to the prediction weight of the first participant and the updated gradient of the first model, and determining the replacement and update model parameters includes: Receive the replacement update model parameters determined based on the initial gradient of the second model, corresponding to the predicted weight of the first participant and the updated gradient of the first model, sent encrypted by a preset intermediary.
7. A user classification device, It is characterized in that Applied to a first participant, the first participant is in communication connection with a second participant, there are multiple second participants, the first participant and the second participant include at least a hospital, a nursing home and a physical examination center, and the user classification includes: A first determination module is used to determine a data ratio of target data consistent with the data characteristics of the first participant in the second sample data of each of the second participants, wherein the second sample data is labeled second participant data, and the target data is data determined to belong to the first participant in the labeled second participant data; A second determination module is used to determine the first participant prediction weight of each second sample data based on the proportion of each data; A third determination module is used to determine a preset prediction model of the first participant through federated learning based on the prediction weight of the first participant and first sample data of the first participant, wherein the first sample data is labeled first participant data, and the data edge distribution of the first participant data and the second participant data is different; A first acquisition module is used to acquire data to be processed and input the data to be processed into the preset prediction model, wherein the data to be processed at least includes the user's age, weight, blood sugar content, and insulin level data; The second acquisition module is used to perform prediction processing on the data to be processed based on the preset prediction model to obtain a target prediction result, and the target prediction result is used to characterize the user category.
8. A user classification device, It is characterized in that The user classification device comprises: a memory, a processor, and a program stored in the memory for implementing the user classification method. The memory is used to store a program for implementing the user classification method; The processor is used to execute a program for implementing the user classification method, so as to implement the steps of the user classification method according to any one of claims 1 to 6.
9. A medium, It is characterized in that The medium stores a program for implementing the user classification method, and the program for implementing the user classification method is executed by a processor to implement the steps of the user classification method according to any one of claims 1 to 6.
