Data processing method, device, equipment and storage medium of federated learning model

By constructing and inputting model inputs of multiple subsets of features, the contribution information of each feature in the federated learning model is solved, and the problem of the inability to specifically explain the impact of single sample and partner characteristics in the existing technology is realized. The precise measurement of the contribution information of the second participant.

CN113326948BActive Publication Date: 2025-02-07WEBANK (CHINA)
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202110610449.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-06-01
Publication Date
2025-02-07
Estimated Expiration
2041-06-01

AI Technical Summary

Technical Problem

The existing federated learning model interpretation scheme cannot specifically explain a single sample, and it is impossible to determine the positive and negative effects of partner characteristics on model output.

Method used

By obtaining the feature set of training samples of the federated learning model, construct model inputs of multiple subsets of features and input them into the federated learning model to obtain the prediction results. Based on these prediction results and target prediction results, the contribution information of each feature to the target prediction results is calculated.

Benefits of technology

The accurate measurement of the contribution information of each feature in a single sample is achieved, and the contribution information of the second participant can be measured, improving the interpretability of the federated learning model.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113326948B_ABST
    Figure CN113326948B_ABST
Patent Text Reader

Abstract

The present application provides a method and device for processing data of a federated learning model, which is applied to a first participant device; the method includes: obtaining a feature set used as a training sample of the federated learning model, the feature set including: features provided by the first participant with label information, and features provided by at least one second participant; obtaining multiple feature subsets included in the feature set, and constructing a model input of the federated learning model corresponding to each feature subset; inputting each constructed model input into the federated learning model respectively, obtaining a prediction result corresponding to each model input, and inputting the training sample into the federated learning model, obtaining a target prediction result corresponding to the training sample; based on each prediction result and the target prediction result obtained, determining the contribution information of each feature in the feature set corresponding to the target prediction result. Through the present application, the contribution information of each feature in a single sample and the contribution information of the second participant can be accurately measured.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to artificial intelligence technology, and in particular to a data processing method, device, electronic device and computer-readable storage medium for a federated learning model. Background Art

[0002] As all industries gradually strengthen data privacy protection, federated learning, a technology that can coordinate multi-party data to establish machine learning while protecting data privacy, has become one of the keys to cooperation between enterprises and industries.

[0003] In the fields of finance and risk control, users of federated machine learning models often want to know the positive and negative impact of each feature in a single model input on the model output. For example, for a specific sample (for example, a defaulting customer), which specific feature and which values ​​of the feature have an important impact on determining that the user is a defaulting user. In addition, it is also necessary to determine the positive and negative impact of the features provided by the partner on the model output. Therefore, the interpretability of federated machine learning models is particularly important.

[0004] The explanation scheme of the related federated learning model explains the model as a whole by obtaining the feature importance, but cannot explain a single sample specifically. In addition, although the feature importance can be used to know how many times the partner's feature is used, the positive and negative impact of the partner's feature on the model output is also unknown. Summary of the invention

[0005] The embodiments of the present application provide a data processing method, device, electronic device, computer-readable storage medium, and computer program product of a federated learning model, which can measure the contribution information of each feature in a single sample.

[0006] The technical solution of the embodiment of the present application is implemented as follows:

[0007] The present application embodiment provides a data processing method for a federated learning model, including:

[0008] Acquire a feature set used as a training sample of a federated learning model, the feature set comprising: features provided by a first participant having label information, and features provided by at least one second participant;

[0009] Acquire multiple feature subsets included in the feature set, and construct a model input of the federated learning model corresponding to each of the feature subsets;

[0010] Inputting each of the constructed model inputs into the federated learning model to obtain prediction results corresponding to each of the model inputs, and inputting the training samples into the federated learning model to obtain target prediction results corresponding to the training samples;

[0011] Based on the obtained prediction results and the target prediction result, the contribution information of each feature in the feature set corresponding to the target prediction result is determined. The present application embodiment provides a data processing device of a federated learning model, comprising:

[0012] An acquisition module, used to acquire a feature set used as a training sample of a federated learning model, the feature set comprising: features provided by a first participant with label information, and features provided by at least one second participant;

[0013] A construction module, used to obtain multiple feature subsets included in the feature set, and construct a model input of the federated learning model corresponding to each of the feature subsets;

[0014] A prediction module, used to input each of the constructed model inputs into the federated learning model to obtain a prediction result corresponding to each of the model inputs, and input the training sample into the federated learning model to obtain a target prediction result corresponding to the training sample;

[0015] A calculation module is used to determine the contribution information of each feature in the feature set corresponding to the target prediction result based on the obtained prediction results and the target prediction result.

[0016] In the above solution, the construction module is also used to determine the intersection of each of the feature subsets and the feature set respectively;

[0017] Based on the intersection of each of the feature subsets and the feature set, determining the missing features of each of the feature subsets, wherein the missing features refer to the features that are distinguished between the intersection and the feature set;

[0018] The missing features are filled in each of the feature subsets respectively to obtain the model input of the federated learning model corresponding to each of the feature subsets.

[0019] In the above scheme, the construction module is also used to determine the default value corresponding to each of the missing features;

[0020] The default values ​​corresponding to the corresponding missing features are filled in each of the feature subsets respectively to obtain the model input of the federated learning model corresponding to each of the feature subsets.

[0021] In the above solution, the construction module is further used to perform the following processing for each of the feature subsets:

[0022] Determine the value range corresponding to the missing features of the feature subset;

[0023] Performing multiple random sampling on the missing feature within the value range to obtain multiple random values ​​corresponding to the missing feature;

[0024] The multiple random values ​​are filled into the feature subsets respectively to obtain multiple model inputs of the federated learning model corresponding to the feature subsets.

[0025] In the above scheme, the construction module is also used to input the multiple model inputs into the federated learning model respectively to obtain multiple initial prediction results;

[0026] An average value of the multiple initial prediction results is obtained, and the average value is used as the prediction result of the feature subset.

[0027] In the above scheme, the construction module is also used to obtain a sample set of the federated learning model;

[0028] The following processing is performed for each of the feature subsets:

[0029] Obtaining feature values ​​corresponding to the missing features of the feature subset in each sample of the sample set;

[0030] Determining a target value corresponding to the missing feature based on a feature value corresponding to the missing feature in each of the samples;

[0031] Fill the target values ​​corresponding to the corresponding missing features in the feature subset to obtain the model input of the federated learning model corresponding to the feature subset.

[0032] In the above solution, the calculation module is further used to traverse each feature in the feature set, and perform the following operations for each feature:

[0033] When the feature is a missing feature, determining at least one feature subset corresponding to the feature;

[0034] For each feature subset corresponding to the feature, based on the corresponding prediction result and the target prediction result, determine the marginal contribution value of the feature corresponding to the target prediction result;

[0035] Based on the marginal contribution value, contribution information of the feature corresponding to the target prediction result is determined.

[0036] In the above scheme, the calculation module is further used to sum the multiple marginal contribution values ​​when there are multiple marginal contribution values ​​to obtain the total contribution value of the feature corresponding to the target prediction result,

[0037] The total contribution value is used as the contribution information of the feature to the target prediction result.

[0038] An embodiment of the present application provides an electronic device, including:

[0039] A memory for storing executable instructions;

[0040] The processor is used to implement the data processing method of the federated learning model provided in the embodiment of the present application when executing the executable instructions stored in the memory.

[0041] An embodiment of the present application provides a computer-readable storage medium storing executable instructions for causing a processor to execute and implement the data processing method of the federated learning model provided in the embodiment of the present application.

[0042] An embodiment of the present application provides a computer program product, including a computer program, which, when executed by a processor, implements the data processing method of the federated learning model provided in the embodiment of the present application.

[0043] The embodiments of the present application have the following beneficial effects:

[0044] Compared with the technology of interpreting the machine learning model by using the feature importance output by the federated tree model in the related federated learning scenario, the data processing method of the federated learning model provided in the embodiment of the present application is applicable to the federated learning scenario, and the first participant device in the federated learning model obtains a feature set used as a training sample of the federated learning model, wherein the feature set includes: features provided by the first participant with label information, and features provided by at least one second participant; obtains multiple feature subsets included in the feature set, and constructs the model input of the federated learning model corresponding to each feature subset; inputs each constructed model input into the federated learning model respectively, obtains the prediction result corresponding to each model input, and inputs the training sample into the federated learning model, obtains the target prediction result corresponding to the training sample; based on the obtained prediction results and the target prediction result, determines the contribution information of each feature in the feature set corresponding to the target prediction result. Based on this, the contribution information of each feature in a single training sample can be accurately measured. BRIEF DESCRIPTION OF THE DRAWINGS

[0045] Figure 1 It is an optional architectural diagram of a data processing system of a federated learning model provided in an embodiment of the present application;

[0046] Figure 2 is an optional structural diagram of an electronic device provided in an embodiment of the present application;

[0047] Figure 3 It is an optional flowchart of the data processing method of the federated learning model provided in the embodiment of the present application;

[0048] Figure 4It is a data processing schematic diagram of the federated learning model provided in the embodiment of the present application;

[0049] Figure 5 It is an optional flowchart of the data processing method of the federated learning model provided in the embodiment of the present application;

[0050] Figure 6 It is an optional flow chart of the data processing method of the federated learning model provided in the embodiment of the present application. DETAILED DESCRIPTION

[0051] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application will be further described in detail below in conjunction with the accompanying drawings. The described embodiments should not be regarded as limiting the present application. All other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of this application.

[0052] In the following description, reference is made to “some embodiments”, which describe a subset of all possible embodiments, but it will be understood that “some embodiments” may be the same subset or different subsets of all possible embodiments and may be combined with each other without conflict.

[0053] If similar descriptions of "first / second" appear in the application documents, the following instructions are added. In the following description, the terms "first\second\third" involved are merely used to distinguish similar objects and do not represent a specific ordering of the objects. It can be understood that "first\second\third" can be interchanged in a specific order or sequence where permitted, so that the embodiments of the present application described herein can be implemented in an order other than that illustrated or described herein.

[0054] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.

[0055] Before further describing the embodiments of the present application in detail, the nouns and terms involved in the embodiments of the present application are explained. The nouns and terms involved in the embodiments of the present application are subject to the following interpretations.

[0056] 1) SHAP (SHapley Additive exPlanation) value: A model-independent interpretability analysis method based on collaborative game theory. Each prediction record has a corresponding shap value, and each feature also has its corresponding shap value. When the shap value is greater than 0, it means that the current feature in the current sample pushes the model prediction result in the positive direction, otherwise it pushes it in the negative direction.

[0057] 2) Mode: refers to the value with a clear central trend point in the statistical distribution, representing the general level of the data. It is also the value that appears most frequently in a set of data. Sometimes there are several modes in a set of numbers, represented by M.

[0058] 3) Median: Also known as the middle value, a special term in statistics. It is the number in the middle of a set of data arranged in order. It represents a value in a sample, population or probability distribution, which can divide the set of values ​​into two equal parts. For a finite set of numbers, you can sort all the observed values ​​and find the one in the middle as the median. If there is an even number of observed values, the average of the two middle values ​​is usually taken as the median.

[0059] The embodiments of the present application provide a data processing method, device, electronic device, computer-readable storage medium and computer program product of a federated learning model, which can accurately measure the contribution information of each feature in a single sample and measure the contribution information of a second participant.

[0060] Based on the above explanations of the nouns and terms involved in the embodiments of the present application, the data processing system of the federated learning model provided in the embodiments of the present application is first described. Figure 1 , Figure 1 It is an optional architectural diagram of a data processing system of a federated learning model provided in an embodiment of the present application. In the data processing system 100 of the federated learning model, a first participant device 400 and a second participant device 410 are included (two second participant devices are shown as examples, respectively denoted as 410-1 and terminal 410-2, for distinction). The first participant device 400 and the second participant device 410 are interconnected through a network 300 and connected to a parameter aggregation device 200 through the network 300. The network 300 can be a wide area network or a local area network, or a combination of the two, and data transmission is achieved using a wireless link.

[0061] In some embodiments, the first participant device 400 and the second participant device 410 are connected to each other via the network 300, and third-party devices (collaborators, servers, etc.) that may be involved in the federated learning model may be connected via the network 300.

[0062] In some embodiments, the first participant device 400 and the second participant device 410 can be a laptop, a tablet computer, a desktop computer, a smart phone, a dedicated messaging device, a portable gaming device, a smart speaker, a smart watch, etc., or a client terminal of a federated learning participant, such as a participant device of each bank or financial institution that stores user feature data, but is not limited to this. The first participant device 400 and the second participant device 410 can also be an independent physical server, or a server cluster or distributed system composed of multiple physical servers, or a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (CDN, Content Delivery Network), and big data and artificial intelligence platforms, etc., to assist each participant device in performing federated learning to obtain a federated learning model. The network 300 can be a wide area network or a local area network, or a combination of the two. The first participant device 400 and the second participant device 410 can be directly or indirectly connected by wired or wireless communication, which is not limited in the embodiments of the present application.

[0063] The first participant device 400 is used to obtain a feature set used as a training sample for a federated learning model, the feature set including: features provided by the first participant with label information, and features provided by at least one second participant; obtain multiple feature subsets included in the feature set, and construct model inputs of the federated learning model corresponding to each feature subset; input each constructed model input into the federated learning model respectively to obtain a prediction result corresponding to each model input, and input the training sample into the federated learning model to obtain a target prediction result corresponding to the training sample; based on the obtained prediction results and target prediction results, determine the contribution information of each feature in the feature set corresponding to the target prediction result.

[0064] The second participant device 410 is used to determine the local model input corresponding to the feature subset when receiving the notification message sent by the first participant device 400, and send the local model input to the first participant device 400, so that the first participant device 400 constructs the model input of the federated learning model corresponding to the current feature subset.

[0065] See also Figure 2 , Figure 2 is an optional structural diagram of an electronic device provided in an embodiment of the present application. In practical applications, the electronic device 500 can be implemented as Figure 1 The first participant device 400 or the second participant device 410 in the embodiment of the present invention is an electronic device. Figure 1Taking the first participant device 400 shown as an example, an electronic device for implementing the data processing method of the federated learning model of an embodiment of the present application is described. Figure 2 The electronic device 500 shown includes: at least one processor 510, a memory 550, at least one network interface 520 and a user interface 530. The various components in the electronic device 500 are coupled together via a bus system 540. It can be understood that the bus system 540 is used to achieve connection and communication between these components. In addition to the data bus, the bus system 540 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, the bus system 540 is not described in detail. Figure 2 Various buses are labeled as bus system 540 .

[0066] The processor 510 can be an integrated circuit chip with signal processing capabilities, such as a general-purpose processor, a digital signal processor (DSP), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc., where the general-purpose processor can be a microprocessor or any conventional processor, etc.

[0067] The user interface 530 includes one or more output devices 531 that enable presentation of media content, including one or more speakers and / or one or more visual display screens. The user interface 530 also includes one or more input devices 532, including user interface components that facilitate user input, such as a keyboard, mouse, microphone, touch screen display, camera, other input buttons and controls.

[0068] The memory 550 may be removable, non-removable, or a combination thereof. Exemplary hardware devices include solid-state memory, hard disk drives, optical disk drives, etc. The memory 550 may optionally include one or more storage devices that are physically remote from the processor 510.

[0069] The memory 550 includes a volatile memory or a non-volatile memory, and may also include both volatile and non-volatile memories. The non-volatile memory may be a read-only memory (ROM), and the volatile memory may be a random access memory (RAM). The memory 550 described in the embodiments of the present application is intended to include any suitable type of memory.

[0070] In some embodiments, the memory 550 can store data to support various operations, examples of which include programs, modules, and data structures, or a subset or superset thereof, as exemplarily described below.

[0071] Operating system 551, including system programs for processing various basic system services and performing hardware-related tasks, such as framework layer, core library layer, driver layer, etc., for implementing various basic services and processing hardware-based tasks;

[0072] A network communication module 552, for reaching other computing devices via one or more (wired or wireless) network interfaces 520, exemplary network interfaces 520 include: Bluetooth, Wireless Compatibility Certification (WiFi), and Universal Serial Bus (USB);

[0073] a presentation module 553 for enabling presentation of information via one or more output devices 531 (e.g., display screen, speaker, etc.) associated with the user interface 530 (e.g., a user interface for operating peripherals and displaying content and information);

[0074] The input processing module 554 is used to detect one or more user inputs or interactions from one of the one or more input devices 532 and translate the detected inputs or interactions.

[0075] In some embodiments, the data processing device of the federated learning model provided in the embodiments of the present application can be implemented in software. Figure 2 The data processing device 555 of the federated learning model stored in the memory 550 is shown, which can be software in the form of programs and plug-ins, including the following software modules: acquisition module 5551, construction module 5552, prediction module 5553 and calculation module 5554. These modules are logical, so they can be arbitrarily combined or further split according to the functions implemented. The functions of each module will be explained below.

[0076] In other embodiments, the data processing device of the federated learning model provided in the embodiments of the present application can be implemented in hardware. As an example, the data processing device of the federated learning model provided in the embodiments of the present application can be a processor in the form of a hardware decoding processor, which is programmed to execute the data processing method of the federated learning model provided in the embodiments of the present application. For example, the processor in the form of a hardware decoding processor can adopt one or more application-specific integrated circuits (ASICs), DSPs, programmable logic devices (PLDs), complex programmable logic devices (CPLDs), field-programmable gate arrays (FPGAs) or other electronic components.

[0077] The data processing method of the federated learning model provided in the embodiment of the present application will be described in combination with the exemplary application and implementation of the first participant device provided in the embodiment of the present application, and the method is applied to the first participant device. Figure 3 , Figure 3 This is an optional flow chart of the data processing method of the federated learning model provided in the embodiment of the present application, which will be combined with Figure 3 The steps shown are explained.

[0078] In step 101, a first participant device obtains a feature set used as a training sample of a federated learning model, where the feature set includes: features provided by the first participant with label information, and features provided by at least one second participant.

[0079] Here, in the federated learning model, there are generally at least two participants, of which the first participant has label information, also known as the active party, represented by Guest; the second participant is the feature provider, represented by Host. The method provided in the embodiment of the present application is applicable to a federated learning model in which one Guest party and at least one Host party participate.

[0080] Take a guest and a host as an example. In a single training sample, the guest and the host each hold some features, where the guest provides G_1, G_2, G_3, ..., G_n, a total of n features, n is a positive integer greater than 0; the host provides H_1, H_2, H_3, ..., H_m, a total of m features, m is a positive integer greater than 0. It can be understood that the feature set of a single training sample contains a total of n+m features, {G_1, G_2, G_3, ..., G_n, H_1, H_2, H_3, ..., H_m}.

[0081] In step 102, multiple feature subsets included in the feature set are obtained, and a model input of a federated learning model corresponding to each feature subset is constructed.

[0082] Here, when the Guest provides G_1, G_2, G_3, ..., G_n, a total of n features, and the Host provides H_1, H_2, H_3, ..., H_m, a total of m features, that is, there are n+m features in a training sample data. These n+m features are combined to obtain the corresponding feature subset. The number of features in the feature subset ranges from 0 to n+m. When the number of features is 0, the feature subset is an empty set. When the number of features is n+m, the feature subset is a full set. The number of feature subsets N, N is calculated as follows:

[0083]

[0084] In the above formula (1), n+m is the number of features, Indicates the number of feature subsets containing 0 features (that is, the number of empty sets is 1), represents the number of feature subsets containing 1 feature, Indicates the number of feature subsets containing n+m features (i.e., the number of the full set is 1).

[0085] It should be noted that in the federated learning model, in order to protect the privacy of the data of each participant, the host's features are usually not directly transmitted to the guest, but the corresponding intermediate information (such as model parameters, etc.) is transmitted between the participants in an encrypted manner. Therefore, when calculating the impact of the host on the prediction results (the output results of the federated learning model), the overall impact of the host is usually determined, that is, all the features provided by the host are regarded as an overall feature, which can be called a federated feature, denoted as host_feat. By determining the impact of the federated features on the prediction results and the positive or negative impact, the overall impact of the corresponding host and the positive or negative impact of the overall impact are determined. Among them, the positive or negative impact refers to whether the impact is positive or negative.

[0086] When interpreting a single training sample corresponding to the federated learning model, the feature provided by the host is taken as a federated feature host_feat. The n+m features in the aforementioned single sample can be regarded as n+s features, where n is the number of features provided by the guest, and s represents the s federated features host_feat corresponding to s hosts (i.e., one host_feat represents one host), where s is a positive integer greater than 0, s=1, indicating that there is only one host; if s=2, it means that there are two hosts.

[0087] In some embodiments, interpreting a single training sample actually determines the impact of each feature in the single sample on the target prediction result, where the target prediction result refers to the prediction result obtained by the training sample through the federated learning model. In actual implementation, it is usually necessary to construct the data to be interpreted corresponding to the single training sample, where the data to be interpreted includes one or more samples to be interpreted, and the samples to be interpreted include one or more sample features (each sample feature comes from the features in the training sample), and in each sample to be interpreted, each sample feature corresponds to a sample feature value.

[0088] The acquisition of the sample to be explained is explained. From the above description, it can be seen that the sample to be explained contains one or more features in the training sample. Therefore, the sample to be explained can be regarded as multiple feature subsets constructed based on the feature set in the training sample, that is, one feature subset corresponds to a sample to be explained.

[0089] For example, in a federated learning model, a guest and a host participate in the calculation. For a training sample containing n+m features, n is the feature provided by the guest, and m is the number of features on the host. For this training sample, in order to ensure data security, the m features provided by the host are replaced with a host_feat feature. Then, there are a total of n+1 features. For these n+1 features, the data to be interpreted is constructed. According to the above formula (1), the n+1 features are combined and calculated to obtain 2 n+1 feature subsets, that is, the data to be explained contains 2 n+1 Sample item to be explained.

[0090] The obtained data to be explained is input into the federated learning model to obtain the corresponding prediction results (model output). Since the model input of the federated learning model needs to include all the features provided by the Guest and Host parties, it is necessary to supplement the features of the samples to be explained with incomplete features in the data to be explained (that is, to supplement the missing features in the samples to be explained) to obtain the complete model input corresponding to the samples to be explained (fill in the missing features in the feature subset to build a complete model input).

[0091] In some embodiments, when constructing a model input using a feature subset, it is first necessary to determine the missing features in the feature subset, and then fill in the missing features to obtain a model input containing features with the same meaning as those in the training sample. Specifically, the intersection of each of the feature subsets and the feature set is determined respectively; based on the intersection of each of the feature subsets and the feature set, the missing features of each of the feature subsets are determined, and the missing features refer to the features that distinguish the intersection from the feature set; the missing features are filled in each of the feature subsets respectively, and the model input of the federated learning model corresponding to each of the feature subsets is obtained.

[0092] For example, a training sample S {age: 28, education: undergraduate, income: 10000, work: IT}, the prediction result obtained by inputting the sample into the federated learning model indicates that the customer is a defaulting customer, wherein the feature {age: 28, education: undergraduate} is provided by the Guest, and the feature {income: 10000, work: IT} is provided by the Host, and the actual number of features included is 4. In practical applications, in order to ensure the security of the Host's data, the feature {income: 10000, work: IT} is usually regarded as a host_feat feature. Then the data to be explained corresponding to the training sample contains 2 features {age: 28, education: undergraduate} provided by the Guest, and a host_feat feature, for a total of 3 features. The sample to be explained corresponding to the data to be explained contains 0 to 3 features, for a total of 8 (2 3) samples to be explained, specifically: empty set, {age: 28}, {education: undergraduate}, {host_feat: {income: 10000, work: IT}}, {age: 28, education: undergraduate}, {age: 28, host_feat: {income: 10000, work: IT}}, {education: undergraduate, host_feat: {income: 10000, work: IT}}, {age: 28, education: undergraduate, host_feat: {income: 10000, work: IT}}. Input the above samples to be explained (feature subsets) into the federated learning model to obtain the corresponding prediction results. Since the model input of the federated learning model requires complete feature information, it is necessary to confirm the missing features in each sample to be explained. For example, the missing features of the sample to be explained (feature subset) {age: 28} are age and host_feat; the missing features of the sample to be explained {host_feat: {income: 10000, work: IT}} are age and education.

[0093] The method of filling missing features is explained. After determining the missing features of each sample to be explained (feature subset), it is necessary to further determine the feature value corresponding to the missing feature. In some embodiments, the default value of the missing feature can be set according to the actual situation, that is, a fixed value is used as the default value of the missing feature. For example, if the missing feature in the feature subset is age, the fixed value 18 is directly used as the default value corresponding to the feature age, that is, {age = 18} is filled in the feature subset to obtain the model input corresponding to the feature subset. Specifically, determine the default value corresponding to each missing feature; fill the default value corresponding to the corresponding missing feature in each feature subset, and obtain the model input of the federated learning model corresponding to each feature subset.

[0094] In some embodiments, for filling the missing features in each feature subset, the actual feature values ​​corresponding to the missing features in multiple training samples can be used, and the corresponding average, mode or median of these actual feature values ​​can be obtained, and the obtained average, mode or median is used as the filling feature value (or target value) of the current missing feature. Specifically, a sample set of the federated learning model is obtained; the following processing is performed for each of the feature subsets: the feature values ​​corresponding to the missing features of the feature subset in each sample of the sample set are obtained; based on the feature values ​​corresponding to the missing features in each sample, the target value corresponding to the missing features is determined; the target value corresponding to the corresponding missing features is filled in the feature subset, and the model input of the federated learning model corresponding to the feature subset is obtained.

[0095] For example, the training sample contains a feature set {income = 100, age = 20, height = 170}, and there is a feature subset {age = 20, height = 170}, where the missing feature is income. The machine learning model cannot predict the sample corresponding to the current feature subset (because the feature information is incomplete), and the feature "income" needs to be supplemented. In actual implementation, the mean / mode / median of "income" (these data can be calculated from the training data) can be used to fill it, and the predicted value of the filled sample is used as an estimate of the model output average value. From the training sample set, the average value of the feature "income" is calculated to be 50, the average value of the feature "height" is calculated to be 150, and the average value of the feature "age" is calculated to be 15. Then, {income = 50} can be used to fill the feature subset {age = 20, height = 170}, and the corresponding filled sample {age = 20, height = 170, income = 50} is obtained, and the prediction result of the feature subset {age = 20, height = 170} is determined. That is, the padded sample {age = 20, height = 170, income = 50} is used as the corresponding model input, input into the machine learning model (federated learning model f), and the corresponding prediction result (model output) is obtained, that is, f_x({age = 20, height = 170}) = f({age = 20, height = 170, income = 50}). Alternatively, for the feature subset {age = 20}, the missing features are height and income, and the feature subset is padded with height = 150 and income = 50 to obtain the padded sample {age = 20, height = 150, income = 50}, and the prediction result of the corresponding feature subset {age = 20} is obtained, that is, f_x({age = 20}) = f({age = 20, height = 150, income = 50}). In addition, if the feature subset is an empty set, the output value of f_x is the average of the prediction scores of all training samples.

[0096] In some embodiments, for each feature subset, a preset number of sampling times can be performed within the range of possible values ​​of the missing feature to obtain multiple synthetic samples corresponding to the current feature subset (i.e., multiple synthetic samples are constructed for each feature subset). Then, the multiple synthetic samples are input into a machine learning model (such as a federated machine learning model) to obtain the model output (initial prediction result) corresponding to each synthetic sample, and the average value of the initial prediction results corresponding to the multiple synthetic samples is obtained as the prediction result corresponding to the current feature subset. Specifically, the following processing is performed for each of the feature subsets: determining the value range corresponding to the missing feature of the feature subset; performing multiple random sampling on the missing feature within the value range to obtain multiple random values ​​corresponding to the missing feature; filling the multiple random values ​​into the feature subset respectively to obtain multiple model inputs of the federated learning model corresponding to the feature subset. Then, the multiple model inputs are respectively input into the federated learning model to obtain multiple initial prediction results; obtaining the average value of the multiple initial prediction results, and using the average value as the prediction result of the feature subset.

[0097] For example, assuming that the age range is 10-30, the height range is 150-180, the preset sampling number is 5, and the prediction result of f_x({income=100}) is calculated. By randomly sampling all the training samples of the model, 5 samples are constructed, and the missing features age and height of the feature subset are randomly sampled to obtain constructed synthetic samples s1 = {age = 15, height = 160, income = 100}, s2 = {age = 21, height = 164, income = 100}, s3 = {age = 29, height = 175, income = 100}, s4 = {age = 25, height = 155, income = 100}, s5 = {age = 28, height = 180, income = 100}. Through the machine learning model f, the model output (initial prediction results) corresponding to the synthetic samples s1, s2, s3, s4, and s5 are obtained, and the average of the 5 initial prediction results is obtained as the prediction result of the feature subset {income = 100}. That is, f_x({income=100})=[f(s1)+f(s2)+f(s3)+f(s4)+f(s5)] / 5.

[0098] In some embodiments, when the missing feature in the feature subset is the federated feature host_feat corresponding to the Host, the first participant (Guest) sends a notification message to the Host to inform the Host to fill in the features provided by itself. Specifically, when the missing feature in the feature subset is the feature of the second participant, a notification message is sent to the second participant so that the second participant fills in its own features to construct the second sub-model input corresponding to the feature of the second participant; based on the first sub-model input constructed by the first participant based on its own features and the received second sub-model input, the model input of the federated learning model corresponding to each of the feature subsets is constructed.

[0099] In actual implementation, all features provided by the second participant (Host) are regarded as a federal feature host_feat. When the missing feature in the feature subset is for the federal feature host_feat, the Guest notifies the Host through network communication, and the Host fills all local features in the way of filling the aforementioned missing features to obtain the sub-model input corresponding to the current feature subset. It can be understood that the feature values ​​corresponding to all features of the Host are not the actual values ​​in the training samples. The Guest integrates the sub-model input corresponding to the features provided by the Host to obtain the model input of the federated learning model corresponding to the current feature subset.

[0100] For example, a training sample S {age: 28, education: undergraduate, income: 10000, work: IT}, the feature {age: 28, education: undergraduate} is provided by the Guest, and the feature {income: 10000, work: IT} is provided by the Host. Then the data to be explained corresponding to the training sample includes two features {age: 28, education: undergraduate} provided by the Guest, and a feature {host_feat: {income: 10000, work: IT}}, where the missing feature in the feature subset {age: 28, education: undergraduate} is the host_feat feature corresponding to the Host. At this time, the Guest sends a notification message to the Host, and after receiving the notification message, the Host fills in its own provided features "income" and "work".

[0101] In step 103, each constructed model input is input into the federated learning model respectively to obtain the prediction result corresponding to each model input, and the training sample is input into the federated learning model to obtain the target prediction result corresponding to the training sample.

[0102] Here, the missing features in each feature subset corresponding to a single training sample are filled, multiple model inputs (i.e., filled samples) containing complete features are constructed, and the prediction results corresponding to each model input are obtained through the federated learning model. It should be noted that a single training sample corresponds to multiple filled samples, and the number of filled samples is related to the number of feature subsets corresponding to the feature set in the training sample.

[0103] For example, there is a federated learning model f, a training sample X, and the corresponding target prediction result is f(X). X contains n+m features, n features are provided by the Guest (one), and m features are provided by the Host (one). In order to ensure the security of the Host data, the m features provided by the Host are regarded as a whole host_feat feature, which is equivalent to n+1 features. Corresponding to this n+1 feature, there are at most 2 n+1 feature subsets (including empty sets and full sets, where the full set is the training sample itself). Fill in the missing features in each feature subset to obtain the filled samples X1, X2, ... corresponding to each feature subset. Input each filled sample into the federated learning model to obtain the corresponding prediction results, recorded as f_x(X1), f_x(X2), ...

[0104] In step 104, based on the obtained prediction results and the target prediction result, the contribution information of each feature in the feature set corresponding to the target prediction result is determined.

[0105] Here, the contribution information of each feature corresponding to the target prediction result means that when the feature is provided by the first participant (Guest), the contribution information is used to characterize the feature contribution value of the feature value corresponding to the feature to the target prediction result; when the feature is the federated feature (host_feat) corresponding to the second participant (Host), the contribution information is used to characterize the overall contribution value of the second participant (host) to the target prediction result. That is, the contribution information of each host_feat corresponding to the target prediction result is used to reflect the overall contribution of each host to the target prediction result.

[0106] In actual implementation, SHAP is usually combined to reflect the impact of each feature in a single sample on the target prediction result and determine the positive or negative impact. The specific idea of ​​SHAP is to calculate the contribution of each feature in a single training sample to the target prediction result.

[0107] First, let's explain the knowledge related to SHAP. SHAP value is a machine learning model interpretation scheme based on Shapley value (Shapley). Let's explain Shapely value. Shapely value is a method in game theory to measure the contribution of each participant (such as multiple companies). It calculates the contribution of each participant (total contribution) by calculating the contribution made by each participant when joining a subset of participants that does not include itself:

[0108]

[0109] Among them, {x1,…,x p} is the set of all input features, p is the number of all input features, {x1,…,x p}\{x j} does not include x j is the possible set of all input features, val is a valuation function, val(S) is the prediction result of feature subset S, |S| is the number of features in feature subset S, φ j (val) refers to the final calculated feature x j The Shapley value (SHAP value) of .

[0110] The weight (weighting factor) in formula (2) The following instructions are given:

[0111] Denominator: There are p combinations of p features in any order.

[0112] Numerator: After determining the feature subset S, p features have |S|! (p-|S|-1)! combinations in a specific order. After determining the feature subset S, the feature set should be {x1,...,x |s| ,x j ,x |s|+2 ,...,x p}, subset S{x1,...,x |s|} itself has |S|! In order, it must be followed by feature j, then the remaining features {χ |S|+2 ,...,χ p}, there are (p-|S|-1)! combinations. After determining the subset S, there are |S|! (p-|S|-1)! combinations.

[0113] so, is the proportion of feature combinations of subset S, and the sum of the proportions of feature combinations of all possible subsets S is equal to 1.

[0114] For example, suppose there are companies 1, 2, and 3, which work together and make a total profit of 1.2 million. The Shapely value is calculated for each company.

[0115] 1) Enumerate all subsets: {1, 2, 3}, {1, 2}, {2, 3}, {1, 3}, {1}, {2}, {3}, empty set.

[0116] 2) Add each company to the subset that does not include itself and calculate their respective marginal contributions, assuming that:

[0117] v(empty set) = 0, v in the above figure is the valuation function val; v{1} can be understood as, when there is only company 1, the income is 0 yuan; v{2, 3} can be understood as, when only companies 2 and 3 cooperate, the income is 700,000 yuan.

[0118] For company 1, according to the above formula, add company 1 to the subsets that do not include itself, and calculate the marginal contribution (also known as marginal benefit) in each feature subset. The specific calculation method is as follows:

[0119] Company 1 joins the subset {2, 3}, and its marginal contribution is: 2 / 6*{v{1,2,3}-v{2,3}}=100 / 6;

[0120] Company 1 joins subset {3}, and its marginal contribution is: 1 / 6*{v{1,3}-v{3}}=80 / 6;

[0121] Company 1 joins subset {2}, and its marginal contribution is: 1 / 6*{v{1,2}-v{2}}=90 / 6;

[0122] Company 1 is added to the empty set, and its marginal contribution is: 0;

[0123] Therefore, the total contribution value (Shapely value) of Company 1 to the total profit of 1.2 million is: 270 / 6=45 million.

[0124] Similarly, formula (2) can be used to calculate that the contributions of companies 2 and 3 are 40W and 35W respectively.

[0125] The SHAP value in the embodiment of the present application can be understood as a variant of the Shapely value, which is used to measure the contribution of the feature value corresponding to a certain feature to the target prediction result (model output), specifically:

[0126] Through formula (2), i.e., the SHAP calculation formula, the contribution value of the feature value of each feature to the target prediction result is calculated in parallel, which can also be called marginal contribution or marginal benefit.

[0127] Specifically, each feature in the feature set is traversed, and the following operations are performed for each feature: when the feature is a missing feature, at least one feature subset corresponding to the feature is determined; for each feature subset corresponding to the feature, based on the corresponding prediction result and the target prediction result, the marginal contribution value of the feature corresponding to the target prediction result is determined; based on the marginal contribution value, the contribution information of the feature corresponding to the target prediction result is determined. When there are multiple marginal contribution values, the multiple marginal contribution values ​​are summed to obtain the total contribution value of the feature corresponding to the target prediction result, and the total contribution value is used as the contribution information of the feature to the target prediction result.

[0128] For example, see Figure 4 , Figure 4 This is a data processing diagram of the federated learning model provided in the embodiment of the present application. Assume that there is a training sample x = {age = 20, height = 170, income = 100}, and a machine learning model f. The prediction score of the sample obtained by f is 1.2. From the training sample set, the average value of the feature "income" = 50, the average value of the feature "height" = 150, and the average value of the feature "age" = 15 are calculated. To calculate the contribution of the feature value {age = 20} to the prediction result value 1.2 of the sample, perform the following operations:

[0129] 1) Enumerate all feature subsets: {age=20, height=170, income=100}, {age=20, height=170}, {age=20, income=100}, {height=170, income=100}, {income=100}, {age=20}, {height=170}, {}.

[0130] 2) Traverse each feature in sample x, add each feature value to the subset that does not contain itself, calculate their respective marginal contributions, and use the valuation function f_x to calculate the prediction results corresponding to each feature subset. Assume that:

[0131] f_x({age=20, height=170, income=100})=1.2;

[0132] f_x({age=20, height=170})=0.9;

[0133] f_x({age=20, income=100})=0.8;

[0134] f_x({height=170, income=100})=0.7;

[0135] f_x({income=100})=0;

[0136] f_x({age=20})=0;

[0137] f_x({height=170})=0;

[0138] f_x({})=0;

[0139] It should be noted that when the feature subset is the full set of features in sample x, the prediction result calculated using the valuation function f_x is the target prediction result obtained by the training sample x through the machine learning model f.

[0140] The feature {age = 20} is added to the feature subset that does not contain itself, and the marginal contribution value is calculated by combining the above formula (2). The process is as follows:

[0141] {Age = 20} is added to the feature subset {Height = 170, Income = 100}, and the marginal contribution value is: 2 / 6*{1.2-0.7}=1 / 6;

[0142] {Age = 20} is added to the feature subset {Income = 100}, and the marginal contribution value is: 1 / 6*{0.8-0}=0.8 / 6;

[0143] {age = 20} is added to the feature subset {age = 20}, and the marginal contribution value is: 1 / 6*{0.9-0}=0.9 / 6;

[0144] {age=20} is added to the empty set to determine the marginal contribution value: 0;

[0145] Sum the marginal contributions obtained above, and the total contribution of the feature {age = 20} is 2.7 / 6 = 0.45;

[0146] Finally, the feature {age = 20} contributes +0.45 to the final prediction score of 1.2. Similarly, the feature {income = 100} contributes +0.35 to the final prediction score of 1.2, and the feature {height = 170} contributes +0.4 to the final prediction score of 1.2. The symbol "+" indicates that the features {age = 20, height = 170, income = 100} have a positive impact on the target prediction result 1.2. If the symbol is "-", it indicates that the feature value corresponding to the feature has a negative impact on the target prediction result.

[0147] The valuation function f_x is explained. In some embodiments, the valuation function f_x is used to correctly reflect the average value of the model output under a certain feature subset. In essence, the prediction result corresponding to the feature subset is still obtained through the machine learning model f. It’s just that the data input into the valuation function is not the training sample corresponding to the machine learning model f, but the aforementioned data based on the feature set of the training sample to obtain multiple samples to be explained contained in the data to be explained, that is, after the missing features are filled with feature values, the filled samples are obtained, and the prediction results are obtained by inputting each filled sample into the machine learning model f, or the output results of multiple machine learning models f are averaged.

[0148] Continuing with the above example, the valuation function f_x is used to obtain the prediction result of the feature subset {age = 20, height = 170}. In fact, the missing feature "income" is filled with the corresponding average value 50 to obtain the corresponding filled sample {age = 20, height = 170, income = 50}, and the filled sample is input into the machine learning model f to obtain the prediction result, that is, f_x({age = 20, height = 170}) = f({age = 20, height = 170, income = 50}) = 0.9.

[0149] In actual implementation, when the feature is provided by the first participant (Guest), the total contribution value is used to characterize the feature contribution value of the feature itself to the target prediction result; when the feature is provided by the second participant (Host), the total contribution value is used to characterize the overall contribution value of the second participant (host) to the target prediction result. The positive or negative value of the total contribution value characterizes the positive or negative value of the contribution (influence) of the current feature to the target prediction result. For example, in the above example, the feature value {age = 20} contributes 0.45 to the final prediction score of 1.2, where 0.45 is a positive value, indicating that the feature value {age = 20} has a positive impact on the prediction result.

[0150] In the embodiment of the present application, the first participant device obtains the feature set of each training sample used as a federated learning model, and obtains multiple feature subsets included in the feature set, wherein when obtaining the feature subset, the feature provided by the second participant is regarded as a federated feature, which can ensure the security of the second participant's data; then constructs the model input of the federated learning model corresponding to each feature subset; inputs each constructed model input into the federated learning model respectively to obtain the prediction result corresponding to each model input, and inputs each training sample into the federated learning model to obtain the target prediction result corresponding to each training sample; based on the obtained prediction results and target prediction results, according to the SHAP calculation formula, determine the contribution information of each feature in the feature set contained in each training sample to the target prediction result. In this way, not only can the scope of application of the method of calculating feature contribution in combination with SHAP be expanded in the federated learning scenario, but also the contribution information of each feature in a single training sample and the contribution information of the second participant can be accurately measured.

[0151] Next, we will continue to introduce the data processing method of the federated learning model provided in the embodiment of the present application. Figure 5 This is an optional flow chart of the data processing method of the federated learning model provided in the embodiment of the present application, see Figure 5 The data processing method of the federated learning model provided in the embodiment of the present application is collaboratively implemented by a first participant device and at least one second participant device.

[0152] Step 201: The first participant device obtains a feature set of training samples used as a federated learning model in response to a received sample interpretation request.

[0153] Here, the first participant receives a sample interpretation request for a training sample, responds to the sample interpretation request, and obtains a (single) training sample. The feature set of the training sample includes: features provided by the first participant with label information, and features provided by at least one second participant. It should be noted that in order to ensure the security of the second participant's data, the features provided by the second participant are regarded as an overall feature host_feat.

[0154] Step 202: determine the intersection of each feature subset and feature set respectively.

[0155] Step 203: Determine the missing features of each feature subset based on the intersection of each feature subset and the feature set.

[0156] Here, missing features refer to the features that are different between the intersection and the feature set, that is, features that exist in the feature set but not in the feature subset.

[0157] Step 204: Send a notification message to the second participant's device.

[0158] Here, since the federated learning model requires the participation of at least one second party, a notification message needs to be sent to the second party device to inform the second party device to send local model input information to the first party in an encrypted manner.

[0159] Step 205: After receiving the notification message, the second participant constructs a local sub-model input of the federated learning model corresponding to the current feature subset.

[0160] Here, when the missing feature is a feature provided by the first participant, the second participant copies the local sub-model input after receiving the notification message; when the missing feature is a feature provided by the second participant, the second participant device uses the feature filling method mentioned in the aforementioned embodiment to fill in its own features and obtain the filled local sub-model input.

[0161] Step 206: The second participant device obtains a local sub-model input corresponding to the feature subset.

[0162] Step 207: The second participant device sends the local sub-model input corresponding to the feature subset to the first participant device in an encrypted manner.

[0163] Step 208: The first participant device integrates the local sub-model input and the sub-model input received from the second participant to determine the model input corresponding to the feature subset.

[0164] In step 209, the first participant device inputs each constructed model input into the federated learning model to obtain a prediction result corresponding to each model input, and inputs the training sample into the federated learning model to obtain a target prediction result corresponding to the training sample.

[0165] Here, after determining the prediction results of the model input corresponding to each feature subset corresponding to the feature set, each feature in the feature set is traversed, and steps 210 to 212 are performed in sequence for each feature in the feature set to obtain the contribution information of each feature to the target prediction result.

[0166] Step 210: When the current feature is a missing feature, determine at least one feature subset corresponding to the current feature.

[0167] Step 211, for each feature subset corresponding to the current feature, based on the corresponding prediction result and the target prediction result, determine the marginal contribution value of the current feature corresponding to the target prediction result.

[0168] Step 212, when there are multiple marginal contribution values, the multiple marginal contribution values ​​are summed to obtain the total contribution value of the target prediction result corresponding to the current feature.

[0169] Here, the total contribution value is taken as the contribution information of the feature to the target prediction result. The positive or negative value of the total contribution information reflects the positive or negative value of the influence of the current feature on the target prediction result.

[0170] Step 213: output contribution information of each feature in the feature set included in the current training sample.

[0171] In the embodiment of the present application, the first participant device obtains the feature set of each training sample used as a federated learning model, and obtains multiple feature subsets included in the feature set, wherein when obtaining the feature subset, the feature provided by the second participant is regarded as a federated feature, which can ensure the security of the second participant's data; then constructs the model input of the federated learning model corresponding to each feature subset; inputs each constructed model input into the federated learning model respectively to obtain the prediction result corresponding to each model input, and inputs each training sample into the federated learning model to obtain the target prediction result corresponding to each training sample; based on the obtained prediction results and target prediction results, according to the SHAP calculation formula, determine the contribution information of each feature in the feature set contained in each training sample to the target prediction result. In this way, not only can the scope of application of the method of calculating feature contribution in combination with SHAP be expanded in the federated learning scenario, but also the contribution information of each feature in a single training sample and the contribution information of the second participant can be accurately measured.

[0172] The following is an explanation of an exemplary application of the embodiments of the present application in a practical application scenario.

[0173] In the fields of finance and risk control, the interpretability of machine learning models often has the following common requirements: 1. Model creators often want to know which features of the input model play an important role in learning?

[0174] 2. For a specific sample (for example, a customer who defaults), what are the specific features and what values ​​of the features have an important effect on his default, a positive impact or a negative impact?

[0175] 3. To what extent do the characteristics of the partners play a role in the modeling process? Is it a positive or negative impact?

[0176] In view of the above three points, the feature importance scheme provided by the relevant vertical federated tree model can meet some of the requirements. Taking a vertical federated tree scenario involving two parties (guest and host) as an example, the feature importance scheme provided by the vertical federated tree model is briefly described as follows:

[0177] (1) The guest initializes a table locally, which contains all the local features of the guest and the anonymous feature numbers sent by the host. The count value of each feature is 0.

[0178] (2) Start building a decision tree. For each split feature used by each decision tree node, add 1 to the corresponding count value in the table, or add the split gain value;

[0179] (3) After the decision tree is built, the feature importance table is output. The feature importance table can be used to explain the model: features with high count values ​​represent features that play a high role in the modeling process.

[0180] However, the feature importance scheme provided by the vertical federated tree model can meet the above requirement 1, but cannot meet the above requirements 2 and 3.

[0181] First, for requirement 2 above, users cannot use feature importance to specifically explain a single sample. For example, there is a sample S {age: 28, marital status: married, income: 10,000, education: undergraduate, work: IT, place of origin: ... and other features}, which is a defaulting customer. The vertical federated learning model is used to predict this sample, and the score obtained is 0.1. Business users want to know how much each specific feature value in sample S (such as age = 28) contributes to the final prediction score of 0.1, and whether the feature has a positive or negative impact on the prediction score. In this way, some business inspiration can be obtained by combining the model with real-life experience.

[0182] It is impossible to judge the impact of a specific feature value on the model output and the positive or negative impact based solely on the obtained feature importance. This is because feature importance only reflects the usage of a global feature and cannot be used to analyze a specific sample.

[0183] Regarding requirement 3 above, although feature importance can tell how many times the partner’s feature is used, the positive and negative impact of the partner’s feature on a single sample is unknown. If the partner’s feature can provide a large impact on many samples, it can be used to measure the value of the partner’s feature.

[0184] In order to solve the problems existing in the above-mentioned related technologies, an embodiment of the present application provides a data processing method for a federated learning model, namely, a longitudinal federated machine learning model interpretation method based on SHAP value. This method combines the characteristics of SHAP value, explains the prediction results of the longitudinal federated learning model in the longitudinal federated learning scenario, and measures the overall feature value of the partner (Host party).

[0185] First, combined with the characteristics of SHAP values, the contribution of each feature in the training sample to the target prediction result is calculated, where the target prediction result refers to the prediction result obtained by inputting the training sample into the longitudinal federated machine learning model.

[0186] Assume that there is a longitudinal federated machine learning model f, and the input training sample X contains features {1, 2, 3, ..., m}, where the feature is replaced by the subscript i, there are m features in total, N is a subset, S is a feature subset that does not contain i, and f_x is an estimation function that returns the average value of the longitudinal federated machine learning model f under the feature subset. The SHAP value calculation formula is consistent with the formula (2) for calculating the Shapely value in the aforementioned embodiment, with only different signs, as follows:

[0187]

[0188] The calculation of SHAP value is explained. For example, suppose there is a sample X = {age = 20, height = 170, income = 100}, sample X is input into the machine learning model f, and the predicted score of sample X is 1.2. It is necessary to calculate the influence (i.e. contribution) of each feature in sample X on the predicted score 1.2, and whether the influence is positive or negative. Take the calculation of the contribution of the feature value {age = 20} corresponding to the feature age to the target predicted result value 1.2 of sample X as an example, the specific process is as follows:

[0189] First, enumerate all feature subsets corresponding to the feature set in sample X: {age = 20, height = 170, income = 100}, {age = 20, height = 170}, {age = 20, income = 100}, {height = 170, income = 100}, {income = 100}, {age = 20}, {height = 170}, {} (this is an empty set).

[0190] Then, traverse each feature in sample X, add each feature to the feature subset that does not contain itself, and calculate their respective marginal contributions according to formula (3). Use the valuation function f_x to calculate the prediction results corresponding to each feature subset. Assume that:

[0191] f_x({age=20, height=170, income=100})=1.2;

[0192] f_x({age=20, height=170})=0.9;

[0193] f_x({age=20, income=100})=0.8;

[0194] f_x({height=170, income=100})=0.7;

[0195] f_x({income=100})=0;

[0196] f_x({age=20})=0;

[0197] f_x({height=170})=0;

[0198] f_x({})=0;

[0199] Add {age=20} to the feature subset that does not include itself, and calculate the marginal contribution value according to the above formula (3), as follows:

[0200] {Age = 20} is added to the feature subset {Height = 170, Income = 100}, and the marginal contribution is: 2 / 6*{1.2-0.7}=1 / 6;

[0201] {Age = 20} is added to the feature subset {Income = 100}, and the marginal contribution is: 1 / 6*{0.8-0}=0.8 / 6;

[0202] {age = 20} is added to the feature subset {age = 20}, and the marginal contribution is: 1 / 6*{0.9-0}=0.9 / 6;

[0203] {age=20} is added to the empty set, and the marginal contribution is: 0;

[0204] The total contribution is 2.7 / 6=0.45;

[0205] Therefore, the feature value {age=20} contributes 0.45 to the final prediction score of 1.2.

[0206] The estimation function f_x mentioned above is explained. When a sample is given and the SHAP value of each feature value is evaluated, a valuation method f_x needs to be determined and used to correctly reflect the average value of the model output (prediction score) under a certain feature subset. Two common solutions are provided:

[0207] Take the sample {age = 20, height = 170, income = 100} as an example, assuming there is a machine learning model f:

[0208] 1) If a feature is missing in the subset, use the feature's mean / mode / median instead

[0209] Assume that there is a feature subset {age = 20, height = 170}. Obviously, without the feature "income", the machine learning model f cannot predict the sample. In practical applications, the feature subset {age = 20, height = 170} can be filled with the mean / mode / median corresponding to the feature "income" (which can be calculated from the training data) to obtain the filled sample {age = 20, height = 170, income = T}, where T is the feature value mean / mode / median corresponding to the feature income, and the predicted value of the filled sample is used as an estimate of the model output average.

[0210] Assume that from the training sample set, the average value of the "income" feature is calculated to be 50, the average value of the "height" feature is calculated to be 150, and the average value of the "age" feature is calculated to be 15. Then: after filling the feature subset {age = 20, height = 170}, the filled sample obtained is {age = 20, height = 170, income = 50}, and

[0211] f_x({age=20, height=170})=f({age=20, height=170, income=50})

[0212] For another example, suppose there is a feature subset {age = 20}, and the feature subset is filled to obtain the filled sample {age = 20, height = 150, income = 50}, and

[0213] f_x({age=20})=f({age=20, height=150, income=50}),

[0214] In addition, if it is an empty set, the output value of f_x is the average of the predicted scores of all training samples.

[0215] 2) If a feature is missing in the subset, it is directly replaced by 0

[0216] For example, assuming that there is a feature subset {age = 20}, the sample is padded with 0 to obtain a padded sample {age = 20, height = 0, income = 0}, and

[0217] f_x({age=20})=f({age=20, height=0, income=0})

[0218] 3) If a feature is missing in the feature subset, multiple sampling is performed within the range of possible values ​​of the missing feature to obtain multiple synthetic samples. The average value of the prediction score of the machine learning model for multiple synthetic samples is the output value of f_x.

[0219] Assume that the age range is 10-30 and the height range is 150-180

[0220] Calculate the predicted value f_x({income=100}) of the feature subset {income=100},

[0221] Suppose that 5 samples are constructed, and the missing features age and height in the feature subset are randomly sampled, and the constructed samples s1 = {age = 15, height = 160, income = 100}, s2 = {age = 21, height = 164, income = 100}, s3 = {age = 29, height = 175, income = 100}, s4 = {age = 25, height = 155, income = 100}, s5 = {age = 28, height = 180, income = 100},

[0222] f_x({income=100})=[f(s1)+f(s2)+f(s3)+f(s4)+f(s5)] / 5.

[0223] Next, the specific process of interpreting samples in combination with SHAP values ​​in the vertical federated learning scenario is explained.

[0224] Execute the data processing method of the federated learning model provided in the embodiment of the present application (vertical federated machine learning model interpretation method based on SHAP value), and input the following information:

[0225] A longitudinal federated learning model f, training data set, and samples to be explained X0, X1, ..., Xn, a total of N items, where the guest and host each hold some features, and uppercase G_i (i is an integer) is used to represent a feature provided by the guest (such as age), and uppercase H_i (i is an integer) is used to represent a feature provided by the host. For example, the guest provides G_0, G_1, ..., G_n, a total of n features; the host provides H_0, H_1, ..., H_m, a total of m features; lowercase g_j (j is an integer) is used to represent the feature value corresponding to the feature provided by the guest (such as age = 20), such as g_0, g_1, ..., g_n; lowercase h_j (j is an integer) is used to represent the feature value corresponding to the feature provided by the host, such as h_0, ..., h_m.

[0226] Estimation of the set value of the function f_x method: Use one of the three methods mentioned above.

[0227] Sampling times sample_n: If the f_x method uses method 3, this parameter takes effect and represents the number of random sampling feature values.

[0228] Participants in the embodiment of the present application: Guest (dominant) party (first participant), host party (second participant).

[0229] Based on the aforementioned input information, the system for implementing the longitudinal federated machine learning model interpretation method based on SHAP value provided in the embodiment of the present application includes four functional modules: sample interpretation module, subset scoring module, feature contribution calculation module and prediction module. The overall processing flow is: the guest (dominant party) provides n features, and treats all features provided by the host as a federal feature host_feat, and the guest has a total of n+1 features; the guest generates 2n+1 feature subsets corresponding to n+1 features; the 2n+1 feature subsets are input into the subset scoring module, and all feature subsets are scored based on the determined valuation function f_x, and then all feature subsets and the scores corresponding to the feature subsets are input into the feature contribution calculation module, and the SHAP value of each feature value is calculated on the guest side, and the SHAP value of host_feat; the guest side determines the contribution of each feature value provided by the guest and the total contribution value of the host based on the SHAP value of the n feature values ​​of each sample and the SHAP value of host_feat.

[0230] The functions of each functional module are described below. Figure 6 , Figure 6 This is an optional flow chart of the data processing method of the federated learning model provided in the embodiment of the present application. Figure 6 Each functional module is described.

[0231] First, the function of the sample interpretation module is explained. The sample interpretation module inputs each sample to be interpreted X0, X1, ..., Xn and the training data into the subset scoring module. The guest obtains the SHAP value of the feature value corresponding to each feature provided by the guest for each sample from the feature contribution calculation module, as well as the SHAP value of host_feat provided by at least one host. The host does not obtain any results.

[0232] The guest adds the SHAP values ​​of the features [G_0, G_1, ..., G_n] corresponding to all samples X0, X1, ..., Xn to be explained and the absolute value of the SHAP value of each sample host_feat to be explained, and obtains the feature importance of each feature (refers only to the importance of each feature provided by the guest) and the total contribution value of the host (the host does not calculate for a single feature, but considers all features as a whole). The guest outputs the above results, and the host does not output the results.

[0233] The subset scoring module is explained below. The subset scoring module takes a sample X that you want to explain and a training data set as input.

[0234] First, the guest treats all the features {H_0, ..., H_m} of the host as a federated feature host_feat. Therefore, the guest has features {G_0, G_1, ..., G_n, host_feat}, a total of n+1 features.

[0235] Check the setting value of the f_x method. If it is the setting method 1 of the aforementioned estimation function, the guest / host calculates the mean, median or mode of each feature based on the training data as the filling value; if it is the setting method 2 of the estimation function, 0 is used as the filling value; if it is the setting method 3 of the estimation function, the guest and host count the possible values ​​of each feature for random sampling.

[0236] On the guest side, for these n+1 features, a total of 2 n+1 feature subset.

[0237] Afterwards, the guest will take the lead in +1 Generate filling samples from feature subsets and calculate the f_x value:

[0238] For each feature subset, there are two situations for the missing features of the feature subset:

[0239] 1. If the missing features in the feature subset are only the features corresponding to the guest, perform the following operations:

[0240] 1) The guest generates i samples to be predicted for f_x based on the features provided by the guest of sample X, i is a positive integer greater than 0. If f_x is set to use the aforementioned scheme 1 or scheme 2, then i=1, that is, there will be only one sample to be predicted for f_x, otherwise there will be i=sample_n samples. The guest notifies the host of the number of samples to be predicted for f_x, and the host copies the corresponding features of the host in sample X i times. At this point, the guest and host have constructed i samples together.

[0241] 2) The guest and host input the generated samples into the prediction module together to obtain the prediction value corresponding to each sample input, and obtain the scoring result of f_x for the subset based on each prediction value (if there are multiple prediction values, the scoring result is the average of multiple prediction values).

[0242] 2. If the missing feature in the feature subset is the overall feature host_feat used to characterize the host, perform the following operations:

[0243] 1) The guest notifies the host via network communication;

[0244] 2) The guest generates i samples to be predicted for f_x based on the features provided by the guest in sample X. If f_x uses scheme 1 or 2, there will be only one sample to be predicted for f_x, otherwise there will be sample_n samples. The guest informs the host of the number of samples to be predicted for f_x;

[0245] 3) The host receives the variable i from the guest;

[0246] 4) If f_x uses scheme 1 or 2, the host generates the corresponding padding / all-0 features and replicates them i times. If scheme 3 is used, the host samples the feature values ​​of all its features i times and generates i sampled samples. So far, the guest and host have constructed i samples together.

[0247] 5) The guest and host input the generated samples into the prediction module together to obtain the predicted value, and then obtain the scoring result of f_x for the subset based on the predicted value (if there are multiple predicted values, the scoring result is the average of the multiple predicted values).

[0248] After all subsets are scored, the subsets and their corresponding scores will be input into the feature contribution calculation module.

[0249] The function of the prediction module is explained. The prediction module takes specific samples as input. The guest and host load the vertical federated machine learning model f, predict the input samples based on f, and return the predicted value.

[0250] The function of the feature contribution calculation module is explained. After obtaining the feature subset and the score corresponding to the feature subset, the feature contribution calculation module calculates the SHAP value of each feature value and the SHAP value of host_feat on the guest side according to the aforementioned formula and rules for calculating SHAP. The process will not be repeated here. Finally, the module outputs each feature value and the SHAP value of host_feat.

[0251] The SHAP-based longitudinal federated learning model interpretation method provided in the embodiment of the present application can determine the feature contribution of each feature provided by the guest in a single sample, and measure the feature contribution of the host. The same is true for multi-host situations, which makes up for the deficiencies in the federated scenario. In addition, it also retains the same measurement of global feature importance as the traditional method.

[0252] The following further describes an exemplary structure of the data processing device 555 of the federated learning model provided in the embodiment of the present application implemented as a software module. In some embodiments, Figure 2As shown, the software modules stored in the data processing device 555 of the federated learning model of the memory 540 may include:

[0253] An acquisition module 5551 is used to acquire a feature set used as a training sample of a federated learning model, wherein the feature set includes: features provided by a first participant having label information, and features provided by at least one second participant;

[0254] A construction module 5552 is used to obtain multiple feature subsets included in the feature set, and construct a model input of the federated learning model corresponding to each of the feature subsets;

[0255] The prediction module 5553 is used to input the constructed model inputs into the federated learning model to obtain the prediction results corresponding to the model inputs, and input the training samples into the federated learning model to obtain the target prediction results corresponding to the training samples;

[0256] The calculation module 5554 is used to determine the contribution information of each feature in the feature set corresponding to the target prediction result based on the obtained prediction results and the target prediction result.

[0257] In some embodiments, the construction module 5552 is also used to respectively determine the intersection of each of the feature subsets and the feature set; based on the intersection of each of the feature subsets and the feature set, determine the missing features of each of the feature subsets, and the missing features refer to the features that distinguish the intersection from the feature set; fill in the missing features in each of the feature subsets, respectively, to obtain the model input of the federated learning model corresponding to each of the feature subsets.

[0258] In some embodiments, the construction module 5552 is also used to determine the default value corresponding to each of the missing features; fill in the default value corresponding to the corresponding missing feature in each of the feature subsets, and obtain the model input of the federated learning model corresponding to each of the feature subsets.

[0259] In some embodiments, the construction module 5552 is also used to perform the following processing for each of the feature subsets: determine the value range corresponding to the missing features of the feature subset; perform multiple random sampling on the missing features in the value range to obtain multiple random values ​​corresponding to the missing features; and fill the multiple random values ​​into the feature subsets respectively to obtain multiple model inputs of the federated learning model corresponding to the feature subsets.

[0260] In some embodiments, the construction module 5552 is also used to input the multiple model inputs into the federated learning model respectively to obtain multiple initial prediction results; obtain the average value of the multiple initial prediction results, and use the average value as the prediction result of the feature subset.

[0261] In some embodiments, the construction module 5552 is also used to obtain a sample set of the federated learning model; perform the following processing for each of the feature subsets: obtain the feature values ​​corresponding to the missing features of the feature subset in each sample of the sample set; determine the target value corresponding to the missing feature based on the feature value corresponding to the missing feature in each of the samples; fill in the target value corresponding to the corresponding missing feature in the feature subset to obtain the model input of the federated learning model corresponding to the feature subset.

[0262] In some embodiments, the calculation module 5554 is also used to traverse each feature in the feature set and perform the following operations for each feature: when the feature is a missing feature, determine at least one feature subset corresponding to the feature; for each feature subset corresponding to the feature, based on the corresponding prediction result and the target prediction result, determine the marginal contribution value of the feature corresponding to the target prediction result; based on the marginal contribution value, determine the contribution information of the feature corresponding to the target prediction result.

[0263] In some embodiments, the calculation module 5554 is also used to sum up the multiple marginal contribution values ​​when there are multiple marginal contribution values, to obtain the total contribution value of the feature corresponding to the target prediction result, and to use the total contribution value as the contribution information of the feature to the target prediction result.

[0264] It should be noted that the description of the device of the embodiment of the present application is similar to the description of the above-mentioned method embodiment, and has similar beneficial effects as the method embodiment, so it will not be repeated.

[0265] An embodiment of the present application provides a computer program product, including a computer program, characterized in that when the computer program is executed by a processor, the data processing method of the federated learning model provided in the embodiment of the present application is implemented.

[0266] The present application embodiment provides a computer-readable storage medium storing executable instructions, wherein the executable instructions are stored. When the executable instructions are executed by a processor, the processor will be caused to execute the method provided by the present application embodiment, for example, Figure 3 The data processing method of the federated learning model is shown.

[0267] In some embodiments, the computer-readable storage medium may be a memory such as FRAM, ROM, PROM, EPROM, EEPROM, flash memory, magnetic surface storage, optical disk, or CD-ROM; or it may be various devices including one or any combination of the above memories.

[0268] In some embodiments, executable instructions may be in the form of a program, software, software module, script or code, written in any form of programming language (including compiled or interpreted languages, or declarative or procedural languages), and may be deployed in any form, including as a stand-alone program or as a module, component, subroutine or other unit suitable for use in a computing environment.

[0269] As an example, executable instructions may, but need not, correspond to a file in a file system, may be stored as part of a file that stores other programs or data, such as in one or more scripts in a HyperText Markup Language (HTML) document, in a single file dedicated to the program in question, or in multiple coordinated files (e.g., files storing one or more modules, subroutines, or code portions).

[0270] By way of example, executable instructions may be deployed to be executed on one computing device, or on multiple computing devices located at one site, or on multiple computing devices distributed across multiple sites and interconnected by a communication network.

[0271] In summary, the embodiments of the present application can not only expand the scope of application in federated learning scenarios, but also accurately measure the contribution information of each feature in a single training sample and measure the contribution information of the second participant.

[0272] The above is only an embodiment of the present application and is not intended to limit the protection scope of the present application. Any modifications, equivalent substitutions and improvements made within the spirit and scope of the present application are included in the protection scope of the present application.

Claims

1. A method for processing financial risk control data using a federated learning model, characterized in that: Applied to a first participant device, the method includes: Acquire a feature set used as a training sample of a federated learning model, the feature set comprising: features provided by a first participant with label information, and features provided by at least one second participant, wherein the feature set comprises at least two features of age, education, income, height, and work, the first participant is an active party, and the second participant is a feature provider; Acquire multiple feature subsets included in the feature set, and construct a model input of the federated learning model corresponding to each of the feature subsets; Wherein, constructing the model input of the federated learning model corresponding to each of the feature subsets includes: respectively determining the intersection of each of the feature subsets and the feature set; Based on the intersection of each of the feature subsets and the feature set, determining the missing features of each of the feature subsets, wherein the missing features refer to the features that are distinguished between the intersection and the feature set; Filling the missing features in each of the feature subsets respectively to obtain a model input of the federated learning model corresponding to each of the feature subsets; Inputting each of the constructed model inputs into the federated learning model to obtain prediction results corresponding to each of the model inputs, and inputting the training samples into the federated learning model to obtain target prediction results corresponding to the training samples; Based on the obtained prediction results and the target prediction result, the contribution information of each feature in the feature set corresponding to the target prediction result is calculated using the SHAP value. The method also includes: transmitting the corresponding intermediate information between the participants in an encrypted manner.

2. The method according to claim 1, characterized in that The filling the missing features in each of the feature subsets to obtain the model input of the federated learning model corresponding to each of the feature subsets includes: Determining a default value corresponding to each of the missing features; The default values ​​corresponding to the corresponding missing features are filled in each of the feature subsets respectively to obtain the model input of the federated learning model corresponding to each of the feature subsets.

3. The method according to claim 1, characterized in that The filling the missing features in each of the feature subsets to obtain the model input of the federated learning model corresponding to each of the feature subsets includes: The following processing is performed for each of the feature subsets: Determine the value range corresponding to the missing features of the feature subset; Performing multiple random sampling on the missing feature within the value range to obtain multiple random values ​​corresponding to the missing feature; The multiple random values ​​are filled into the feature subsets respectively to obtain multiple model inputs of the federated learning model corresponding to the feature subsets.

4. The method according to claim 3, characterized in that The method further comprises: Inputting the multiple model inputs into the federated learning model respectively to obtain multiple initial prediction results; An average value of the multiple initial prediction results is obtained, and the average value is used as the prediction result of the feature subset.

5. The method according to claim 1, characterized in that The filling the missing features in each of the feature subsets to obtain the model input of the federated learning model corresponding to each of the feature subsets includes: Obtaining a sample set of the federated learning model; Obtaining feature values ​​corresponding to the missing features of the feature subset in each sample of the sample set; Determining a target value corresponding to the missing feature based on a feature value corresponding to the missing feature in each of the samples; Fill the target values ​​corresponding to the corresponding missing features in the feature subset to obtain the model input of the federated learning model corresponding to the feature subset.

6. The method according to claim 1, characterized in that The determining, based on the obtained prediction results and the target prediction result, contribution information of each feature in the feature set corresponding to the target prediction result includes: Iterate over each feature in the feature set, and perform the following operations for each feature: When the feature is a missing feature, determining at least one feature subset corresponding to the feature; For each feature subset corresponding to the feature, based on the corresponding prediction result and the target prediction result, determine the marginal contribution value of the feature corresponding to the target prediction result; Based on the marginal contribution value, contribution information of the feature corresponding to the target prediction result is determined.

7. The method according to claim 6, characterized in that The determining, based on the marginal contribution value, contribution information of the feature corresponding to the target prediction result includes: When there are multiple marginal contribution values, the multiple marginal contribution values ​​are summed to obtain the total contribution value of the feature corresponding to the target prediction result. The total contribution value is used as the contribution information of the feature to the target prediction result.

8. A financial risk control data processing device based on a federated learning model, characterized in that: The device comprises: An acquisition module is used to acquire a feature set used as a training sample of a federated learning model, wherein the feature set includes: features provided by a first participant with label information, and features provided by at least one second participant, wherein the feature set includes at least two features of age, education, income, height, and work, the first participant is an active party, and the second participant is a feature provider; A construction module is used to obtain multiple feature subsets included in the feature set, and respectively determine the intersection of each feature subset and the feature set; based on the intersection of each feature subset and the feature set, determine the missing features of each feature subset, wherein the missing features refer to the features that distinguish the intersection from the feature set; fill the missing features in each feature subset, respectively, to obtain the model input of the federated learning model corresponding to each feature subset; A prediction module, used to input each of the constructed model inputs into the federated learning model to obtain a prediction result corresponding to each of the model inputs, and input the training sample into the federated learning model to obtain a target prediction result corresponding to the training sample; A calculation module is used to calculate the contribution information of each feature in the feature set corresponding to the target prediction result based on the obtained prediction results and the target prediction result using a SHAP value. The device also includes: transmitting corresponding intermediate information between the participants in an encrypted manner.

9. An electronic device, characterized in that: include: A memory for storing executable instructions; A processor, used to implement the financial risk control data processing method of the federated learning model described in any one of claims 1 to 7 when executing the executable instructions stored in the memory.

10. A computer-readable storage medium, characterized in that: Executable instructions are stored, which are used to implement the financial risk control data processing method of the federated learning model described in any one of claims 1 to 7 when executed by a processor.

11. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the financial risk control data processing method of the federated learning model described in any one of claims 1 to 7 is implemented.

Citation Information

Patent Citations

  • Model interpretation method and device based on cooperative game, and electronic equipment

    CN110705718A

  • Method and device for constructing federated learning model by multiple parties

    CN112396189A