Data processing method and device, equipment and storage medium

By introducing sample data extraction rules from horizontal federated learning into federated learning, it is ensured that each client terminal obtains sample data based on the same rules, thus solving the problem of data participation determination and improving the accuracy of model training.

CN114492825BActive Publication Date: 2026-04-10WEBANK (CHINA)
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
WEBANK (CHINA)
Filing Date
2020-11-11
Publication Date
2026-04-10

AI Technical Summary

Technical Problem

In federated learning, determining the data participation of each party to improve model training accuracy is a pressing issue that needs to be addressed.

Method used

By introducing sample data extraction rules from horizontal federated learning, each client terminal can obtain sample data from the local dataset based on the same rules, ensuring that each terminal is aware of the sample data extraction of other terminals and achieving mutual collaboration.

Benefits of technology

It improved the accuracy of model training and enhanced the model training effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114492825B_ABST
    Figure CN114492825B_ABST
Patent Text Reader

Abstract

The application discloses a data processing method and device, equipment and a storage medium. The method comprises the following steps: a client terminal acquires a data processing instruction, the data processing instruction is used for instructing the client terminal to extract sample data participating in horizontal federated learning, and then the client terminal acquires a plurality of target sample data for horizontal federated learning from a local sample data set according to a sample data extraction rule participating in horizontal federated learning. The plurality of target sample data are used for horizontal federated learning. When each client terminal participating in the horizontal federated learning acquires the target sample data, the same sample extraction rule is referred to, so that each client terminal is aware of the sample data extracted by other client terminals for model training, which is equivalent to the effect that each client terminal is mutually cooperative. Therefore, the effect of model training can be improved, and the accuracy of model training is further improved.
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 particularly relates to a data processing method and device, equipment and a storage medium. BACKGROUND

[0002] With the development of computer technology and the popularity of big data application, useful information can be mined from big data through machine learning, so machine learning algorithms have been widely applied in various technical fields. Machine learning can fuse the characteristics of a large amount of data, learn from experience through training data, and train a corresponding model. In practical applications, data often contains user privacy information, and according to some data supervision laws and regulations, user data cannot be directly collected, so under the architecture of federated learning, the corresponding model is trained by using machine learning on encrypted data.

[0003] In federated learning, data from multiple parties is generally required to participate together to improve the accuracy of model training, but how to determine the participation of data from each party in federated learning is a problem to be solved. SUMMARY

[0004] The main purpose of the present application is to provide a data processing method, device, equipment and storage medium, which aims to enable each client terminal to obtain target sample data for horizontal federated learning in cooperation with each other.

[0005] To achieve the above purpose, the present application provides a data processing method, which comprises:

[0006] The client terminal obtains a data processing instruction, which is used to instruct the client terminal to extract sample data participating in horizontal federated learning;

[0007] The client terminal obtains a plurality of target sample data from a local sample data set according to a sample data extraction rule participating in the horizontal federated learning, the plurality of target sample data being used for horizontal federated learning, and the sample data extraction rule of the client terminal being the same as the sample extraction rule of other client terminals participating in the horizontal federated learning.

[0008] In a possible implementation, the data processing instruction includes the sample data extraction rule participating in the horizontal federated learning;

[0009] Before the client terminal extracts a plurality of target sample data from a local sample data set according to the sample data extraction rule participating in the horizontal federated learning, the method further comprises:

[0010] The client terminal determines the sample data extraction rule according to the data processing instruction.

[0011] In a possible implementation, the sample data extraction rule is used to indicate that target sample data is extracted for a plurality of different value ranges of a target feature respectively, and the client terminal extracts a plurality of target sample data from the local sample data set according to the sample data extraction rule participating in the horizontal federated learning, including:

[0012] The client terminal determines, for each value range, a sample data subset in which the value of the target feature belongs to the value range from the sample data set according to the value of the target feature in each sample data in the local sample data set, and obtains at least one intermediate sample data from the sample data subset;

[0013] The client terminal determines the at least one intermediate sample data obtained for each value range as the plurality of target sample data.

[0014] In a possible implementation, the sample data extraction rule further includes a sampling proportion corresponding to each value range, and the client terminal obtains at least one intermediate sample data from the sample data subset, including:

[0015] The client terminal obtains at least one intermediate sample data from the sample data subset according to the sampling proportion corresponding to the value range;

[0016] The ratio of the number of intermediate sample data to the total number of sample data in the sample data subset is equal to the sampling proportion.

[0017] In a possible implementation, the sample data extraction rule further includes a sampling number corresponding to each value range, and the client terminal obtains at least one intermediate sample data from the sample data subset, including:

[0018] The client terminal obtains the at least one intermediate sample data from the sample data subset according to the sampling number corresponding to the value range;

[0019] The number of intermediate sample data is equal to the sampling number.

[0020] In a possible implementation, the sample data extraction rule includes a sampling proportion, and the sample data extraction rule is used to indicate that the sampling proportion of sample data is extracted from the local sample data set;

[0021] The client terminal obtains a plurality of target sample data from the local sample data set according to the sample data extraction rule participating in the horizontal federated learning, including:

[0022] The client terminal extracts the multiple pieces of target sample data from the local sample data set according to a sampling ratio, where a ratio of a number of the target sample data to a total number of sample data in the sample data set is equal to the sampling ratio.

[0023] In a possible implementation, the sample data extraction rule includes a sampling number, and the sample data extraction rule is used to instruct to extract the sampling number of sample data from the local sample data set.

[0024] The client terminal obtains the multiple pieces of target sample data from the local sample data set according to a sample data extraction rule for participating in the federated learning, and the method comprises the following steps of:

[0025] The client terminal extracts the multiple pieces of target sample data from the local sample data set according to the sampling number, where a number of the target sample data is equal to the sampling number.

[0026] In a possible implementation, after the client terminal obtains the multiple pieces of target sample data from the local sample data set according to the sample data extraction rule for participating in the federated learning, the method further comprises the following steps of:

[0027] The client terminal performs federated learning model training according to the multiple pieces of target sample data.

[0028] In a second aspect, the present application further provides a data processing apparatus, comprising:

[0029] An obtaining module is configured to obtain a data processing instruction, where the data processing instruction is used to instruct a client terminal to extract sample data for participating in federated learning.

[0030] A processing module is configured to obtain multiple pieces of target sample data from a local sample data set according to a sample data extraction rule for participating in the federated learning, where the multiple pieces of target sample data are used for federated learning, and a sample data extraction rule of the client terminal is the same as a sample extraction rule of another client terminal participating in the federated learning.

[0031] In a possible implementation, the data processing instruction includes the sample data extraction rule for participating in the federated learning.

[0032] The apparatus further comprises:

[0033] A determining module is configured to determine the sample data extraction rule according to the data processing instruction before the processing module extracts the multiple pieces of target sample data from the local sample data set according to the sample data extraction rule for participating in the federated learning.

[0034] In a possible implementation, the sample data extraction rule is configured to indicate that target sample data is extracted for each of a plurality of different value ranges of the target feature respectively.

[0035] The processing module is specifically configured to:

[0036] For each value range, a sample data subset in which the value of the target feature belongs to the value range is determined from the local sample data set according to the value of the target feature in each sample data in the local sample data set, and at least one intermediate sample data is obtained from the sample data subset.

[0037] The at least one intermediate sample data obtained for each value range is determined as the plurality of target sample data.

[0038] In a possible implementation, the sample data extraction rule further includes a sampling proportion corresponding to each value range.

[0039] The processing module is specifically configured to: obtain at least one intermediate sample data from the sample data subset according to the sampling proportion corresponding to the value range.

[0040] The ratio of the number of the intermediate sample data to the total number of sample data in the sample data subset is equal to the sampling proportion.

[0041] In a possible implementation, the sample data extraction rule further includes a sampling number corresponding to each value range.

[0042] The processing module is specifically configured to: obtain the at least one intermediate sample data from the sample data subset according to the sampling number corresponding to the value range.

[0043] The number of the intermediate sample data is equal to the sampling number.

[0044] In a possible implementation, the sample data extraction rule includes a sampling proportion, and the sample data extraction rule is configured to indicate that the sampling proportion of sample data is extracted from the local sample data set.

[0045] The processing module is specifically configured to: extract the plurality of target sample data from the local sample data set according to the sampling proportion, and the ratio of the number of the target sample data to the total number of sample data in the sample data set is equal to the sampling proportion.

[0046] In a possible implementation, the sample data extraction rule includes a sampling number, and the sample data extraction rule is configured to indicate that the sampling number of sample data is extracted from the local sample data set.

[0047] The processing module is specifically configured to: extract the multiple copies of target sample data from the local sample data set according to the sampling copies, wherein the number of copies of the target sample data is equal to the sampling copies.

[0048] In a possible implementation, the apparatus further includes:

[0049] The training module is configured to perform horizontal federated learning model training according to the multiple copies of target sample data after the processing module obtains the multiple copies of target sample data from the local sample data set according to the sample data extraction rule for participating in the horizontal federated learning.

[0050] In a third aspect, the present application also provides a data processing device, which includes a memory, a processor, and a data processing program stored in the memory and executable on the processor, and the data processing program, when executed by the processor, implements the steps of the data processing method according to any one of the preceding aspects.

[0051] In a fourth aspect, the present application also provides a computer-readable storage medium, which stores a data processing program, and the data processing program, when executed by a processor, implements the steps of the data processing method according to any one of the preceding aspects.

[0052] In a fifth aspect, the present application provides a computer program product containing instructions, which, when executed on a computer, cause the computer to perform the steps of the data processing method according to any one of the preceding aspects.

[0053] The data processing method, apparatus, device, and storage medium provided by the present application can obtain a data processing instruction by a client terminal, the data processing instruction is used to instruct the client terminal to extract sample data for participating in horizontal federated learning, and then the client terminal obtains multiple copies of target sample data for horizontal federated learning from a local sample data set according to a sample data extraction rule for participating in horizontal federated learning. The multiple copies of target sample data are used for horizontal federated learning. When each client terminal participating in the horizontal federated learning obtains the target sample data, the same sample extraction rule is referred to, so that each client terminal participating in the horizontal federated learning can obtain the target sample data based on the same sample extraction rule, and each client terminal can perceive the sample data extracted by other client terminals for model training, which is equivalent to the effect of mutual coordination of each client terminal. Therefore, the effect of model training can be improved, and the accuracy of model training can be further improved. BRIEF DESCRIPTION OF DRAWINGS

[0054] Figure 1 A principle diagram of federated learning provided by an embodiment of the present application;

[0055] Figure 2A flowchart of a data processing method provided by an embodiment of the present application is shown in FIG. 1.

[0056] Figure 3 A flowchart of a data processing method provided by another embodiment of the present application is shown in FIG. 2.

[0057] Figure 4 A schematic diagram of a data processing method provided by an embodiment of the present application is shown in FIG. 3.

[0058] Figure 5 Another schematic diagram of a data processing method provided by an embodiment of the present application is shown in FIG. 4.

[0059] Figure 6 A structural schematic diagram of a data processing apparatus provided by an embodiment of the present application is shown in FIG. 5.

[0060] Figure 7 A structural schematic diagram of a data processing apparatus provided by an embodiment of the present application is shown in FIG. 6.

[0061] The implementation, functional features and advantages of the present application will be further described with reference to the embodiments and the accompanying drawings. DETAILED DESCRIPTION

[0062] Exemplary embodiments of the present disclosure will be described more fully hereinafter with reference to the accompanying drawings; however, they are not limited to the embodiments set forth herein but can be implemented in various forms. The present embodiments are provided so that this disclosure will be thorough, and will fully convey the scope of the disclosure to those skilled in the art.

[0063] In many fields, technologies such as machine learning and model training based on big data are constantly developing. Through mining of big data, a lot of valuable information can be obtained. With the development of technology, the sources of raw data are becoming more and more extensive, and even cross-domain joint may occur.

[0064] In some business scenarios, multiple business platforms collect respective business data. These business data are very valuable and are usually saved as private information of the business platforms. The business platforms do not expect to share the business data in raw form with other business platforms. However, in some needs, multiple business platforms expect to perform collaborative computing without disclosing the business data of each party, so as to improve the business processing capability. Based on this, federated machine learning and other methods have emerged.

[0065] Federated machine learning (Federated Machine Learning), also known as federated learning (Federated Learning), can jointly use data and collaboratively model by each party without data leaving the local, and has gradually become a commonly used method in privacy protection computing.

[0066] In the process of federated learning, the privacy data of the participants can be protected through parameter exchange under an encryption mechanism. The data itself is not transmitted, and the participants do not need to expose the data they have to other participants, nor can they infer the data of other participants. Therefore, federated learning can well protect user privacy and ensure data security, and can solve the problem of data silos.

[0067] Federated learning can be divided into horizontal federated learning, vertical federated learning and federated transfer learning for different data sets.

[0068] The horizontal federated learning can be applied to a scenario in which the user features of different data sets overlap more and the users overlap less. For example, one is a bank in A place, and the other is a bank in B place. The two banks are in different places and have less user overlap, but the data of the two banks involves user spending behavior, asset data, etc. At this time, the horizontal federated learning can be used to realize data collaborative calculation between the two banks.

[0069] There are many machine learning algorithms that can be used in federated learning, including but not limited to neural networks, random forests, etc.

[0070] Figure 1 A principle diagram of federated learning is provided for the embodiments of the present application. As shown in the figure, the server can participate in the federated learning process with k client terminals. Different client terminals have different sample data sets, and the common training of the model can be realized on the basis of protecting privacy. Figure 1

[0071] In the horizontal federated learning process, the server issues a corresponding model to each client terminal. Then, each client terminal trains the model using the sample data in the local sample data set to obtain a trained model, and uploads the trained local model to the server. After receiving the model uploaded by each client terminal, the server aggregates the models to obtain an updated global model, and the above process is repeated until the aggregated global model converges.

[0072] Suppose that the current iteration is the tth round, and the execution steps of the algorithm are as follows:

[0073] Step 1, the server sends the current global model M t to each client terminal C i .

[0074] ​Optionally, in order to ensure the security of data, the client terminal and the server can encrypt the interactive data during the interaction.

[0075] Step 2, the client terminal C i The current global model M t is updated to the local model That is

[0076] Step 3, the client terminal C i performs local training using its own local training sample, and the local model of the client terminal C i is updated from to The model parameters of are uploaded to the server.

[0077] Step 4, the server receives the model parameters uploaded by all client terminals The global model is aggregated and calculated.

[0078] Specifically, the global model after aggregation can be calculated by the following formula.

[0079]

[0080] In the formula, n represents the total number of client terminals, pi is the weight of the client terminal C i , is the model reported by the client terminal C i , and M t+1 is the global model after aggregation.

[0081] After the global model is aggregated, steps 1 to 4 are repeatedly executed until the model converges. There are many methods to determine whether the model converges. One method is to determine that the model is in a convergent state when the number of iterations reaches a certain value. Another method is to determine whether the model converges according to the prediction result of the model, for example, if the accuracy of the model obtained by adjacent two or more iterations differs by less than a certain threshold, it is considered that the model converges.

[0082] Based on the above method, each client terminal has its own sample data set, and the local model is trained using the local sample data set, which can complete the training of the model while ensuring that the data does not leave the local.

[0083] In practical applications, federated learning can be used to train various models.

[0084] In an example, the model can be a risk prediction model, and correspondingly, the training samples in the embodiments of the present application can be asset data of a user, such as deposit time, deposit amount, loan time, loan amount, bad account record, etc. Through the above method, the training of the risk prediction model can be realized, and the global model obtained can be used for risk prediction. Optionally, when using the model, the asset data of a user to be predicted can be input into the model to obtain a corresponding risk prediction result, such as whether the probability of overdue is high or low, and the result can be displayed to a staff member, or the loan limit for the user can be adjusted according to the result, thereby effectively helping the staff member to predict the risk level of the user, reducing the artificial burden, and improving the efficiency and accuracy of prediction.

[0085] In another example, the model can be a natural language recognition model, and correspondingly, the training samples in the embodiments of the present application can be corpus data. Through the above method, the training of the natural language recognition model can be realized, and the global model obtained can be used for natural language recognition. Optionally, the model can be used for recognition of various sentences, for example, it can be used for recognition of whether a complaint sentence appears. In use, the speech input by a user is input into the natural language recognition model, so as to determine whether a complaint sentence appears. Through the natural language recognition model, complaint sentences in a large amount of corpus data can be recognized, and user identification, time, context, etc. information associated with the complaint sentences can be output to a human for further processing, so as to effectively realize the screening of complaint information and improve the efficiency and accuracy of processing.

[0086] Since different client terminals have different local sample data sets, for example, the client terminal 1 is a client terminal of a bank in A place, the sample data in the sample data set stored by the client terminal 1 is data of a user group in A place, and the client terminal 2 is a client terminal of a bank in B place, the sample data in the sample data set stored by the client terminal 2 is data of a user group in B place. Since A place and B place are different regions, the intersection of the user groups in the two regions is small, and the client terminal 1 and the client terminal 2 are both client terminals of banks, so the businesses are similar, and the user features recorded by each client terminal are the same. Therefore, the sample data set of the client terminal 1 and the sample data set of the client terminal 2 have more overlapping user features and less overlapping users. Therefore, the sample data sets of the client terminal 1 and the client terminal 2 can be divided according to the horizontal direction (i.e. the user dimension), and sample data with the same user features and not completely the same users is taken out for model training, so as to obtain a horizontal federated learning model.

[0087] In the training process of the model, the client terminal 1 and the client terminal 2 cannot directly obtain the sample data in the sample data set from each other, and generally, the client terminal 1 uses the sample data in the local sample data set for model training, and the client terminal 2 uses the sample data in the local sample data set for model training. The client terminal 1 and the client terminal 2 have no awareness of the sample data used for model training by each other, which affects the effect of model training.

[0088] Among them, the above-mentioned client terminal can be a server or a computer and the like in specific device implementation.

[0089] Therefore, the data processing method, device and storage medium provided by the embodiment of the application can introduce the sample data extraction rule of horizontal federated learning, and each client terminal participating in the same horizontal federated learning can obtain the sample data used for horizontal federated learning from the local sample data set based on the same sample data extraction rule, so as to ensure that each client terminal extracts sample data based on the same rule, so that each client terminal has awareness of the sample data extracted by other client terminals for model training, thereby improving the effect of model training and further improving the accuracy of model training.

[0090] Figure 2 The flowchart of the data processing method provided by an embodiment of the application is shown in Figure 2 The method of the embodiment can be applied to a client terminal, which can be any client terminal as shown in Figure 1 The following will be described by taking a client terminal as an example, and other client terminals are similar. The method of the embodiment can include the following steps.

[0091] In S201, the client terminal obtains a data processing instruction, and the data processing instruction is used to instruct the client terminal to extract sample data participating in horizontal federated learning.

[0092] In the embodiment, the client terminal obtains a data processing instruction, and the data processing instruction is used to instruct the client terminal to extract sample data participating in horizontal federated learning.

[0093] The client terminal can also obtain the above-mentioned data processing instruction according to the operation of the user on the client terminal. For example, the user performs a sampling operation on the client terminal, and accordingly, the client terminal obtains the above-mentioned data processing instruction according to the sampling operation of the user. The client terminal obtains a federated code for sampling according to the data processing instruction, and runs the federated code to execute the following steps. The federated code can be obtained by compiling a sampling code by a federated compiler, and the sampling code can be obtained by writing a phthon code.

[0094] S202. The client terminal obtains multiple target sample data from the local sample dataset according to the sample data extraction rules for participating in horizontal federated learning. These multiple target sample data are used for horizontal federated learning.

[0095] After receiving the data processing instructions, the client terminal needs to retrieve sample data for horizontal federated learning from its local sample dataset. This local dataset contains multiple sets of sample data. Therefore, the client terminal retrieves multiple target sample data sets from its local dataset according to the sample data extraction rules for horizontal federated learning. These target sample data sets are used for horizontal federated learning. The client terminal's sample data extraction rules are the same as those of other client terminals participating in horizontal federated learning. This means that all client terminals participating in the same horizontal federated learning process refer to the same sample extraction rules when retrieving target sample data.

[0096] The data processing method provided in this embodiment obtains data processing instructions through a client terminal. These instructions instruct the client terminal to extract sample data for horizontal federated learning. Then, the client terminal obtains multiple target sample data sets for horizontal federated learning from its local sample dataset according to the sample data extraction rules for horizontal federated learning. These multiple target sample data sets are used for horizontal federated learning. Each client terminal participating in this horizontal federated learning obtains target sample data based on the same sample extraction rules, thus ensuring that each client terminal participating in the horizontal federated learning obtains target sample data based on the same sample extraction rules. This allows each client terminal to be aware of the sample data extracted by other client terminals for model training, which is equivalent to a collaborative effect among the client terminals. Therefore, it can improve the model training effect and further enhance the accuracy of model training.

[0097] In one alternative embodiment, in Figure 2 Based on the embodiment shown, the sample data extraction rules for participating in the above-mentioned horizontal federated learning are pre-set in the client terminal.

[0098] In another alternative embodiment, in Figure 2On the basis of the embodiments shown above, the data processing instruction includes a sample data extraction rule for participating in the horizontal federated learning. The server can send the data processing instruction to each client terminal, and correspondingly, the client terminal receives the data processing instruction sent by the server, and the data processing instruction includes the sample data extraction rule for participating in the horizontal federated learning. Then, before the client terminal executes S202, the client terminal also determines the sample data extraction rule according to the data processing instruction. Then, the client terminal acquires the multiple target sample data from the local sample data set according to the determined sample data extraction rule. Since the sample data extraction rule is included in the data processing instruction and is issued to each client terminal by the server, the specific sample data extraction rule can be determined by the server, and it can also be ensured that the sample data extraction rules of each client terminal are the same sample data extraction rule.

[0099] On the basis of any of the above embodiments, Figure 3 The flowchart of the data processing method provided for another embodiment of the present application is shown in the figure Figure 3 The method of the present embodiment can include:

[0100] S301, the client terminal acquires a data processing instruction, and the data processing instruction is used to instruct the client terminal to extract sample data for participating in horizontal federated learning.

[0101] The specific implementation process of S301 in the present embodiment can be referred to the related description in the above embodiments, which will not be described here again.

[0102] Among them, the sample data in the sample data set includes multiple features. In one implementation manner, target sample data can be extracted for a target feature in the multiple features. The target feature can be the age of a sample user, or the gender, or the credit label, or the asset, etc. Specifically, the sample data extraction rule in the present embodiment is used to instruct to extract target sample data for multiple different value ranges of the target feature. Correspondingly, one possible implementation manner of the above S202 can include the following S302 and S303.

[0103] S302, the client terminal acquires at least one intermediate sample data from the sample data subset according to the value of the target feature in each sample data in the local sample data set for each value range, and determines the sample data subset in which the value of the target feature belongs to the value range from the sample data set.

[0104] In the present embodiment, the value of the target feature can be divided into multiple different value ranges. Taking the age of the target feature as an example, the multiple different value ranges can be 21-30 years old, 31-40 years old, 41-50 years old, 51-60 years old, and 61-70 years old.

[0105] The client terminal determines, from the local sample data set, a sample data subset in which the value of the target feature belongs to each value range according to the value of the target feature in each sample data in the local sample data set. Each sample data subset includes one or more sample data. In a possible implementation, there can be no sample data in the sample data set in which the value of the target feature belongs to a value range. For example, as shown in Figure 4 the client terminal determines, from the local sample data set, a sample data subset in which the age of the user is 21-30 years old, determines, from the local sample data set, a sample data subset in which the age of the user is 31-40 years old, determines, from the local sample data set, a sample data subset in which the age of the user is 41-50 years old, determines, from the local sample data set, a sample data subset in which the age of the user is 51-60 years old, and determines, from the local sample data set, a sample data subset in which the age of the user is 61-70 years old.

[0106] After obtaining the sample data subsets in which the value of the target feature belongs to each value range, the client terminal obtains at least one intermediate sample data from each sample data subset in which the value of the target feature belongs to each value range. The number of intermediate sample data obtained from different sample data subsets can be the same or different. For example, as shown in Figure 4 the client terminal obtains at least one intermediate sample data from the sample data subset in which the age of the user is 21-30 years old, obtains at least one intermediate sample data from the sample data subset in which the age of the user is 31-40 years old, obtains at least one intermediate sample data from the sample data subset in which the age of the user is 41-50 years old, obtains at least one intermediate sample data from the sample data subset in which the age of the user is 51-60 years old, and obtains at least one intermediate sample data from the sample data subset in which the age of the user is 61-70 years old.

[0107] S303, the client terminal determines, as the plurality of target sample data, at least one intermediate sample data obtained for each value range, and the plurality of target sample data are used for horizontal federated learning.

[0108] In this embodiment, after the client terminal obtains at least one intermediate sample data from the sample data subset in which the value of the target feature belongs to each value range, the client terminal determines these intermediate sample data as the plurality of target sample data.

[0109] For example, as shown in Figure 4As shown, the client terminal obtains at least one intermediate sample data from the sample data subset of users aged 21-30 years old, the sample data subset of users aged 31-40 years old, the sample data subset of users aged 41-50 years old, the sample data subset of users aged 51-60 years old, and the sample data subset of users aged 61-70 years old, respectively, as the target sample data, thereby obtaining multiple target sample data.

[0110] The data processing method provided in this embodiment is used for instructing to extract target sample data for multiple different value ranges of a target feature, and therefore, the client terminal determines, from the sample data set, a sample data subset in which the value of the target feature belongs to each value range according to the value of the target feature in each sample data in the sample data set, and then obtains at least one intermediate sample data from each sample data subset to obtain target sample data. Through the method of this embodiment, each client terminal obtains target sample data from the local sample data set based on the same target feature, and obtains target sample data from the local sample data set according to different value ranges of the target feature, which guarantees that sample data in which the target feature is in each different value range can be used for model training. Moreover, it is also guaranteed that each client terminal obtains target sample data as much as possible by aligning samples through the target feature, and therefore, the effect of model training can be improved, and the accuracy of model training is further improved.

[0111] In an example embodiment, the sample data extraction rule further includes a sampling ratio corresponding to each value range. Accordingly, one possible implementation of obtaining at least one intermediate sample data from the sample data subset in S302 is that the client terminal obtains at least one intermediate sample data from the sample data subset according to the sampling ratio corresponding to the value range, and the ratio of the number of intermediate sample data to the total number of sample data in the sample data subset is equal to the sampling ratio.

[0112] The sampling ratio corresponding to each value range can be the same or not completely the same. One sampling ratio value can be set for all value ranges, which indicates that the sampling ratio corresponding to each value range is the same. Alternatively, one sampling ratio value can be set for each value range.

[0113] Hereinafter, taking the case that the sampling ratio corresponding to each value range is not completely the same as an example, reference is made to FIG. 4. Figure 4In the illustrated example, the client terminal obtains 40% of the sample data in the sample data subset of users aged 21-30 years as intermediate sample data, 60% of the sample data in the sample data subset of users aged 31-40 years as intermediate sample data, 80% of the sample data in the sample data subset of users aged 41-50 years as intermediate sample data, 60% of the sample data in the sample data subset of users aged 51-60 years as intermediate sample data, and 40% of the sample data in the sample data subset of users aged 61-70 years as intermediate sample data.

[0114] The client terminal then determines the intermediate sample data obtained from each sample data subset in the above-described respective sampling proportions as target sample data.

[0115] Therefore, the sampling proportions can be set according to the characteristics of different value ranges, and the client terminal obtains intermediate sample data from the corresponding sample data subset according to the corresponding sampling proportion for each value range. Therefore, sample data corresponding to the share of the value range is obtained for different value ranges, which can not only ensure the share of the sample data used for horizontal federated learning as a whole, but also ensure that sample data with a corresponding proportion in each value range participates in horizontal federated learning, and the sampling proportion of sample data participating in horizontal federated learning in the same value range is the same for each client terminal. Therefore, the effect of model training can be improved, and the accuracy of model training can be further improved.

[0116] In an optional example, if the sampling proportion corresponding to the value range is greater than 1, then one implementation of the client terminal obtaining at least one intermediate sample data from the sample data subset according to the sampling proportion corresponding to the value range is that the client terminal obtains sample data in all sample data subsets as intermediate sample data, and repeatedly obtains at least one sample data in the sample data subset as intermediate sample data. For example, the sampling proportion corresponding to the sample data subset of users aged 31-40 years is 2.5, all sample data in the sample data subset is determined as intermediate sample data, and all sample data in the sample data subset is also determined as intermediate sample data by being copied once, and 50% of the sample data in the sample data subset is also determined as intermediate sample data by being copied once again, thereby obtaining 2.5 times the sample data in the sample data subset. Since the intermediate sample data obtained in this embodiment includes repeated sample data, the gain of some sample data can be increased to improve the effect of model training and improve the accuracy of model training.

[0117] In another example embodiment, the above-mentioned sample data extraction rules also include the number of sampling portions corresponding to each value range. Accordingly, one possible implementation of obtaining at least one intermediate sample data from the sample data subset in S302 is as follows: the client terminal obtains at least one intermediate sample data from the sample data subset according to the number of sampling portions corresponding to the value range, wherein the number of intermediate sample data portions is equal to the number of sampling portions.

[0118] The number of samples for each value range can be the same or different. You can set a single sample size for all value ranges, meaning the number of samples for each range is the same. Alternatively, you can set a separate sample size for each value range.

[0119] The following example illustrates that the number of samples corresponding to different value ranges is not entirely the same. Figure 4 In the example shown, the client terminal obtains 1000 sample data points as intermediate sample data from the sample data subset of users aged 21-30, 2000 sample data points as intermediate sample data from the sample data subset of users aged 31-40, 4000 sample data points as intermediate sample data from the sample data subset of users aged 41-50, 2000 sample data points as intermediate sample data from the sample data subset of users aged 51-60, and 1000 sample data points as intermediate sample data from the sample data subset of users aged 61-70.

[0120] Then, the client terminal will determine the target sample data as the intermediate sample data obtained from the corresponding number of samples from each of the above sample data subsets.

[0121] Therefore, sampling ratios can be set according to the characteristics of different value ranges. Client terminals obtain intermediate sample data from the corresponding subsets of sample data for each value range according to the appropriate sampling ratio. Thus, obtaining a corresponding share of sample data for each value range ensures both the overall number of samples used for horizontal federated learning and that each value range has a corresponding number of samples participating in horizontal federated learning. Furthermore, each client terminal samples the same number of samples for the same value range participating in horizontal federated learning. Therefore, this improves the model training effect and further enhances the accuracy of model training.

[0122] In an optional example, if the value range corresponds to a sampling fraction greater than the total sample fraction of the sample data subset corresponding to the value range, the client terminal obtains at least one intermediate sample data from the sample data subset according to the sampling fraction corresponding to the value range. One implementation manner is that the client terminal obtains all sample data in the sample data subset as intermediate sample data, and repeatedly obtains at least one sample data in the sample data subset as intermediate sample data. For example, the sample data subset of the user's age in the range of 31-40 years old corresponds to a sampling fraction of 4000, and the sample data subset of the user's age in the range of 31-40 years old includes 3000 sample data. All sample data in the sample data subset is determined as intermediate sample data, and 1000 sample data in the sample data subset is also determined as intermediate sample data, thereby obtaining 4000 sample data. Since the intermediate sample data obtained in this embodiment includes repeated sample data, the gain of some sample data can be increased to improve the effect of model training and improve the accuracy of model training.

[0123] In another example embodiment, the sample data extraction rule described above further includes a sampling proportion corresponding to some value ranges and a sampling fraction corresponding to other value ranges. For the sample data subset of some value ranges, the client terminal obtains a sampling proportion of sample data therefrom, and for the sample data subset of other value ranges, the client terminal obtains a sampling fraction of sample data therefrom. Thus, the flexibility and diversity of the client terminal in obtaining sample data for different value ranges are realized.

[0124] In other embodiments, in Figure 2 On the basis of the embodiments and related embodiments shown in the drawings, the sample data extraction rule described above includes a sampling proportion, and the sample data extraction rule is used to indicate that the sampling proportion of sample data is extracted from the local sample data set. One possible implementation manner of S202 can include that the client terminal extracts a plurality of target sample data from the local sample data set according to the sampling proportion, wherein the ratio of the number of target sample data to the total number of sample data in the sample data set is equal to the sampling proportion.

[0125] In this embodiment, the sampling proportion can be less than 1, or can be equal to 1, or can be greater than 1. For example, Figure 5 As shown in the drawing, taking the sampling proportion of 80% as an example, the client terminal extracts 80% of the sample data in the local sample data set as target sample data. If the sampling proportion is greater than 1, the specific implementation process can be referred to the description of the sampling proportion greater than 1 in the related embodiments described above, which will not be described here.

[0126] Therefore, the target sample data obtained by the client terminals participating in the horizontal federated learning is consistent in the proportion of the respective local sample data set, so as to improve the model training effect.

[0127] In some embodiments, the sample data extraction rule comprises a sampling fraction, and the sample data extraction rule is used to instruct to extract the sampling fraction of sample data from the local sample data set. Figure 2 Based on the embodiments and related embodiments shown above, the sample data extraction rule comprises a sampling fraction, and the sample data extraction rule is used to instruct to extract the sampling fraction of sample data from the local sample data set.

[0128] Another possible implementation of the above S202 can include that the client terminal extracts a plurality of target sample data from the local sample data set according to the sampling fraction, wherein the number of the target sample data is equal to the sampling fraction.

[0129] In this embodiment, the sampling fraction can be less than, equal to, or greater than the total number of sample data in the local sample data set. Taking the sampling fraction of 6000 as an example, as shown in the figure, the client terminal extracts 6000 sample data from the local sample data set as target sample data. Figure 5 If the sampling fraction is greater than the total number of sample data in the local sample data set, the specific implementation process can refer to the description in the related embodiments above, which will not be repeated here.

[0130] Therefore, the number of target sample data obtained by the client terminals participating in the horizontal federated learning is consistent, so as to improve the model training effect.

[0131] In an example embodiment, based on any of the above embodiments, after the client terminal obtains the plurality of target sample data, the client terminal further performs horizontal federated learning model training according to the plurality of target sample data to obtain a trained model. The specific training process can refer to the description of the training process in the related Figure 1 embodiments, which will not be repeated here.

[0132] In addition, it should be noted that the execution order of the steps in the embodiments of the present application is not limited to the order defined by the above serial numbers, and those skilled in the art can perform any configuration according to specific application requirements and design requirements.

[0133] Next, taking a plurality of client terminals as client terminals of banks in different regions as an example, the plurality of client terminals include, for example, client terminals of a bank in A and client terminals of a bank in B.

[0134] The client terminal of the bank in A obtains a data processing instruction, and the data processing instruction is used to instruct to extract bank data participating in horizontal federated learning. The data set locally of the bank in A includes bank data of a user group in A, and the bank data includes name, age, credit label, asset and other characteristic data. The client terminal of the bank in A extracts bank data of a plurality of users from the data set locally of the bank in A as a plurality of target sample bank data according to a sample data extraction rule participating in horizontal federated learning. The client terminal of the bank in A performs horizontal federated learning model training according to the plurality of target sample bank data obtained.

[0135] The client terminal of the bank in B also obtains a data processing instruction, and the data processing instruction is used to instruct to extract bank data participating in horizontal federated learning. The data set locally of the bank in B includes bank data of a user group in B, and the bank data includes name, age, credit label, asset and other characteristic data. The client terminal of the bank in B also extracts bank data of a plurality of users from the data set locally of the bank in B as a plurality of target sample bank data according to a sample data extraction rule participating in horizontal federated learning. The client terminal of the bank in B performs horizontal federated learning model training according to the plurality of target sample bank data obtained.

[0136] The sample data extraction rule in the client terminal of the bank in A is the same as that in the client terminal of the bank in B.

[0137] The specific implementation process of the client terminal of the bank in A and the client terminal of the bank in B extracting bank data of a plurality of users from the respective local data sets as a plurality of target sample bank data according to the sample data extraction rule participating in horizontal federated learning can be referred to the related description in any of the above embodiments, which will not be described here.

[0138] Therefore, the client terminals of the banks in different places extract sample bank data for horizontal federated learning according to the same sample data extraction rule, so that each bank is aware of the bank data extracted by other banks for model training, which is equivalent to the effect of mutual cooperation between banks in different places. Therefore, the effect of model training can be improved, and the accuracy of model training can be further improved.

[0139] Figure 6 A structural schematic diagram of a data processing apparatus provided by an embodiment of the present application is shown in FIG. 6. Figure 6 As shown in FIG. 6, the data processing apparatus can include an obtaining module 601 and a processing module 602.

[0140] The obtaining module 601 is configured to obtain a data processing instruction, and the data processing instruction is used to instruct the client terminal to extract sample data participating in horizontal federated learning.

[0141] The processing module 602 is configured to acquire, according to a sample data extraction rule for participating in the horizontal federated learning, a plurality of target sample data from a local sample data set, the plurality of target sample data being used for the horizontal federated learning, and the sample data extraction rule used by the client terminal being the same as a sample extraction rule used by other client terminals participating in the horizontal federated learning.

[0142] In a possible implementation, the data processing instruction includes the sample data extraction rule for participating in the horizontal federated learning. The data processing apparatus in this embodiment further includes a determination module 603.

[0143] The determination module 603 is configured to determine, according to the data processing instruction, the sample data extraction rule before the processing module 602 acquires, according to the sample data extraction rule for participating in the horizontal federated learning, the plurality of target sample data from the local sample data set.

[0144] In a possible implementation, the sample data extraction rule is used to indicate that the target sample data is extracted for a plurality of different value ranges of a target feature respectively. The processing module 602 is specifically configured to:

[0145] For each value range, determine, according to values of the target feature in each sample data in the local sample data set, a sample data subset in which values of the target feature belong to the value range, from the sample data set, and acquire at least one intermediate sample data from the sample data subset;

[0146] Determine the at least one intermediate sample data acquired for each value range as the plurality of target sample data.

[0147] In a possible implementation, the sample data extraction rule further includes a sampling proportion corresponding to each value range. The processing module 602 is specifically configured to acquire, according to the sampling proportion corresponding to the value range, the at least one intermediate sample data from the sample data subset.

[0148] The ratio of the number of the intermediate sample data to the total number of sample data in the sample data subset is equal to the sampling proportion.

[0149] In a possible implementation, the sample data extraction rule further includes a sampling number corresponding to each value range. The processing module 602 is specifically configured to acquire, according to the sampling number of the value range, the at least one intermediate sample data from the sample data subset. The number of the intermediate sample data is equal to the sampling number.

[0150] In a possible implementation, the sample data extraction rule includes a sampling proportion, and the sample data extraction rule is used to indicate that the sampling proportion of sample data is extracted from the local sample data set. The processing module 602 is specifically configured to extract the multiple pieces of target sample data from the local sample data set according to the sampling proportion, where a ratio of the number of pieces of the target sample data to a total number of pieces of sample data in the sample data set is equal to the sampling proportion.

[0151] In a possible implementation, the sample data extraction rule includes a sampling proportion, and the sample data extraction rule is used to indicate that the sampling proportion of sample data is extracted from the local sample data set. The processing module 602 is specifically configured to extract the multiple pieces of target sample data from the local sample data set according to the sampling proportion, where a ratio of the number of pieces of the target sample data to a total number of pieces of sample data in the sample data set is equal to the sampling proportion.

[0152] In a possible implementation, the data processing apparatus of the embodiment further includes a training module 604.

[0153] The training module 604 is configured to perform horizontal federated learning model training according to the multiple pieces of target sample data after the processing module 602 obtains the multiple pieces of target sample data from the local sample data set according to the sample data extraction rule participating in the horizontal federated learning.

[0154] The data processing apparatus provided by any of the foregoing embodiments is used to execute the technical solutions of any of the foregoing method embodiments, and has similar implementation principles and technical effects, which will not be described here again.

[0155] Figure 7 A structural schematic diagram of a data processing device provided by an embodiment of the present application is shown in FIG. 7. Figure 7 As shown in FIG. 7, the device can include a memory 701, a processor 702, and a data processing program stored in the memory 701 and executable on the processor 702, where the memory 701 and the processor 702 are connected through a communication bus. The data processing program is executed by the processor 702 to implement the steps of the data processing method according to any of the foregoing embodiments.

[0156] Optionally, the memory 701 can be independent or integrated with the processor 702.

[0157] The implementation principles and technical effects of the device provided by the embodiment can be referred to the foregoing embodiments, which will not be described here again.

[0158] The embodiment of the present application further provides a computer readable storage medium, wherein the computer readable storage medium stores a data processing program, and the data processing program is executed by a processor to implement the steps of the data processing method according to any one of the foregoing embodiments.

[0159] In several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other manners. For example, the embodiments of the device described above are merely schematic. For example, the division of the modules is merely a logical function division. There can be another division manner for the actual implementation. For example, a plurality of modules or features can be combined or integrated into another system, or some features can be ignored or not executed.

[0160] The integrated modules with the form of software functional modules above can be stored in a computer readable storage medium. The software functional modules stored in the storage medium can include a plurality of instructions for causing a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor to perform some steps of the methods described in the embodiments of the present application.

[0161] It should be understood that the processor above can be a central processing unit (CPU), and can also be other general-purpose processors, digital signal processors (DSP), application specific integrated circuits (ASIC), etc. The general-purpose processor can be a microprocessor, or the processor can also be any conventional processor. The steps of the methods disclosed in the present application can be directly embodied as the execution of the hardware processor, or the combination of the hardware and software modules in the processor.

[0162] The memory can include a high-speed RAM memory, and can also include a non-volatile storage NVM, for example, at least one disk memory, and can also be a U disk, a mobile hard disk, a read-only memory, a magnetic disk or an optical disk, etc.

[0163] The storage medium above can be implemented by any type of volatile or non-volatile storage device or their combination, such as a static random access memory (SRAM), an electrically erasable programmable read-only memory (EEPROM), a programmable read-only memory (EPROM), a programmable read-only memory (PROM), a read-only memory (ROM), a magnetic memory, a flash memory, a magnetic disk or an optical disk. The storage medium can be any available medium that can be accessed by a general-purpose or special-purpose computer.

[0164] An example storage medium is coupled to the processor such that the processor can read information from, and can write information to, the storage medium. Of course, the storage medium can be a part of the processor. Consistent with the teachings provided herein, the processor can execute instructions embodied by the storage medium, and the storage medium can store instructions that, when executed by the processor, cause the processor to perform operations, methods, and processes as described herein.

[0165] It should be noted that, in the present document, the terms "comprises", "comprising", or any other variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but can also include other elements not expressly listed or inherent to such process, method, article, or apparatus. An element proceeded by "comprises... a" does not, without more constraints, exclude the existence of additional identical elements in the process, method, article, or apparatus that comprises the element.

[0166] The above-mentioned sequence numbers of the embodiments of the present application are only for description, and do not represent advantages or disadvantages of the embodiments.

[0167] Those skilled in the art can clearly understand the above-mentioned embodiment methods by means of software and necessary general hardware platforms, of course, they can also be implemented by hardware, but in many cases, the former is a better implementation. Based on such understanding, the technical solutions of the present application can be embodied in the form of a software product, which is stored in a storage medium (such as a ROM / RAM, a magnetic disk, or an optical disk), and includes a plurality of instructions for causing a terminal device (which can be a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the methods described in the various embodiments of the present application.

[0168] The above are only preferred embodiments of the present application, and do not limit the patent scope of the present application, and any equivalent structure or equivalent process transformation, or direct or indirect application in other related technical fields, are also included in the patent protection scope of the present application.

Claims

1. A data processing method, characterized by, The method comprises the following steps: The client terminal obtains a data processing instruction, wherein the data processing instruction is used to instruct the client terminal to extract sample data participating in horizontal federated learning; The client terminal obtains a plurality of target sample data from a local sample data set according to a sample data extraction rule participating in the horizontal federated learning, wherein the plurality of target sample data is used for horizontal federated learning, and the sample data extraction rule of the client terminal is the same as the sample data extraction rule of other client terminals participating in the horizontal federated learning; The client terminal performs horizontal federated learning model training according to the plurality of target sample data.

2. The method of claim 1, wherein, The data processing instruction comprises the sample data extraction rule participating in the horizontal federated learning; Before the client terminal extracts the plurality of target sample data from the local sample data set according to the sample data extraction rule participating in the horizontal federated learning, the method further comprises the following steps: The client terminal determines the sample data extraction rule according to the data processing instruction.

3. The method according to claim 1 or 2, characterized in that, The sample data extraction rule is used to instruct to extract target sample data for a plurality of different value ranges of a target feature respectively, and the client terminal extracts the plurality of target sample data from the local sample data set according to the sample data extraction rule participating in the horizontal federated learning, comprising the following steps: The client terminal extracts at least one intermediate sample data from the sample data subset according to the value of the target feature in each sample data in the local sample data set for each value range, wherein the value of the target feature belongs to the sample data subset of the value range, and the at least one intermediate sample data is obtained from the sample data subset; The client terminal determines the at least one intermediate sample data obtained for each value range as the plurality of target sample data.

4. The method of claim 3, wherein, The sample data extraction rule further comprises a sampling proportion corresponding to each value range, and the client terminal extracts at least one intermediate sample data from the sample data subset, comprising the following steps: The client terminal extracts at least one intermediate sample data from the sample data subset according to the sampling proportion corresponding to the value range; The ratio of the number of intermediate sample data to the total number of sample data in the sample data subset is equal to the sampling proportion.

5. The method of claim 3, wherein, The sample data extraction rule further comprises a sampling number corresponding to each value range, and the client terminal extracts at least one intermediate sample data from the sample data subset, comprising the following steps: The client terminal extracts the at least one intermediate sample data from the sample data subset according to the sampling number of the value range; The number of intermediate sample data is equal to the sampling number.

6. The method of claim 1 or 2, wherein, The sample data extraction rule comprises a sampling proportion, and the sample data extraction rule is used to instruct to extract the sampling proportion of sample data from the local sample data set; The client terminal extracts the plurality of target sample data from the local sample data set according to the sample data extraction rule participating in the horizontal federated learning, comprising the following steps: The client terminal extracts the multiple pieces of target sample data from the local sample data set according to the sampling ratio, where a ratio of the number of pieces of target sample data to the total number of pieces of sample data in the sample data set is equal to the sampling ratio.

7. The method according to claim 1 or 2, characterized in that, The sample data extraction rule includes a sampling number of pieces, and is used to instruct to extract the sampling number of pieces of sample data from the local sample data set; The client terminal acquires the multiple pieces of target sample data from the local sample data set according to a sample data extraction rule for participating in the horizontal federated learning, including: The client terminal extracts the multiple pieces of target sample data from the local sample data set according to the sampling number of pieces, where the number of pieces of target sample data is equal to the sampling number of pieces.

8. A data processing apparatus, characterized by, Including: An acquisition module is configured to acquire a data processing instruction, where the data processing instruction is used to instruct a client terminal to extract sample data for participating in horizontal federated learning; A processing module is configured to acquire multiple pieces of target sample data from a local sample data set according to a sample data extraction rule for participating in the horizontal federated learning, where the multiple pieces of target sample data are used for horizontal federated learning, and a sample data extraction rule of the client terminal is the same as a sample data extraction rule of another client terminal participating in the horizontal federated learning; The client terminal performs horizontal federated learning model training according to the multiple pieces of target sample data.

9. A data processing device, characterized by The data processing device includes a memory, a processor, and a data processing program stored on the memory and executable on the processor, and the data processing program, when executed by the processor, implements the steps of the data processing method in any one of claims 1-7.

10. A computer-readable storage medium, characterized in that, The computer readable storage medium stores a data processing program, and the data processing program, when executed by the processor, implements the steps of the data processing method in any one of claims 1-7.

Citation Information

Patent Citations

  • Federated learning training method based on model dispersion

    CN111860581A