Data processing method, device and equipment for cross-sample federated learning
By using global statistical value sets in cross-sample federated learning for sample data preprocessing, the problem of low federated learning efficiency caused by different sample distributions of each participant is solved, and effective federated learning and model training between multiple participants is achieved.
Patent Information
- Application Number
- CN202210191299.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-02-28
- Publication Date
- 2025-04-04
- Estimated Expiration
- 2042-02-28
AI Technical Summary
In the cross-sample federated learning scenario, the sample distribution of each participant is different, making it difficult to achieve effective federated learning among multiple participants.
Through the statistical value set based on local data sent by each participant, the server calculates the global statistical value set and feeds it back to each participant. Each participant performs preprocessing of sample data based on the global statistical value set to realize numerical processing of data and model training.
Data preprocessing in cross-sample federated learning scenarios is realized, ensuring effective federated learning among multiple participants, and the quality of sample data is improved through numerical processing and promoting the training effect of federated models.
Smart Images

Figure CN114548310B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the technical field of federated learning, and in particular to a data processing method, apparatus and device for cross-sample federated learning. Background Art
[0002] Federated learning refers to a machine learning framework that can effectively help multiple participants (which can represent individuals or institutions) jointly train models while meeting the requirements of data privacy protection. Usually, each participant will update the parameters of the federated model based on the global parameters fed back by the server, but this process usually refers to the model training phase. Before the model training phase, each participant usually needs to process their local data so that the local data meets the preset standards, and the de-characterized local data can be applied to the model training phase. However, in the cross-sample federated learning scenario, the sample distributions of each participant are different, and federated learning among multiple participants cannot be better achieved based on different sample distributions. Therefore, how to implement data preprocessing in the cross-sample federated learning scenario so that federated learning among multiple participants can be performed has become an urgent problem that needs to be solved. Summary of the invention
[0003] The purpose of the embodiments of the present disclosure is to provide a data processing method for cross-sample federated learning, a data processing device for cross-sample federated learning, a computer-readable medium and an electronic device. In a cross-sample federated learning scenario, the local data of each participant corresponds to the same field but the specific content contained in the local data of each participant is different. The server federation can be triggered to calculate a global statistical value set based on the statistical value set based on the local data sent by each participant. Then, each participant can implement preprocessing of the sample data based on the global statistical value set, thereby realizing a data preprocessing solution combined with federated learning, so as to facilitate federated learning among multiple participants.
[0004] A first aspect of an embodiment of the present disclosure provides a data processing method applied to cross-sample federated learning, including:
[0005] Determine reference data from the original data according to a preset ratio, and sample the reference data to obtain sample data;
[0006] If the sample data includes non-numeric data, a statistical value set corresponding to the sample data is generated; wherein the statistical value set includes a statistical value corresponding to at least one field;
[0007] Encrypting the statistical values in the statistical value set, and sending the encrypted statistical value set to the server;
[0008] Generate a global statistical value set according to the encrypted statistical value set sent by each participant and feed back the global statistical value set to each participant;
[0009] The global statistical value set is decrypted and the sample data is numerically processed according to the decrypted global statistical value set, and the model training is performed according to the processed sample data.
[0010] In an exemplary embodiment of the present disclosure, generating a set of statistical values corresponding to sample data includes:
[0011] Determine the total sample data volume corresponding to the sample data;
[0012] Determine the sub-data corresponding to the same field in each sample data, and obtain the sub-data set corresponding to each field;
[0013] Calculate the statistical value corresponding to each sub-dataset;
[0014] The statistical value set of the sample data is determined based on the statistical value of each sub-data set and the total sample data volume.
[0015] In an exemplary embodiment of the present disclosure, the statistical value of the sub-data set includes at least one of the amount of first-type sub-data, the amount of second-type sub-data, a mean, and a mode.
[0016] In an exemplary embodiment of the present disclosure, decrypting a global statistical value set and performing numerical processing on sample data according to the decrypted global statistical value set includes:
[0017] Determine the proportion of the first type of sub-data and the proportion of the second type of sub-data in the sub-data set;
[0018] The sub-data sets are numerically processed according to the proportion of the first type of sub-data and the proportion of the second type of sub-data.
[0019] In an exemplary embodiment of the present disclosure, numerical processing is performed on the sub-data set according to the proportion of the first type of sub-data and the proportion of the second type of sub-data, including:
[0020] If it is detected that the sum of the proportion of the first type of sub-data and the proportion of the second type of sub-data is less than a preset ratio threshold, the sub-data set is deleted;
[0021] If it is detected that the proportion of the first type of sub-data is greater than or equal to the proportion of the second type of sub-data, converting the second type of sub-data in the sub-data set into first numerical data based on the global statistical value set;
[0022] If it is detected that the proportion of the first type of sub-data is less than that of the second type of sub-data, the first type of sub-data in the sub-data set is converted into non-numeric data based on the global statistical value set, and the non-numeric data and the second type of sub-data in the sub-data set are uniformly converted into first numerical data.
[0023] In an exemplary embodiment of the present disclosure, sampling reference data to obtain sample data includes:
[0024] The reference data is sampled by a preset sampling method to obtain sample data; wherein the preset sampling method includes upsampling, downsampling or stratified sampling.
[0025] In an exemplary embodiment of the present disclosure, the method further includes:
[0026] Determine the validation set data from the original data, and validate the trained model based on the validation set data to obtain the validation results and output them.
[0027] A second aspect of an embodiment of the present disclosure provides a data processing device applied to cross-sample federated learning, including:
[0028] A data selection unit, used to determine reference data from the original data according to a preset ratio, and to sample the reference data to obtain sample data;
[0029] A data statistics unit, configured to generate a statistical value set corresponding to the sample data if the sample data contains non-numeric data; wherein the statistical value set includes a statistical value corresponding to at least one field;
[0030] A data federation unit, used for encrypting the statistical values in the statistical value set and sending the encrypted statistical value set to the server;
[0031] A data generation unit, used to generate a global statistical value set according to the encrypted statistical value set sent by each participant and feed back the global statistical value set to each participant;
[0032] The data application unit is used to decrypt the global statistical value set and perform numerical processing on the sample data according to the decrypted global statistical value set, and perform model training according to the processed sample data.
[0033] In an exemplary embodiment of the present disclosure, the data statistics unit generates a statistical value set corresponding to the sample data, including:
[0034] Determine the total sample data volume corresponding to the sample data;
[0035] Determine the sub-data corresponding to the same field in each sample data, and obtain the sub-data set corresponding to each field;
[0036] Calculate the statistical value corresponding to each sub-dataset;
[0037] The statistical value set of the sample data is determined based on the statistical value of each sub-data set and the total sample data volume.
[0038] In an exemplary embodiment of the present disclosure, the statistical value of the sub-data set includes at least one of the amount of first-type sub-data, the amount of second-type sub-data, a mean, and a mode.
[0039] In an exemplary embodiment of the present disclosure, the data application unit decrypts the global statistical value set and performs numerical processing on the sample data according to the decrypted global statistical value set, including:
[0040] Determine the proportion of the first type of sub-data and the proportion of the second type of sub-data in the sub-data set;
[0041] The sub-data sets are numerically processed according to the proportion of the first type of sub-data and the proportion of the second type of sub-data.
[0042] In an exemplary embodiment of the present disclosure, the data application unit performs numerical processing on the sub-data set according to the proportion of the first type of sub-data and the proportion of the second type of sub-data, including:
[0043] If it is detected that the sum of the proportion of the first type of sub-data and the proportion of the second type of sub-data is less than a preset ratio threshold, the sub-data set is deleted;
[0044] If it is detected that the proportion of the first type of sub-data is greater than or equal to the proportion of the second type of sub-data, converting the second type of sub-data in the sub-data set into first numerical data based on the global statistical value set;
[0045] If it is detected that the proportion of the first type of sub-data is less than that of the second type of sub-data, the first type of sub-data in the sub-data set is converted into non-numeric data based on the global statistical value set, and the non-numeric data and the second type of sub-data in the sub-data set are uniformly converted into first numerical data.
[0046] In an exemplary embodiment of the present disclosure, the data selection unit samples the reference data to obtain the sample data, including:
[0047] The reference data is sampled by a preset sampling method to obtain sample data; wherein the preset sampling method includes upsampling, downsampling or stratified sampling.
[0048] In an exemplary embodiment of the present disclosure, the data selection unit is also used to determine the verification set data from the original data, and verify the trained model according to the verification set data to obtain and output the verification result.
[0049] A third aspect of the embodiments of the present disclosure provides a sample data processing system applied to cross-sample federated learning, the system comprising a server and multiple participants, the original data of the multiple participants correspond to the same field set, and the original data of the multiple participants correspond to different data contents, wherein:
[0050] Participants, used to determine reference data from original data according to a preset ratio, and sample the reference data to obtain sample data;
[0051] The participant is further configured to generate a statistical value set corresponding to the sample data if the sample data contains non-numeric data; wherein the statistical value set includes a statistical value corresponding to at least one field;
[0052] The participant is also used to encrypt the statistical value in the statistical value set and send the encrypted statistical value set to the server;
[0053] The server is used to generate a global statistical value set according to the encrypted statistical value set sent by each participant and feed back the global statistical value set to each participant;
[0054] The participant is also used to decrypt the global statistical value set and digitize the sample data according to the decrypted global statistical value set, and perform model training according to the processed sample data.
[0055] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable medium is provided, on which a computer program is stored. When the program is executed by a processor, the data processing method applied to cross-sample federated learning as described in the first aspect of the above embodiment is implemented.
[0056] According to a fifth aspect of an embodiment of the present disclosure, an electronic device is provided, comprising: one or more processors; a storage device for storing one or more programs, which, when the one or more programs are executed by the one or more processors, enables the one or more processors to implement the data processing method applied to cross-sample federated learning as described in the first aspect of the above embodiment.
[0057] According to a sixth aspect of the present application, a computer program product or a computer program is provided, the computer program product or the computer program comprising computer instructions, the computer instructions being stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, so that the computer device executes the methods provided in the above-mentioned various optional implementations.
[0058] The technical solution provided by the embodiments of the present disclosure may have the following beneficial effects:
[0059] In the technical solutions provided by some embodiments of the present disclosure, reference data can be determined from the original data according to a preset ratio, and the reference data can be sampled to obtain sample data; if the sample data contains non-numerical data, a statistical value set corresponding to the sample data is generated; wherein the statistical value set includes statistical values corresponding to at least one field; the statistical values in the statistical value set are encrypted, and the encrypted statistical value set is sent to the server; a global statistical value set is generated according to the encrypted statistical value set sent by each participant and the global statistical value set is fed back to each participant; the global statistical value set is decrypted and the sample data is numerically processed according to the decrypted global statistical value set, and model training is performed according to the processed sample data. In implementing the embodiments of the present disclosure, on the one hand, in a cross-sample federated learning scenario, based on the local data of each participant corresponding to the same field but the specific content of the local data of each participant is different, the server can be triggered to calculate the global statistical value set based on the statistical value set based on the local data sent by each participant, and then each participant can implement preprocessing of the sample data based on the global statistical value set, thereby realizing a data preprocessing solution combined with federated learning, so that federated learning can be performed between multiple participants. On the other hand, by digitizing non-numeric data, sample data can be de-characterized, which is conducive to further training of the federated model.
[0060] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0061] The accompanying drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. Obviously, the accompanying drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other accompanying drawings can be obtained based on these accompanying drawings without creative work.
[0062] Figure 1 A schematic diagram schematically shows an exemplary system architecture of a data processing method and device for cross-sample federated learning to which an embodiment of the present disclosure can be applied;
[0063] Figure 2 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present disclosure is shown;
[0064] Figure 3 A flowchart of a data processing method applied to cross-sample federated learning according to an embodiment of the present disclosure is schematically shown;
[0065] Figure 4A flowchart of a data processing method applied to cross-sample federated learning according to another embodiment of the present disclosure is schematically shown;
[0066] Figure 5 A sequence diagram schematically illustrates a data processing system applied to cross-sample federated learning according to an embodiment of the present disclosure;
[0067] Figure 6 The structural block diagram of a data processing device applied to cross-sample federated learning according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0068] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in a variety of forms and should not be construed as being limited to the examples set forth herein; on the contrary, these embodiments are provided so that the present disclosure will be more comprehensive and complete, and the concepts of the example embodiments are fully conveyed to those skilled in the art. The described features, structures, or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present disclosure. However, those skilled in the art will appreciate that the technical solutions of the present disclosure may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known technical solutions are not shown or described in detail to avoid obscuring various aspects of the present disclosure.
[0069] In addition, the accompanying drawings are only schematic illustrations of the present disclosure and are not necessarily drawn to scale. The same reference numerals in the figures represent the same or similar parts, and their repeated description will be omitted. Some of the block diagrams shown in the accompanying drawings are functional entities and do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or implemented in one or more hardware modules or integrated circuits, or implemented in different networks and / or processor devices and / or microcontroller devices.
[0070] Figure 1 A schematic diagram schematically shows an exemplary system architecture of a data processing method and device for cross-sample federated learning to which an embodiment of the present disclosure can be applied.
[0071] like Figure 1As shown, the system architecture 100 may include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 is used to provide a medium for communication links between the terminal devices 101, 102, 103 and the server 105. The network 104 may include various connection types, such as wired, wireless communication links or optical fiber cables, etc. The terminal devices 101, 102, 103 may be various electronic devices with display screens, including but not limited to desktop computers, portable computers, smart phones, tablet computers, etc. It should be understood that Figure 1 The number of terminal devices, networks and servers in the example is only illustrative. According to the implementation requirements, there can be any number of terminal devices, networks and servers. For example, the server 105 can be a server cluster composed of multiple servers. For example, the terminal device 101, 102 or 103 can execute: determine the reference data from the original data according to the preset ratio, and sample the reference data to obtain sample data; if the sample data contains non-numerical data, generate a statistical value set corresponding to the sample data; wherein the statistical value set includes a statistical value corresponding to at least one field; encrypt the statistical value in the statistical value set, and send the encrypted statistical value set to the server. Furthermore, the server 105 can execute: generate a global statistical value set according to the encrypted statistical value set sent by the terminal device 101, 102 or 103 and feed the global statistical value set back to the terminal device 101, 102 or 103. Furthermore, the terminal device 101, 102 or 103 can execute: decrypt the global statistical value set and perform numerical processing on the sample data according to the decrypted global statistical value set, and perform model training according to the processed sample data.
[0072] Figure 2 A schematic diagram of the structure of a computer system suitable for implementing an electronic device of an embodiment of the present disclosure is shown.
[0073] It should be noted that Figure 2 The computer system 200 of the electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0074] like Figure 2 As shown, the computer system 200 includes a central processing unit (CPU) 201, which can perform various appropriate actions and processes according to the program stored in the read-only memory (ROM) 202 or the program loaded from the storage part 208 to the random access memory (RAM) 203. In the (RAM) 203, various programs and data required for system operation are also stored. The (CPU) 201, the (ROM) 202 and the (RAM) 203 are connected to each other through a bus 204. An input / output (I / O) interface 205 is also connected to the bus 204.
[0075] The following components are connected to the (I / O) interface 205: an input section 206 including a keyboard, a mouse, etc.; an output section 207 including a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 208 including a hard disk, etc.; and a communication section 209 including a network interface card such as a LAN card, a modem, etc. The communication section 209 performs communication processing via a network such as the Internet. A drive 210 is also connected to the (I / O) interface 205 as needed. A removable medium 211, such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc., is installed on the drive 210 as needed, so that a computer program read therefrom is installed into the storage section 208 as needed.
[0076] In particular, according to an embodiment of the present disclosure, the process described below with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication part 209, and / or installed from a removable medium 211. When the computer program is executed by the central processing unit (CPU) 201, various functions defined in the method and apparatus of the present application are executed.
[0077] It should be noted that the computer-readable medium shown in the present disclosure may be a computer-readable signal medium or a computer-readable storage medium or any combination of the above two. The computer-readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples of computer-readable storage media may include, but are not limited to: an electrical connection with one or more wires, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above. In the present disclosure, a computer-readable storage medium may be any tangible medium containing or storing a program that can be used by or in combination with an instruction execution system, device or device. In the present disclosure, a computer-readable signal medium may include a data signal propagated in a baseband or as part of a carrier wave, in which a computer-readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination of the above. Computer-readable signal media may also be any computer-readable medium other than computer-readable storage media, which may send, propagate or transmit a program for use by or in conjunction with an instruction execution system, apparatus or device. The program code contained on the computer-readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, optical cable, RF, etc., or any suitable combination of the above.
[0078] The flow chart and block diagram in the accompanying drawings show the possible architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each box in the flow chart or block diagram can represent a module, a program segment, or a part of a code, and the above-mentioned module, program segment, or a part of a code contains one or more executable instructions for realizing the specified logical function. It should also be noted that in some implementations as replacements, the functions marked in the box can also occur in a sequence different from that marked in the accompanying drawings. For example, two boxes represented in succession can actually be executed substantially in parallel, and they can sometimes be executed in the opposite order, depending on the functions involved. It should also be noted that each box in the block diagram or flow chart, and the combination of the boxes in the block diagram or flow chart can be implemented with a dedicated hardware-based system that performs a specified function or operation, or can be implemented with a combination of dedicated hardware and computer instructions.
[0079] The units involved in the embodiments described in the present disclosure may be implemented by software or hardware, and the units described may also be arranged in a processor. The names of these units do not, in some cases, constitute limitations on the units themselves.
[0080] As another aspect, the present application also provides a computer-readable medium, which may be included in the electronic device described in the above embodiment; or may exist independently without being installed in the electronic device. The above computer-readable medium carries one or more programs, and when the above one or more programs are executed by an electronic device, the electronic device implements the method described in the following embodiment. For example, the electronic device may implement the following method. Figure 3 The various steps shown, etc.
[0081] This example embodiment provides a data processing method for cross-sample federated learning. Figure 3 As shown, the data processing method applied to cross-sample federated learning may include the following steps S310 to S350, specifically:
[0082] Step S310: determining reference data from the original data according to a preset ratio, and sampling the reference data to obtain sample data.
[0083] Step S320: If the sample data includes non-numeric data, a statistical value set corresponding to the sample data is generated; wherein the statistical value set includes a statistical value corresponding to at least one field.
[0084] Step S330: encrypt the statistical values in the statistical value set, and send the encrypted statistical value set to the server.
[0085] Step S340: Generate a global statistical value set according to the encrypted statistical value set sent by each participant and feed back the global statistical value set to each participant.
[0086] Step S350: decrypt the global statistical value set and perform numerical processing on the sample data according to the decrypted global statistical value set, and perform model training according to the processed sample data.
[0087] Among them, steps S310 to S350 can be executed by the terminal device / server corresponding to any participant in the cross-sample federated learning scenario. This application does not limit the number of participants in the cross-sample federated learning scenario.
[0088] Implementation Figure 3The data processing method shown is applied to cross-sample federated learning. In the cross-sample federated learning scenario, the local data of each participant corresponds to the same field but the specific content of the local data of each participant is different. The server federation can be triggered to calculate the global statistical value set based on the statistical value set based on the local data sent by each participant. Then, each participant can implement the preprocessing of sample data based on the global statistical value set, thereby realizing the data preprocessing scheme combined with federated learning, so as to carry out federated learning among multiple participants. In addition, the sample data can be de-characterized by numerical processing of non-numeric data, which is conducive to better implementation of federated model training.
[0089] Next, the above steps of this exemplary embodiment are described in more detail.
[0090] In step S310, reference data is determined from the original data according to a preset ratio, and the reference data is sampled to obtain sample data.
[0091] Specifically, the original data may be the local data of the participant, and illustratively, the local data may be user data. An original data may be composed of sub-data corresponding to multiple fields. Among them, the number of original data may be one or more, and the reference data determined from the original data according to the preset ratio may be one or more; wherein the preset ratio may be a preset ratio value (e.g., 70%), and if the number of participants in the cross-sample federated learning scenario is greater than 1, each participant applies the same preset ratio.
[0092] For example, the multiple raw data corresponding to participant A can be expressed as the following Table 1:
[0093] User ID Name gender age Frequency of violations Overdue frequency 1 ** male 20 0 2 2 *** female 43 3 0 3 ## female Fourty 5 1 4 ### male 21 1 0 5 $$$ male 32 0 0
[0094] Table 1
[0095] The reference data determined from the original data shown in Table 1 according to the preset ratio can be expressed as the following Table 2:
[0096] User ID Name gender age Frequency of violations Overdue frequency 1 ** male 20 0 2 2 *** female 43 3 0 3 ## female Fourty 5 1 4 ### male 21 1 0
[0097] Table 2
[0098] The sample data obtained by sampling the reference data shown in Table 2 can be expressed as follows
[0099] Table 3:
[0100] User ID Name gender age Frequency of violations Overdue frequency 1 ** male 20 0 2 2 *** female 43 3 0 3 ## female Fourty 5 1
[0101] Table 3
[0102] As an optional embodiment, sampling the reference data to obtain the sample data includes: sampling the reference data by a preset sampling method to obtain the sample data; wherein the preset sampling method includes upsampling, downsampling or layered sampling.
[0103] Specifically, the preset sampling method may be other sampling methods in addition to the above-mentioned sampling method, which is not limited in the embodiments of the present application. In addition, the reference data is sampled by upsampling to obtain sample data, including: determining the value range of each field information in the target field, each field information comes from different reference data, and the target field can be any field in the fields corresponding to the reference data; determining the number of field information contained in each value range, sampling the reference data based on the value range corresponding to the maximum number of field information, and obtaining sample data; wherein the number of sample data is consistent with the number of field information in a specific value range, and the specific value range contains the minimum number of field information.
[0104] For example, a reference data may include field information corresponding to the fields "user ID", "name", "gender", "age", "violation frequency", and "overdue frequency", i.e., "2", "***", "female", "43", "3", and "0". The target field may be the above-mentioned field "age", and the value range of each field information in the target field may include [1-10, 10-20, 30-40, 40-100], and the field information in the target field may be "1, 4, 10, 12, 15, 20, 40, 50, 55" respectively. The value range [1-10] includes field information "1" and "4", that is, the number of field information corresponding to the value range [1-10] is 2, and the field information "1" and "4" belong to different reference data respectively; the value range [1-10] includes field information "10", "12", "15", and "20", that is, the number of field information corresponding to the value range [10-20] is 4, and the field information "10", "12", "15", and "20" belong to different reference data respectively; the value range [30-40] includes field information "40", that is, the number of field information corresponding to the value range [1-10] is 1; the value range [40-100] includes field information "50" and "55", that is, the number of field information corresponding to the value range [40-100] is 2, and the field information "50" and "55" belong to different reference data respectively. It can be seen that the number of field information corresponding to the value ranges [1-10, 10-20, 30-40, 40-100] is different, that is, there is a sample imbalance and the number of field information corresponding to the value range [10-20] is the largest. Then, sample data can be obtained by sampling from the reference data to which the field information corresponding to the value range [10-20] belongs. The number of sample data can be 1, which corresponds to the value range containing the least number of field information (e.g., 1), thereby achieving upsampling.
[0105] In addition, the reference data is sampled by downsampling to obtain sample data, including: determining the value range of each field information in the target field, each field information comes from different reference data, and the target field can be any field in the fields corresponding to the reference data; sampling the reference data according to the number of field information in each value range to obtain sample data, and the proportion of sample data contained in each value range is consistent with a preset ratio (e.g., 1:1:1).
[0106] Based on the above example, when the number of field information corresponding to the value range [1-10, 10-20, 30-40, 40-100] is different, the same number of field information is obtained from each value range and the reference data corresponding to the field information is determined as the sample data.
[0107] In addition, the reference data is sampled by stratified sampling to obtain sample data, including: determining the value corresponding to the reference data under each field; determining a preset value range set corresponding to each field; selecting intermediate data for each field based on the preset value range set, and for this field, the value of the intermediate data falls within each preset value range in the preset value range set (such as [10-20, 20-30, 30-40]); determining the union of the intermediate data corresponding to each field, and determining the data in the union as the above-mentioned sample data, so that balanced values can be achieved for the reference data, so as to train a more accurate model.
[0108] In another method, the reference data is sampled by stratified sampling to obtain sample data, including: determining a specific field from each field, wherein the specific field may be a field corresponding to the most field information; determining a set of preset value ranges corresponding to the specific field; and selecting sample data based on the preset value range set, wherein the values of the sample data respectively fall within each preset value range in the preset value range set (e.g., [10-20, 20-30, 30-40]).
[0109] It can be seen that by implementing this optional embodiment, sample data that is more suitable for model training can be sampled from various reference data in a balanced manner, and the accuracy of the model can be improved based on the effective sample data.
[0110] In step S320, if the sample data includes non-numeric data, a statistical value set corresponding to the sample data is generated; wherein the statistical value set includes a statistical value corresponding to at least one field.
[0111] Specifically, the statistical value corresponding to at least one field may be one or more. In addition, if the sample data does not contain non-numeric data, it also includes: generating a statistical value set corresponding to the sample data; wherein the statistical value set includes the statistical value corresponding to at least one field; encrypting the statistical values in the statistical value set, and sending the encrypted statistical value set to the server; wherein the server is used to generate a global statistical value set based on the encrypted statistical value set sent by each participant and feed the global statistical value set back to each participant; decrypting the global statistical value set and performing numerical processing on the sample data based on the decrypted global statistical value set, and performing model training based on the processed sample data.
[0112] As an optional embodiment, generating a statistical value set corresponding to sample data includes: determining the total sample data volume corresponding to the sample data; determining the sub-data corresponding to the same field in each sample data to obtain a sub-data set corresponding to each field; calculating the statistical value corresponding to each sub-data set; and determining the statistical value set of the sample data according to the statistical value of each sub-data set and the total sample data volume. The statistical value of the sub-data set includes at least one of the first type of sub-data volume, the second type of sub-data volume, the mean, and the mode.
[0113] Specifically, if the sample data is as shown in Table 3, the total sample data volume is 3.
[0114] It can be seen that by implementing this optional embodiment, the sample data can be divided into multiple sub-data sets according to the fields to which they belong, so as to perform efficient and accurate numerical processing based on the fields.
[0115] In step S330, the statistical values in the statistical value set are encrypted, and the encrypted statistical value set is sent to the server.
[0116] Specifically, encrypting the statistical values in the statistical value set includes: encrypting the statistical values in the statistical value set based on a homomorphic encryption algorithm in a preset encryption algorithm; specifically including: obtaining a key according to a key exchange protocol, and encrypting the statistical values in the statistical value set by using the key, wherein the keys corresponding to each participant are the same. Alternatively, encrypting the statistical values in the statistical value set includes: adding a random number to each statistical value in the statistical value set, wherein the sum of the random numbers corresponding to each participant is 0. The statistical value set includes statistical values of different dimensions, such as mean, mode, median, etc.
[0117] In step S340, a global statistical value set is generated according to the encrypted statistical value sets sent by each participant and the global statistical value set is fed back to each participant.
[0118] Specifically, step S340 can be executed by the server, and the method of generating a global statistical value set based on the encrypted statistical value sets sent by each participant and feeding the global statistical value set back to each participant can be: according to the encrypted statistical value sets sent by each participant (such as the encrypted statistical value set of participant A [12, male, 5], the encrypted statistical value set of participant B [22, male, 45], the encrypted statistical value set of participant C [543, female, 21]), the statistical values belonging to the same dimension are determined to obtain the statistical value sets under each dimension (such as the median [12, 22, 543], the mode [male, male, female], the mean [5, 45, 21]); further, the statistical value sets under each dimension can be fused to obtain the fusion results corresponding to each dimension (such as the median 192.33, the mode male, the mean 23.66), the fusion results corresponding to each dimension are determined as the global statistical value set and the global statistical value set is fed back to each participant.
[0119] In step S350, the global statistical value set is decrypted and the sample data is numerically processed according to the decrypted global statistical value set, and model training is performed according to the processed sample data.
[0120] Specifically, non-numeric data may include letter data, string data, etc., which are not limited in the embodiments of the present application. In addition, model training is performed according to the processed sample data, including: if the number of processed sample data is 1, the processed sample data is input into the model, and the loss function between the result output by the model and the preset result (such as label) corresponding to the sample data is calculated, and then the model parameters are adjusted according to the loss function, so as to update the model; if the number of processed sample data is greater than 1, the processed multiple sample data are sequentially input into the model to realize multiple training of the model, wherein the model is a federal model of the participants, each participant corresponds to one or more federal models, and the model architecture may be the same or different between different participants. Among them, the loss function may be an absolute value loss function, a log loss function, a square loss function, an exponential loss function, a Hinge loss function, a perceptual loss function, a cross entropy loss function, etc., which are not limited in the embodiments of the present application. In addition, model training is performed according to the processed sample data, including: feature derivation and / or feature selection are performed according to the processed sample data to obtain feature engineering results, and model training is performed based on the feature engineering results.
[0121] As an optional implementation, the above method also includes: determining verification set data from the original data, and verifying the trained model based on the verification set data, obtaining and outputting the verification results.
[0122] Specifically, determining the validation set data from the original data includes: determining the data in the original data other than the reference data as the validation set data; or determining the validation set data from the original data according to the validation set selection ratio (e.g., 50%). The validation set data determined in this way may or may not overlap with the sample data.
[0123] In addition, the trained model is verified according to the verification set data to obtain and output the verification results, including: inputting the verification set data into the trained model in sequence to obtain the verification results corresponding to each data in the verification set data, and the verification results can be expressed as a string, text, numerical value, etc., which is not limited to the embodiments of the present application; the verification results are structured to obtain a structured representation of the verification results (such as a table), and the structured representation is output, which can facilitate users to intuitively understand the verification results and improve the intuitiveness of the output verification results.
[0124] It can be seen that by implementing this optional embodiment, verification set data can be divided to verify the trained model, and the verification results used to characterize the model training accuracy can be displayed to the user so that the user can understand the application effect of the model trained with numerical sample data.
[0125] As an optional embodiment, decrypting the global statistical value set and numerically processing the sample data based on the decrypted global statistical value set includes: determining the proportion of first type of sub-data and the proportion of second type of sub-data in the sub-data set; and numerically processing the sub-data set based on the proportion of first type of sub-data and the proportion of second type of sub-data.
[0126] Specifically, the sub-data set may include first-type sub-data (e.g., 3, 5, 10), second-type sub-data (e.g., Forty), and other-type sub-data (e.g., ), the first type of sub-data may be numerical sub-data, int sub-data, etc., and the second type of sub-data may be letter sub-data, text sub-data, etc., which is not limited in the embodiments of the present application. The present application takes the example that the first type of sub-data is numerical sub-data and the second type of sub-data is letter sub-data. In addition, the proportion of the first type of sub-data (e.g., 70%) may be the ratio of the data volume of the first type of sub-data to the total data volume of the sub-data set, and the proportion of the second type of sub-data (e.g., 30%) may be the ratio of the data volume of the second type of sub-data to the total data volume of the sub-data set.
[0127] It can be seen that by implementing this optional embodiment, the sub-data set can be numerically processed through the proportion of the first type of sub-data and the proportion of the second type of sub-data in the sub-data set, so as to obtain a fully numerical data set for training the model more efficiently and conveniently.
[0128] As an optional embodiment, the sub-data set is numerically processed according to the proportion of the first type of sub-data and the proportion of the second type of sub-data, including: if it is detected that the sum of the proportion of the first type of sub-data and the proportion of the second type of sub-data is less than a preset ratio threshold, the sub-data set is deleted; if it is detected that the proportion of the first type of sub-data is greater than or equal to the proportion of the second type of sub-data, the second type of sub-data in the sub-data set is converted into first numerical data based on a global statistical value set; if it is detected that the proportion of the first type of sub-data is less than the proportion of the second type of sub-data, the first type of sub-data in the sub-data set is converted into non-numerical data based on the global statistical value set, and the non-numerical data and the second type of sub-data in the sub-data set are uniformly converted into first numerical data.
[0129] Specifically, the preset ratio threshold can be expressed as delete_ratio. If the sample data is as shown in Table 3, the sub-dataset corresponding to the field "user ID" is [1, 2, 3], the sub-dataset corresponding to the field "name" is [**, ***, ##], the sub-dataset corresponding to the field "gender" is [male, female, female], the sub-dataset corresponding to the field "age" is [20, 43, Fourty], the sub-dataset corresponding to the field "violation frequency" is [0, 3, 5], and the sub-dataset corresponding to the field "overdue frequency" is [2, 0, 1].
[0130] Taking the sub-dataset [**, ***, ##] corresponding to the field "name" as an example, if it is detected that the sum of the proportion of the first type of sub-data and the proportion of the second type of sub-data in the sub-dataset is less than the preset ratio threshold, the sub-dataset is deleted; wherein, the method of deleting the sub-dataset can be: deleting the field information containing the specific field (i.e., name) in each sample data, and the sample data after deleting the sub-dataset can be expressed as the following Table 4:
[0131] User ID gender age Frequency of violations Overdue frequency 1 male 20 0 2 2 female 43 3 0 3 female Fourty 5 1
[0132] Table 4
[0133] Taking the sub-dataset [20, 43, Fourty] corresponding to the field "age" as an example, if it is detected that the proportion of the first type of sub-data is greater than or equal to the proportion of the second type of sub-data, the second type of sub-data [Fourty] in the sub-dataset is converted into first numerical data (such as the median 31.5) based on the global statistical value set; wherein, the method of converting the second type of sub-data in the sub-dataset into the first numerical data based on the global statistical value set can be: selecting specific parameters from the global statistical value set, and replacing all the second type of sub-data in the sub-dataset with the specific parameters, so that the sub-dataset only contains the first numerical data, and the sample data of the sub-dataset after numerical processing can be expressed as the following Table 5; wherein, the specific parameter can be the mode or the median, etc., which is not limited in the embodiments of the present application.
[0134] User ID gender age Frequency of violations Overdue frequency 1 male 20 0 2 2 female 43 3 0 3 female 31.5 5 1
[0135] Table 5
[0136] If it is detected that the proportion of the first type of sub-data is less than the proportion of the second type of sub-data, the first type of sub-data in the sub-data set is converted into non-numeric data based on a global statistical value set (e.g., mode), and the non-numeric data and the second type of sub-data in the sub-data set are uniformly converted into first numerical data; wherein, the non-numeric data and the second type of sub-data in the sub-data set are uniformly converted into the first numerical data, including: uniformly converting the non-numeric data and the second type of sub-data in the sub-data set into a preset numerical value (e.g., 100), the preset numerical value belongs to the first numerical data; or, based on a global statistical value set (e.g., a fusion result of feature vectors of each sub-data in the sub-data set), the non-numeric data and the second type of sub-data in the sub-data set are uniformly converted into a preset numerical value.
[0137] It can be seen that the implementation of this optional embodiment can realize data processing methods in various situations to cope with the situations of different sub-data sets, so as to realize the numerical processing of each sub-data set efficiently and conveniently.
[0138] See also Figure 4 , Figure 4 Schematically shows Figure 3 A flowchart of a data processing method for cross-sample federated learning according to an embodiment of the present invention. Figure 4 As shown, the data processing method applied to cross-sample federated learning includes: steps S400 to S490.
[0139] Step S400: determining reference data from original data according to a preset ratio.
[0140] Step S410: sampling the reference data by a preset sampling method to obtain sample data; wherein the preset sampling method includes upsampling, downsampling or stratified sampling.
[0141] Step S420: If the sample data contains non-numeric data, determine the total sample data volume corresponding to the sample data, and determine the sub-data corresponding to the same field in each sample data, obtain the sub-data set corresponding to each field, and then calculate the statistical value corresponding to each sub-data set, so as to determine the statistical value set of the sample data according to the statistical value of each sub-data set and the total sample data volume; wherein the statistical value set includes the statistical value corresponding to at least one field, and the statistical value of the sub-data set includes at least one of the first type of sub-data volume, the second type of sub-data volume, the mean and the mode.
[0142] Step S430: encrypt the statistical values in the statistical value set, and send the encrypted statistical value set to the server, so that it generates a global statistical value set according to the encrypted statistical value sets sent by each participant and feeds back the global statistical value set to each participant.
[0143] Step S440: Determine the proportion of the first type of sub-data and the proportion of the second type of sub-data in the sub-data set that has not been digitized. If it is detected that the sum of the proportion of the first type of sub-data and the proportion of the second type of sub-data is less than the preset ratio threshold, execute step S450. If it is detected that the proportion of the first type of sub-data is greater than or equal to the proportion of the second type of sub-data, execute step S460. If it is detected that the proportion of the first type of sub-data is less than the proportion of the second type of sub-data, execute step S470.
[0144] Step S450: Delete the sub-dataset, and then execute step S480.
[0145] Step S460: based on the decrypted global statistical value set, convert the second type of sub-data in the sub-data set into first numerical data. Then, execute step S480.
[0146] Step S470: based on the decrypted global statistical value set, convert the first type of sub-data in the sub-data set into non-numeric data, and convert the non-numeric data and the second type of sub-data in the sub-data set into first numeric data. Then execute step S480.
[0147] Step S480: Check whether the digitization processing of all sub-data sets in the sample data is completed. If yes, execute step S490, if not, execute step S440.
[0148] Step S490: Perform model training based on the processed sample data.
[0149] It should be noted that steps S400 to S490 are Figure 3 The steps and their embodiments shown correspond to each other. For the specific implementation of steps S400 to S490, please refer to Figure 3 The steps and embodiments shown are not described in detail here.
[0150] It can be seen that implementation Figure 4The method shown, in a cross-sample federated learning scenario, the local data of each participant corresponds to the same field but the specific content of the local data of each participant is different. The server federation can be triggered to calculate a global statistical value set based on the statistical value set based on the local data sent by each participant. Then, each participant can implement preprocessing of sample data based on the global statistical value set, thereby realizing a data preprocessing solution combined with federated learning, so that federated learning can be performed between multiple participants. In addition, the sample data can be de-characterized by numerical processing of non-numeric data, which is conducive to better implementation of federated model training.
[0151] Combination Figure 3 The present application also discloses a sample data processing system for cross-sample federated learning, which may include a server and multiple participants, the original data of the multiple participants correspond to the same field set, and the original data of the multiple participants correspond to different data contents, wherein:
[0152] Participants, used to determine reference data from original data according to a preset ratio, and sample the reference data to obtain sample data;
[0153] The participant is further configured to generate a statistical value set corresponding to the sample data if the sample data contains non-numeric data; wherein the statistical value set includes a statistical value corresponding to at least one field;
[0154] The participant is also used to encrypt the statistical value in the statistical value set and send the encrypted statistical value set to the server;
[0155] The server is used to generate a global statistical value set according to the encrypted statistical value set sent by each participant and feed back the global statistical value set to each participant;
[0156] The participant is also used to decrypt the global statistical value set and digitize the sample data according to the decrypted global statistical value set, and perform model training according to the processed sample data.
[0157] It should be noted that the number of participants in this application is not limited. For example, the number of participants is 2. Figure 5 , Figure 5 A sequence diagram of a data processing system applied to cross-sample federated learning according to an embodiment of the present disclosure is schematically shown. Figure 5 As shown, the data processing system applied to cross-sample federated learning includes: steps S510 to S530.
[0158] Step S510: Party A determines reference data from the original data according to a preset ratio, and samples the reference data to obtain sample data.
[0159] Step S512: Party B determines reference data from the original data according to a preset ratio, and samples the reference data to obtain sample data.
[0160] Step S514: If the sample data includes non-numeric data, participant A generates a statistical value set A corresponding to the sample data; wherein the statistical value set includes a statistical value corresponding to at least one field.
[0161] Step S516: If the sample data includes non-numeric data, participant B generates a statistical value set B corresponding to the sample data; wherein the statistical value set includes a statistical value corresponding to at least one field.
[0162] Step S518: Party A encrypts the statistical values in the statistical value set A, and sends the encrypted statistical value set A to the server.
[0163] Step S520: Party B encrypts the statistical values in the statistical value set B, and sends the encrypted statistical value set B to the server.
[0164] Step S522: The server generates a global statistical value set according to the statistical value set A and the statistical value set B.
[0165] Step S524: The server feeds back the global statistical value set to participant A.
[0166] Step S526: The server feeds back the global statistical value set to participant B.
[0167] Step S528: Party A decrypts the global statistical value set and performs numerical processing on the sample data according to the decrypted global statistical value set, and performs model training according to the processed sample data.
[0168] Step S530: Party B decrypts the global statistical value set and performs numerical processing on the sample data according to the decrypted global statistical value set, and performs model training according to the processed sample data.
[0169] It should be noted that steps S510 to S530 are Figure 3 The steps and their embodiments shown correspond to each other. For the specific implementation of steps S510 to S530, please refer to Figure 3 The steps and embodiments shown are not described in detail here.
[0170] It can be seen that the implementation Figure 5The method shown, in a cross-sample federated learning scenario, the local data of each participant corresponds to the same field but the specific content of the local data of each participant is different. The server federation can be triggered to calculate a global statistical value set based on the statistical value set based on the local data sent by each participant. Then, each participant can implement preprocessing of sample data based on the global statistical value set, thereby realizing a data preprocessing solution combined with federated learning, so that federated learning can be performed between multiple participants. In addition, the sample data can be de-characterized by numerical processing of non-numeric data, which is conducive to better implementation of federated model training.
[0171] Furthermore, in this example implementation, a data processing device for cross-sample federated learning is also provided. Figure 6 As shown, the data processing device 600 applied to cross-sample federated learning may include:
[0172] The data selection unit 601 is used to determine reference data from the original data according to a preset ratio, and to sample the reference data to obtain sample data;
[0173] A data statistics unit 602, configured to generate a statistical value set corresponding to the sample data if the sample data includes non-numeric data; wherein the statistical value set includes a statistical value corresponding to at least one field;
[0174] The data federation unit 603 is used to encrypt the statistical values in the statistical value set and send the encrypted statistical value set to the server;
[0175] A data generation unit 604 is used to feed back the global statistical value set to each participant;
[0176] The data application unit 605 is used to decrypt the global statistical value set and perform numerical processing on the sample data according to the decrypted global statistical value set, and perform model training according to the processed sample data.
[0177] It can be seen that the implementation Figure 6 The device shown, in a cross-sample federated learning scenario, the local data of each participant corresponds to the same field but the specific content of the local data of each participant is different. The server federation can be triggered to calculate a global statistical value set based on the statistical value set based on the local data sent by each participant. Then, each participant can implement preprocessing of sample data based on the global statistical value set, thereby realizing a data preprocessing solution combined with federated learning, so that federated learning can be performed between multiple participants. In addition, the sample data can be de-characterized by numerical processing of non-numeric data, which is conducive to better implementation of federated model training.
[0178] In an exemplary embodiment of the present disclosure, the data statistics unit 602 generates a set of statistical values corresponding to the sample data, including:
[0179] Determine the total sample data volume corresponding to the sample data;
[0180] Determine the sub-data corresponding to the same field in each sample data, and obtain the sub-data set corresponding to each field;
[0181] Calculate the statistical value corresponding to each sub-dataset;
[0182] The statistical value set of the sample data is determined based on the statistical value of each sub-data set and the total sample data volume.
[0183] The statistical value of the sub-data set includes at least one of the first type of sub-data volume, the second type of sub-data volume, the mean, and the mode.
[0184] It can be seen that by implementing this optional embodiment, the sample data can be divided into multiple sub-data sets according to the fields to which they belong, so as to perform efficient and accurate numerical processing based on the fields.
[0185] In an exemplary embodiment of the present disclosure, the data application unit 605 decrypts the global statistical value set and performs numerical processing on the sample data according to the decrypted global statistical value set, including:
[0186] Determine the proportion of the first type of sub-data and the proportion of the second type of sub-data in the sub-data set;
[0187] The sub-data sets are numerically processed according to the proportion of the first type of sub-data and the proportion of the second type of sub-data.
[0188] It can be seen that by implementing this optional embodiment, the sub-data set can be numerically processed through the proportion of the first type of sub-data and the proportion of the second type of sub-data in the sub-data set, so as to obtain a fully numerical data set for training the model more efficiently and conveniently.
[0189] In an exemplary embodiment of the present disclosure, the data application unit 605 performs numerical processing on the sub-data set according to the proportion of the first type of sub-data and the proportion of the second type of sub-data, including:
[0190] If it is detected that the sum of the proportion of the first type of sub-data and the proportion of the second type of sub-data is less than a preset ratio threshold, the sub-data set is deleted;
[0191] If it is detected that the proportion of the first type of sub-data is greater than or equal to the proportion of the second type of sub-data, converting the second type of sub-data in the sub-data set into first numerical data based on the global statistical value set;
[0192] If it is detected that the proportion of the first type of sub-data is less than that of the second type of sub-data, the first type of sub-data in the sub-data set is converted into non-numeric data based on the global statistical value set, and the non-numeric data and the second type of sub-data in the sub-data set are uniformly converted into first numerical data.
[0193] It can be seen that the implementation of this optional embodiment can realize data processing methods in various situations to cope with the situations of different sub-data sets, so as to realize the numerical processing of each sub-data set efficiently and conveniently.
[0194] In an exemplary embodiment of the present disclosure, the data selection unit 601 samples the reference data to obtain sample data, including:
[0195] The reference data is sampled by a preset sampling method to obtain sample data; wherein the preset sampling method includes upsampling, downsampling or stratified sampling.
[0196] It can be seen that by implementing this optional embodiment, sample data that is more suitable for model training can be sampled, and the accuracy of the model can be improved based on the effective sample data.
[0197] In an exemplary embodiment of the present disclosure, the data selection unit 601 is also used to determine the verification set data from the original data, and verify the trained model according to the verification set data to obtain and output the verification result.
[0198] It can be seen that by implementing this optional embodiment, verification set data can be divided to verify the trained model, and the verification results used to characterize the model training accuracy can be displayed to the user so that the user can understand the application effect of the model trained with numerical sample data.
[0199] It should be noted that, although several modules or units of the device for action execution are mentioned in the above detailed description, this division is not mandatory. In fact, according to the embodiments of the present disclosure, the features and functions of two or more modules or units described above can be embodied in one module or unit. On the contrary, the features and functions of one module or unit described above can be further divided into multiple modules or units to be embodied.
[0200] Since the various functional modules of the data processing device applied to cross-sample federated learning in the example embodiment of the present disclosure correspond to the steps of the example embodiment of the data processing method applied to cross-sample federated learning, for details not disclosed in the embodiment of the device of the present disclosure, please refer to the embodiment of the data processing method applied to cross-sample federated learning in the present disclosure.
[0201] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0202] It should be understood that the present disclosure is not limited to the exact structures that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.
Claims
1. A data processing method for cross-sample federated learning, characterized in that: include: Determine reference data from the original data according to a preset ratio, and sample the reference data to obtain sample data; wherein the original data is the local data of the participant, the local data is user data, and the user data includes at least one of user identification, name, gender, age, violation frequency, and overdue frequency; If the sample data includes non-numeric data, a statistical value set corresponding to the sample data is generated; wherein the statistical value set includes a statistical value corresponding to at least one field; the field includes at least one of a user identification field, a name field, a gender field, an age field, a violation frequency field, and an overdue frequency field; Encrypting the statistical values in the statistical value set according to the key or random number obtained by the key exchange protocol, and sending the encrypted statistical value set to the server; wherein, when encrypting by the key, the key of each participant is the same; when encrypting by the random number, the sum of the random numbers of each participant is 0; Generate a global statistical value set according to the encrypted statistical value set sent by each participant and feed back the global statistical value set to each participant; The global statistical value set is decrypted, the sample data is numerically processed according to the decrypted global statistical value set, and model training is performed according to the processed sample data.
2. The method according to claim 1, characterized in that Generating a set of statistical values corresponding to the sample data, comprising: Determine the total sample data volume corresponding to the sample data; Determine the sub-data corresponding to the same field in each of the sample data, and obtain the sub-data set corresponding to each field; Calculating statistical values corresponding to each of the sub-data sets; A statistical value set of the sample data is determined according to the statistical value of each of the sub-data sets and the total sample data volume.
3. The method according to claim 2, characterized in that in: The statistical value of the sub-data set includes at least one of the amount of first-type sub-data, the amount of second-type sub-data, a mean, and a mode.
4. The method according to claim 2, characterized in that: Decrypting the global statistical value set and performing numerical processing on the sample data according to the decrypted global statistical value set includes: Determine a proportion of first type of sub-data and a proportion of second type of sub-data in the sub-data set; The sub-data set is numerically processed according to the proportion of the first type of sub-data and the proportion of the second type of sub-data.
5. The method according to claim 4, characterized in that The sub-data set is numerically processed according to the proportion of the first-type sub-data and the proportion of the second-type sub-data, including: If it is detected that the sum of the proportion of the first type of sub-data and the proportion of the second type of sub-data is less than a preset ratio threshold, deleting the sub-data set; If it is detected that the proportion of the first type of sub-data is greater than or equal to the proportion of the second type of sub-data, converting the second type of sub-data in the sub-data set into first numerical data based on the global statistical value set; If it is detected that the proportion of the first type of sub-data is less than the proportion of the second type of sub-data, the first type of sub-data in the sub-data set is converted into non-numeric data based on the global statistical value set, and the non-numeric data and the second type of sub-data in the sub-data set are uniformly converted into first numerical data.
6. The method according to claim 1, characterized in that Sampling the reference data to obtain sample data includes: The reference data is sampled by a preset sampling method to obtain sample data; wherein the preset sampling method includes upsampling, downsampling or stratified sampling.
7. The method according to any one of claims 1 to 6, characterized in that: The method further comprises: Determine the validation set data from the original data, and validate the trained model based on the validation set data to obtain and output the validation results.
8. A data processing device for cross-sample federated learning, characterized in that: include: A data selection unit, used to determine reference data from original data according to a preset ratio, and sample the reference data to obtain sample data; wherein the original data is local data of the participant, the local data is user data, and the user data includes at least one of user identification, name, gender, age, violation frequency, and overdue frequency; A data statistics unit, configured to generate a statistical value set corresponding to the sample data if the sample data contains non-numeric data; wherein the statistical value set includes a statistical value corresponding to at least one field; the field includes at least one of a user identification field, a name field, a gender field, an age field, a violation frequency field, and an overdue frequency field; A data federation unit, configured to encrypt the statistical values in the statistical value set according to the key or random number obtained by the key exchange protocol, and send the encrypted statistical value set to the server; wherein, when encryption is performed by the key, the key of each participant is the same; when encryption is performed by the random number, the sum of the random numbers of each participant is 0; A data generating unit, configured to generate a global statistical value set according to the encrypted statistical value set sent by each participant and feed the global statistical value set back to each participant; A data application unit is used to decrypt the global statistical value set and perform numerical processing on the sample data according to the decrypted global statistical value set, and perform model training according to the processed sample data.
9. A sample data processing system applied to cross-sample federated learning, characterized in that: The system includes a server and multiple participants, the original data of the multiple participants correspond to the same field set, and the original data of the multiple participants correspond to different data contents, wherein: The participant is used to determine reference data from the original data according to a preset ratio, and sample the reference data to obtain sample data; wherein the original data is the local data of the participant, the local data is user data, and the user data includes at least one of user identification, name, gender, age, violation frequency and overdue frequency; The participant is further configured to generate a statistical value set corresponding to the sample data if the sample data includes non-numeric data; wherein the statistical value set includes a statistical value corresponding to at least one field; the field includes at least one of a user identification field, a name field, a gender field, an age field, a violation frequency field, and an overdue frequency field; The participant is further configured to encrypt the statistical value in the statistical value set according to the key or random number obtained by the key exchange protocol, and send the encrypted statistical value set to the server; wherein, when encryption is performed by the key, the key of each participant is the same; when encryption is performed by the random number, the sum of the random numbers of each participant is 0; The server is used to generate a global statistical value set according to the encrypted statistical value set sent by each of the participants and feed back the global statistical value set to each of the participants; The participant is also used to decrypt the global statistical value set and perform numerical processing on the sample data according to the decrypted global statistical value set, and perform model training according to the processed sample data.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the data processing method for cross-sample federated learning according to any one of claims 1 to 7 is implemented.
11. An electronic device, characterized in that: include: one or more processors; A storage device for storing one or more programs, which, when executed by the one or more processors, enables the one or more processors to implement the data processing method for cross-sample federated learning as described in any one of claims 1 to 7.
Citation Information
Patent Citations
Credit risk control system and method based on federation mode
CN111461874A
Cross-sample feature selection method in federated learning system and federated learning system
CN113537361A