Feature Binning Method, Device, and Readable Storage Medium
By obtaining sample label data to generate label statistics and performing preset optimal binning process, the problem of poor characteristic binning effect in vertical federal scenarios is solved, the optimal binning effect is achieved, and the accuracy of binning is improved.
Patent Information
- Application Number
- CN202010341457.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-04-26
- Publication Date
- 2025-07-25
- Estimated Expiration
- 2040-04-26
AI Technical Summary
In the vertical federal scenario, the prior art feature binning method has poor effect and cannot guarantee the optimal binning evaluation index, resulting in poor feature binning effect during vertical federal.
By obtaining sample label data, generating label statistical results, and performing a preset optimal binning process based on sample category statistical values, obtaining target binning results, avoiding isometric binning or equal frequency binning, and achieving optimal binning.
The characteristic boxing effect in vertical federation is improved, so that the evaluation indicators after boxing are optimized, and the accuracy and effect of boxing are improved.
Smart Images

Figure CN111523679B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of artificial intelligence in financial technology (Fintech), and particularly to a feature binning method, device, and readable storage medium. Background Art
[0002] With the continuous development of financial technology, especially Internet technology finance, more and more technologies (such as distributed, blockchain, artificial intelligence, etc.) are applied in the financial field. However, the financial industry also poses higher requirements for technologies, such as higher requirements for the distribution of corresponding to-be-done matters in the financial industry.
[0003] With the continuous development of computer software and artificial intelligence, the application field of federated learning is also becoming more and more extensive. Before performing federated modeling, training data is usually binned by features to achieve better model training effects. For example, in the risk control scenario based on vertical federation, since the training data provided by the data providers participating in the vertical federation usually does not carry sample labels, the training data is usually binned by features through unsupervised equal-width binning or equal-frequency binning methods. However, this method can only roughly bin the training data. For example, based on equal-width binning, after binning the training data, it can only ensure that the number of samples in each bin obtained by binning is the same, but cannot ensure that the binning evaluation index reaches the optimal value, resulting in poor feature binning effects during vertical federation. Therefore, there is a technical problem of poor feature binning effects during vertical federation in the prior art. Summary of the Invention
[0004] The main purpose of this application is to provide a feature binning method, device, and readable storage medium, aiming to solve the technical problem of low accuracy of feature binning in the prior art.
[0005] To achieve the above object, this application provides a feature binning method. The feature binning method is applied to a first device, and the feature binning method includes:
[0006] Obtain each sample label data, and send each of the sample label data to a second device associated with the first device for the second device to generate a label statistics result based on each of the sample label data, the obtained data party bins, and the common sample IDs;
[0007] Receive the label statistics result fed back by the second device, and determine the sample category statistics value corresponding to each of the data party bins based on the label statistics result;
[0008] Execute a preset optimal binning process based on each of the sample category statistics values to obtain a target binning result.
[0009] Optionally, the tag statistical results include tag statistical vectors corresponding to each bin of the data parties, and the sample category statistical values include the number of positive samples and the number of negative samples.
[0010] The step of determining the sample category statistical results based on each of the tag statistical results includes:
[0011] Extract the first numerical value and the second numerical value in each of the tag statistical vectors;
[0012] Based on each of the first numerical values, determine the number of positive samples corresponding to each bin of the data parties;
[0013] Based on each of the second numerical values, determine the number of negative samples corresponding to each bin of the data parties.
[0014] Optionally, the step of performing a preset optimal binning process based on each of the sample category statistical values to obtain a target binning result includes:
[0015] Determine a first initial binning result corresponding to each of the sample category statistical values, and based on a preset first feature binning strategy, merge each first target initial bin in the first initial binning result to obtain a second initial binning result;
[0016] Determine whether the second initial binning result meets the preset optimal binning end condition. If the second initial binning result meets the preset optimal binning end condition, use the second initial binning result as the target binning result;
[0017] If the second initial binning result does not meet the preset optimal binning end condition, merge each second target initial bin in the second initial binning result until the second initial binning result meets the preset optimal binning end condition to obtain the target binning result.
[0018] Optionally, the step of merging each first target initial bin in the first initial binning result based on a preset first feature binning strategy to obtain a second initial binning result includes:
[0019] Based on the preset feature binning strategy, calculate a chi-square statistical score set commonly corresponding to each of the first initial bins;
[0020] Based on the chi-square statistical score set, determine each first target initial bin in the first initial binning result, and merge each first target initial bin to generate the second initial binning result.
[0021] Optionally, the step of performing a preset optimal binning process based on each of the sample category statistical values to obtain a target binning result includes:
[0022] Determine a third initial binning result corresponding to each of the sample category statistical values, and determine a target binning point corresponding to the third initial binning result based on a preset second feature binning strategy;
[0023] Based on the target binning point, each third initial bin in the third initial binning result is divided to obtain a fourth initial binning result;
[0024] Determine whether the fourth initial binning result satisfies a preset optimal binning end condition, and if the fourth initial binning result satisfies the preset optimal binning end condition, use the fourth initial binning result as the target binning result;
[0025] If the fourth initial binning result does not satisfy the preset optimal binning end condition, each fourth initial bin in the fourth initial binning result is divided respectively until the fourth initial binning result satisfies the preset optimal binning end condition, so as to obtain the target binning result.
[0026] Optionally, the step of obtaining label data of each sample includes:
[0027] Performing sample alignment on a second device associated with the first device to obtain a public sample ID set;
[0028] The sample label corresponding to each public sample ID in the public sample ID set is obtained, and each sample label is encrypted to obtain each sample label data.
[0029] To achieve the above object, the present application further provides a feature binning method, which is applied to a second device and includes:
[0030] Obtaining feature data to be binned, and binning the feature data to be binned to obtain data binning results;
[0031] Receiving each sample label data sent by the first device associated with the second device, and generating a label statistical result based on each sample label data and the data cube binning result;
[0032] The label statistical result is fed back to the first device, so that the first device can execute a preset optimal binning process based on the label statistical result to obtain a target binning result.
[0033] Optionally, the data cube binning result includes one or more sample bins, and the label statistics result includes label statistics corresponding to each of the sample bins.
[0034] The step of generating label statistics based on each of the sample label data and the data cube binning results includes:
[0035] Determine the sample label data corresponding to each data party sample in each of the sample bins;
[0036] Calculate the sum of each of the sample label data corresponding to each of the sample bins respectively, to obtain each of the label statistical values.
[0037] This application also provides a feature binning device. The feature binning device is a virtual device and is applied to a first device. The feature binning device includes:
[0038] A sending module, configured to obtain each sample label data and send each of the sample label data to a second device associated with the first device, for the second device to generate a label statistical result based on each of the sample label data, the obtained data party bins, and the common sample IDs;
[0039] A determining module, configured to receive the label statistical result fed back by the second device and determine the sample category statistical values corresponding to each of the data party bins based on the label statistical result;
[0040] A feature binning module, configured to execute a preset optimal binning process based on each of the sample category statistical values to obtain a target binning result.
[0041] Optionally, the determining module includes:
[0042] An extraction unit, configured to extract the first numerical value and the second numerical value in each of the label statistical vectors;
[0043] A first determination unit, configured to determine the number of positive samples corresponding to each of the data party bins based on each of the first numerical values;
[0044] A first determination unit, configured to determine the number of negative samples corresponding to each of the data party bins based on each of the second numerical values.
[0045] Optionally, the feature binning module includes:
[0046] A merging unit, configured to determine a first initial binning result corresponding to each of the sample category statistical values and merge each of the first target initial bins in the first initial binning result based on a preset first feature binning strategy to obtain a second initial binning result;
[0047] A first determination unit, configured to determine whether the second initial binning result meets a preset optimal binning end condition. If the second initial binning result meets the preset optimal binning end condition, use the second initial binning result as the target binning result;
[0048] A second determination unit, configured to, if the second initial binning result does not meet the preset optimal binning end condition, merge each second target initial bin in the second initial binning result until the second initial binning result meets the preset optimal binning end condition, and obtain a target binning result.
[0049] Optionally, the merging unit includes:
[0050] A calculation subunit, configured to calculate a chi-square statistic score set commonly corresponding to each of the first initial bins based on the preset feature binning strategy;
[0051] A merging subunit, configured to determine each first target initial bin in the first initial binning result based on the chi-square statistic score set, and merge each first target initial bin to generate the second initial binning result.
[0052] Optionally, the feature binning further includes:
[0053] A determination unit, configured to determine a third initial binning result corresponding to each sample category statistic value, and determine a target binning point corresponding to the third initial binning result based on a preset second feature binning strategy;
[0054] A splitting unit, configured to split each third initial bin in the third initial binning result based on the target binning point to obtain a fourth initial binning result;
[0055] A third determination unit, configured to determine whether the fourth initial binning result meets the preset optimal binning end condition. If the fourth initial binning result meets the preset optimal binning end condition, use the fourth initial binning result as the target binning result;
[0056] A fourth determination unit, configured to, if the fourth initial binning result does not meet the preset optimal binning end condition, split each fourth initial bin in the fourth initial binning result respectively until the fourth initial binning result meets the preset optimal binning end condition, and obtain the target binning result.
[0057] Optionally, the sending module includes:
[0058] A sample alignment sub-module, configured to perform sample alignment with a second device associated with the first device to obtain a common sample ID set;
[0059] An encryption sub-module, configured to obtain a sample label corresponding to each common sample ID in the common sample ID set, and perform encryption processing on each sample label respectively to obtain each sample label data.
[0060] To achieve the above object, the present application further provides a feature binning device. The feature binning device is a virtual device and is applied to a second device. The feature binning device includes:
[0061] A binning module, configured to obtain feature data to be binned and perform binning on the feature data to be binned to obtain a data party binning result;
[0062] A generation module, configured to receive sample label data sent by a first device associated with the second device, and generate a label statistics result based on each of the sample label data and the data party binning result;
[0063] A feedback module, configured to feedback the label statistics result to the first device for the first device to execute a preset optimal binning process based on the label statistics result to obtain a target binning result.
[0064] Optionally, the generation module includes:
[0065] A determination sub-module, configured to determine the sample label data corresponding to each data party sample in each sample bin;
[0066] A summation sub-module, configured to calculate the sum of the sample label data corresponding to each sample bin respectively to obtain each label statistic value.
[0067] The present application further provides a feature binning device. The feature binning device is a physical device. The feature binning device includes: a memory, a processor, and a program of the feature binning method stored on the memory and executable on the processor. When the program of the feature binning method is executed by the processor, the steps of the feature binning method as described above can be implemented.
[0068] The present application further provides a readable storage medium. A program for implementing the feature binning method is stored on the readable storage medium. When the program of the feature binning method is executed by the processor, the steps of the feature binning method as described above are implemented.
[0069] This application obtains each sample label data, and sends each of the sample label data to a second device associated with the first device, so that the second device can generate a label statistics result based on each of the sample label data, the obtained data party bins, and the public sample IDs. Then, it receives the label statistics result fed back by the second device, and based on the label statistics result, determines the sample category statistics value corresponding to each data party bin. Furthermore, based on each of the sample category statistics values, it executes a preset optimal binning process to obtain a target binning result. That is to say, after obtaining the sample label data, this application sends each of the sample label data to a second device associated with the first device, so that the second device can generate a label statistics result based on each of the sample label data, the obtained data party bins, and the public sample IDs. Then, based on the label statistics result, it determines the sample category statistics value corresponding to each data party bin. Furthermore, based on each of the sample category statistics values, it can execute a preset optimal binning process to obtain a target binning result. That is to say, this application realizes the purpose of performing optimal binning on the data provided by the data provider without sample labels, thereby avoiding the occurrence of feature binning of the data provided by the data provider by means of equal-width binning or equal-frequency binning. Moreover, compared with the equal-width binning method or the equal-frequency binning method, this application can perform more detailed and sample-label-based optimal binning on the data, so that the binning evaluation index corresponding to the obtained target binning result after binning reaches the optimal, thereby improving the feature binning effect in vertical federation. Therefore, it solves the technical problem of poor feature binning effect in vertical federation. BRIEF DESCRIPTION OF THE DRAWINGS
[0070] The accompanying drawings herein are incorporated into the specification and form a part of the specification, showing embodiments consistent with the present application, and are used together with the specification to explain the principles of the present application.
[0071] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the following will briefly introduce the drawings required for use in the description of the embodiments or the prior art. Obviously, for those of ordinary skill in the art, without creative efforts, other drawings can also be obtained based on these drawings.
[0072] Figure 1 It is a schematic flowchart of the first embodiment of the feature binning method of the present application;
[0073] Figure 2 It is a schematic flowchart of the second embodiment of the feature binning method of the present application;
[0074] Figure 3 It is a schematic diagram of the device structure of the hardware operating environment involved in the solution of the embodiment of the present application.
[0075] The realization, functional features, and advantages of the present application will be further described in conjunction with embodiments with reference to the accompanying drawings. Detailed implementation manners
[0076] It should be understood that the specific embodiments described herein are only used to explain the present application and are not used to limit the present application.
[0077] The embodiments of the present application provide a feature binning method. In the first embodiment of the feature binning method of the present application, refer to Figure 1 , the feature binning method is applied to a first device, and the feature binning method includes:
[0078] Step S10, obtain each sample label data, and send each of the sample label data to a second device associated with the first device, so that the second device generates a label statistical result based on each of the sample label data, the obtained data party binning, and the common sample ID.
[0079] In this embodiment, it should be noted that the feature binning method is applied to a vertical federation scenario. The first device is the label provider of the vertical federation. Among them, the label provider is a federation participant in the vertical federation based on samples with sample labels. The second device is the data provider of the vertical federation. Among them, the data provider is a federation participant in the vertical federation based on samples without sample labels. Among them, the sample label is an identifier of the sample. For example, in the risk control field, if the sample label is set to positive, it indicates that the customer corresponding to the sample is a high-quality customer. If the sample label is set to negative, it indicates that the customer corresponding to the sample is a non-high-quality customer, etc. The sample label data is the encrypted sample label. For example, assume that the sample label is positive, then the corresponding sample label data is (1, 0). If the sample label is negative, the corresponding sample label data is (0, 1).
[0080] In addition, it should be noted that in the vertical federation, the samples participating in the vertical federation in the first device and each sample participating in the vertical federation in the second device have the same common sample ID. Among them, one sample corresponds to one common sample ID. The common sample ID is the identity identifier of the sample, such as a mobile phone number, an ID card number, etc. The label statistical result includes the label statistical values corresponding to each data party binning in the data party binning result. Among them, the label statistical value is the sum of the sample binning data corresponding to each sample in the data party binning.
[0081] Obtain the sample label data for each sample, and send each of the sample label data to a second device associated with the first device, so that the second device can generate a label statistical result based on each of the sample label data, the obtained data party binning for each data party, and the common sample IDs. Specifically, obtain the sample labels corresponding to each sample participating in vertical federation, and perform encryption processing on each of the sample labels. The encryption processing method includes additive homomorphic encryption, etc., to obtain the sample label data corresponding to each of the sample labels. Further, encrypt and send each of the sample label data and the common sample ID corresponding to each of the sample label data to the second device. After the second device obtains the data party binning result, the method for obtaining the data party binning includes equal-width binning and equal-frequency binning, etc. Based on each of the common sample IDs and each of the sample label data, determine one or more sample label data corresponding to each data party binning in the data party binning result, and calculate the sum of each sample label data corresponding to each data party binning to obtain the label statistical value corresponding to each data party binning, and encrypt and feedback each of the label statistical values to the first device. For example, assume that each of the sample labels is 1, 1, 1, -1, -1, -1, a total of 6 sample labels, and the corresponding sample label data are (1, 0), (1, 0), (1, 0), (0, 1), (0, 1), (0, 1) respectively. Further, assume that the data party binning result obtained by the second device includes data party binning A and data party binning B. Then, after the second device receives each of the sample labels and the common sample ID corresponding to each of the sample label data, based on each of the common sample IDs, determine that the sample label data corresponding to A are (1, 0), (1, 0), (0, 1) respectively, and then determine that the label statistical value corresponding to A is (2, 1), where (2, 1) indicates that there are 2 samples with a sample label of 1 and 1 sample with a sample label of -1 in A. Similarly, determine that the sample label data corresponding to A are (1, 0), (0, 0), (0, 1) respectively, and then determine that the label statistical value corresponding to A is (1, 2).
[0082] Among them, the steps of obtaining the sample label data for each sample include:
[0083] Step S11, the second device associated with the first device performs sample alignment to obtain a set of common sample IDs;
[0084] In this embodiment, the second device associated with the first device performs sample alignment to obtain a set of common sample IDs. Specifically, the second device associated with the first device performs sample alignment to determine the sample IDs common to the first device and the second device, and obtains each common sample ID, that is, obtains a set of prime common sample IDs.
[0085] Step S12: Obtain the sample labels corresponding to each common sample ID in the common sample ID set, and respectively encrypt each of the sample labels to obtain each of the sample label data.
[0086] In this embodiment, to obtain the sample labels corresponding to each common sample ID in the common sample ID set and respectively encrypt each of the sample labels to obtain each of the sample label data, specifically, obtain each common sample ID in the common sample ID set and determine the samples to be federated corresponding to each of the common sample IDs, where the samples to be federated are the samples participating in the vertical federation. Then, obtain the sample labels corresponding to each of the samples to be federated, and respectively encrypt each of the sample labels to obtain the sample label data corresponding to each of the sample labels.
[0087] Step S20: Receive the label statistical result fed back by the second device, and based on the label statistical result, determine the sample category statistical values corresponding to each data party bin.
[0088] In this embodiment, it should be noted that the label statistical result is the encrypted label statistical value corresponding to each data party bin, where the label statistical value is the statistical value of the number of positive and negative samples in the data party bin, and the sample category statistical value is the statistical value of the positive or negative samples in the data party bin. For example, assume that the label statistical value is a vector (a, b), and the corresponding sample category statistical values are a and b, where a represents that the number of positive samples passing through in the data party bin corresponding to the label statistical value is a, and b represents that the number of negative samples passing through in the data party bin corresponding to the label statistical value is b.
[0089] Receive the label statistical result fed back by the second device, and based on the label statistical result, determine the sample category statistical values corresponding to each data party bin. Specifically, receive the label statistical result fed back by the second device, and decrypt the label statistical result to obtain the label statistical values corresponding to each data party bin. Then, in each of the label statistical values, extract the sample category statistical values corresponding to each data party bin.
[0090] Among them, in step S20, the label statistical result includes the label statistical vectors corresponding to each data party bin, and the sample category statistical values include the number of positive samples and the number of negative samples.
[0091] The step of determining the sample category statistical result based on each of the label statistical results includes:
[0092] Step S21: Extract the first numerical value and the second numerical value in each of the label statistical vectors.
[0093] In this embodiment, it should be noted that the label statistical vector includes at least two numerical values. For example, assuming the label statistical vector is (a, b), then a is the first numerical value and b is the second numerical value.
[0094] Step S22: Based on each of the first numerical values, determine the number of positive samples corresponding to each data party bin.
[0095] In this embodiment, based on each of the first numerical values, determine the number of positive samples corresponding to each data party bin. Specifically, take each of the first numerical values corresponding to each data party bin as the number of positive samples corresponding to each data party bin, where one data party bin corresponds to one first numerical value, and one data party bin corresponds to one number of positive samples.
[0096] Step S23: Based on each of the second numerical values, determine the number of negative samples corresponding to each data party bin.
[0097] In this embodiment, based on each of the second numerical values, determine the number of negative samples corresponding to each data party bin. Specifically, take each of the second numerical values corresponding to each data party bin as the number of negative samples corresponding to each data party bin, where one data party bin corresponds to one second numerical value, and one data party bin corresponds to one number of negative samples.
[0098] Step S30: Based on each of the sample category statistical values, execute a preset optimal binning process to obtain a target binning result.
[0099] In this embodiment, it should be noted that the preset optimal binning process is a binning process that bins data based on a preset evaluation method to make the evaluation index optimal after binning, where the preset evaluation method includes Iv (Information Value), Gini index, chi-square test, ks test, etc.
[0100] Based on each of the sample category statistical values, execute a preset optimal binning process to obtain a target binning result. Specifically, based on each of the sample category statistical values, determine the number of positive samples and negative samples in each data party bin, and based on the number of positive samples and negative samples corresponding to each data party, execute the preset optimal binning process to obtain the target binning result.
[0101] Further, the first device may also send the binning points corresponding to the target binning result to the second device, so that the second device can obtain the target binning result of the data party based on each of the binning points. Here, the binning point is the segmentation point corresponding to each sample bin in the target binning result. For example, assuming that the domain range of each sample is from 1 to 100, and after binning, the domain corresponding to the first bin is from 1 to 50, and the domain corresponding to the second bin is from 50 to 100, then the binning point is 50.
[0102] Additionally, it should be noted that the preset optimal binning process includes a merging-based optimal binning process and a splitting-based optimal binning process. For the merging-based optimal binning process, the following steps are executed:
[0103] Among them, the step of obtaining the target binning result by executing the preset optimal binning process based on each of the sample category statistical values includes:
[0104] Step A11: Determine the first initial binning result corresponding to each of the sample category statistical values, and merge each of the first target initial bins in the first initial binning result based on a preset first feature binning strategy to obtain a second initial binning result;
[0105] In this embodiment, it should be noted that the preset first feature binning strategy includes Iv, Gini index, chi-square test, etc.
[0106] Determine the first initial binning result corresponding to each of the sample category statistical values, and merge each of the first target initial bins in the first initial binning result based on a preset first feature binning strategy to obtain a second initial binning result. Specifically, based on each of the sample category statistical values and the binning arrangement codes corresponding to each data party binning, determine the first initial binning result. Here, the binning arrangement code is an identifier of the arrangement position of the corresponding data party bin in the data party binning result. The first initial binning result is a sequence of sorted sample bins to be merged. Among them, the arrangement order corresponding to the first initial binning result is the same as the arrangement order of the data party binning result, and the positive sample quantity and negative sample quantity corresponding to the sample category statistical values are recorded in the bins to be merged. Further, based on the preset first feature binning strategy, calculate the chi-square statistical scores between adjacent pairs of the sample bins to be merged respectively, and select the minimum target chi-square statistical score among each of the chi-square statistical scores. Then, merge the two adjacent sample bins to be merged corresponding to the target chi-square statistical score to obtain the second initial binning result.
[0107] Among them, the step of merging each first target initial bin in the first initial binning result based on the preset first feature binning strategy to obtain a second initial binning result includes:
[0108] Step A111, calculate the chi-square statistic score set commonly corresponding to each of the first initial bins based on the preset feature binning strategy;
[0109] In this embodiment, the preset feature binning strategy includes chi-square test. The chi-square statistic score set includes one or more chi-square statistic scores. The chi-square statistic score is an evaluation index commonly corresponding to adjacent first initial bins calculated based on the chi-square test. The chi-square statistic score is used to evaluate the quality of the binning effect. The first initial bin is the sample bin corresponding to the smallest chi-square statistic score in the chi-square statistic score set in the first initial binning result.
[0110] Calculate the chi-square statistic score set commonly corresponding to each of the first initial bins based on the preset feature binning strategy. Specifically, determine the nodes to be merged corresponding to each of the first initial bins, and calculate the chi-square statistic scores corresponding to each of the nodes to be merged based on the chi-square test to obtain the chi-square statistic score set. Among them, each node to be merged corresponds to two adjacent first initial bins. Assume that, for example, there are 100 first initial bins, then there are 99 nodes to be merged corresponding to the 100 first initial bins.
[0111] Step A112, determine each of the first target initial bins in the first initial binning result based on the chi-square statistic score set, and merge each of the first target initial bins to generate the second initial binning result.
[0112] In this embodiment, based on the chi-square statistical score set, each first target initial bin is determined in the first initial binning result, and each first target initial bin is merged to generate the second initial binning result. Specifically, the minimum target chi-square statistical score is determined in the chi-square statistical score set, and the first target binning node corresponding to the target chi-square statistical score is determined among the nodes to be merged. The two first initial bins corresponding to the first target binning node are used as each first target initial bin, and each first target initial bin is merged to obtain a first merged bin. Further, the first merged bin is compared with the corresponding first adjacent bin to determine whether the first merged bin and the first adjacent bin meet the preset node generation condition. If the first merged bin and the first adjacent bin meet the preset node generation condition, it indicates that the first merged bin and the first adjacent bin can be merged, and a binning node to be merged jointly corresponding to the first merged bin and the first adjacent bin is generated, where the first adjacent bin is the first initial bin on the left side of the first merged bin. If the first merged bin and the first adjacent bin do not meet the preset node generation condition, it indicates that the first merged bin and the first adjacent bin cannot be merged. Further, the first merged bin is compared with the corresponding second adjacent bin to determine whether the first merged bin and the second adjacent bin meet the preset node generation condition. If the first merged bin and the second adjacent bin meet the preset node generation condition, it indicates that the first merged bin and the second adjacent bin can be merged, and a binning node to be merged jointly corresponding to the first merged bin and the second adjacent bin is generated, where the second adjacent bin is the first initial bin on the right side of the first merged bin. If the first merged bin and the second adjacent bin do not meet the preset node generation condition, it indicates that the first merged bin and the second adjacent bin cannot be merged, and then the initial binning merge result is obtained, where the preset node generation condition includes that the number of samples in the merged bin exceeds a threshold, etc.
[0113] Step A12, determine whether the second initial binning result meets the preset optimal binning end condition. If the second initial binning result meets the preset optimal binning end condition, use the second initial binning result as the target binning result.
[0114] In this embodiment, it should be noted that the preset optimal binning end condition includes reaching the minimum number of bins, all chi-square statistical scores being greater than or equal to a preset chi-square statistical score threshold, etc.
[0115] Determine whether the second initial binning result meets the preset optimal binning end condition. If the second initial binning result meets the preset optimal binning end condition, then use the second initial binning result as the target binning result. Specifically, determine whether the second initial binning result meets the preset optimal binning end condition. If the second initial binning result meets the preset optimal binning end condition, then end the combined optimal binning process and use the second initial binning result as the target binning result.
[0116] Step A13, if the second initial binning result does not meet the preset optimal binning end condition, then merge each second target initial bin in the second initial binning result until the second initial binning result meets the preset optimal binning end condition to obtain the target binning result.
[0117] In this embodiment, if the second initial binning result does not meet the preset optimal binning end condition, then merge each second target initial bin in the second initial binning result until the second initial binning result meets the preset optimal binning end condition to obtain the target binning result. Specifically, if the second initial binning result does not meet the preset optimal binning end condition, then re-determine the second target node to be merged with the smallest chi-square statistical score among the nodes to be merged in the second initial binning result, so as to merge the two first initial bins corresponding to the second target node to be merged until the second initial binning result meets the preset optimal binning end condition to obtain the target binning result.
[0118] For the splitting optimal binning process, the following steps are executed:
[0119] Among them, the step of performing the preset optimal binning process based on each of the sample category statistical values to obtain the target binning result includes:
[0120] Step B10, determine the third initial binning result corresponding to each of the sample category statistical values, and determine the target binning point corresponding to the third initial binning result based on the preset second feature binning strategy;
[0121] In this embodiment, it should be noted that the preset second feature binning strategy includes the ks value, the target binning point is the binning point that divides the third initial binning result into two bins, and the third initial binning result is the same as the first initial binning result.
[0122] Determine the third initial binning result corresponding to each of the sample category statistical values, and based on a preset second feature binning strategy, determine the target binning points corresponding to the third initial binning result. Specifically, determine the third initial binning result corresponding to the label statistical result, and based on the preset second feature binning strategy, determine the ks value corresponding to the third initial binning result, and obtain the target binning points corresponding to the ks value.
[0123] Step B20: Based on the target binning points, divide each of the third initial bins in the third initial binning result to obtain a fourth initial binning result.
[0124] In this embodiment, based on the target binning points, divide each of the third initial bins in the third initial binning result to obtain a fourth initial binning result. Specifically, based on the target binning points, divide the first initial binning result into a first divided bin and a second divided bin to obtain the fourth initial binning result. For example, each of the third initial bins includes bin A, bin B, bin C, and bin D. Then, based on the target binning points, divide each of the third initial bins into a first divided bin and a second divided bin, where the first divided bin includes bin A and bin B, and the second divided bin includes bin C and bin D.
[0125] Step B30: Determine whether the fourth initial binning result meets the preset optimal binning end condition. If the fourth initial binning result meets the preset optimal binning end condition, then use the fourth initial binning result as the target binning result.
[0126] In this embodiment, it should be noted that the preset optimal binning end condition includes reaching the maximum number of bins, the ks reaching a preset ks threshold, etc.
[0127] Determine whether the fourth initial binning result meets the preset optimal binning end condition. If the fourth initial binning result meets the preset optimal binning end condition, then use the fourth initial binning result as the target binning result. Specifically, determine whether the fourth initial binning result meets the preset optimal binning end condition. If the fourth initial binning result meets the preset optimal binning end condition, then end the execution of the segmentation-based optimal binning process and use the fourth initial binning result as the target binning result.
[0128] Step B40: If the fourth initial binning result does not meet the preset optimal binning end condition, then divide each of the fourth initial bins in the fourth initial binning result respectively until the fourth initial binning result meets the preset optimal binning end condition to obtain the target binning result.
[0129] In this embodiment, it should be noted that each fourth initial bin is the first split bin and the second split bin.
[0130] If the fourth initial binning result does not meet the preset optimal binning end condition, then each fourth initial bin in the fourth initial binning result is split respectively until the fourth initial binning result meets the preset optimal binning end condition to obtain the target binning result. Specifically, if the fourth initial binning result does not meet the preset optimal binning end condition, then the ks values corresponding to each fourth initial bin in the fourth initial binning result are calculated respectively to determine the binning points corresponding to each fourth initial bin, and then based on each binning point, the corresponding fourth initial binning result is split respectively until the fourth initial binning result meets the preset optimal binning end condition to obtain the target binning result.
[0131] In this embodiment, by obtaining each sample label data and sending each sample label data to a second device associated with the first device for the second device to generate a label statistics result based on each sample label data, each obtained data party bin, and the public sample ID, and then receiving the label statistics result fed back by the second device and determining the sample category statistics value corresponding to each data party bin based on the label statistics result, and then based on each sample category statistics value, performing a preset optimal binning process to obtain a target binning result. That is to say, after obtaining the sample label data in this embodiment, each sample label data is sent to a second device associated with the first device for the second device to generate a label statistics result based on each sample label data, each obtained data party bin, and the public sample ID, and then based on the label statistics result, determining the sample category statistics value corresponding to each data party bin, and then based on each sample category statistics value, the preset optimal binning process can be performed to obtain the target binning result. That is to say, this embodiment realizes the purpose of performing optimal binning on the data provided by the data provider without sample labels, and further avoids the situation of performing feature binning on the data provided by the data provider by means of equal-distance binning or equal-frequency binning. Moreover, compared with the equal-distance binning method or the equal-frequency binning method, the present application can perform more detailed and sample-label-based optimal binning on the data, so that the binning evaluation index corresponding to the obtained target binning result after binning reaches the optimal, and further improves the feature binning effect in vertical federation. Therefore, the technical problem of poor feature binning effect in vertical federation is solved.
[0132] Further, referring to Figure 2 , based on the first embodiment of the present application, in another embodiment of the present application, the feature binning method is applied to a second device, and the feature binning method includes:
[0133] Step B10: Obtain the feature data to be binned, and bin the feature data to be binned to obtain the data party binning result;
[0134] In this embodiment, to obtain the feature data to be binned and bin the feature data to be binned to obtain the data party binning result, specifically, based on the common sample ID obtained by aligning samples on the first device associated with the second device, extract the feature data to be binned corresponding to the common sample ID from the preset database, and based on the preset feature binning method, bin the feature data to be binned to obtain the data party binning result, where the preset feature binning method includes equal-width binning and equal-frequency binning, etc.
[0135] Step B20: Receive the sample label data sent by the first device associated with the second device, and generate a label statistics result based on each of the sample label data and the data party binning result;
[0136] In this embodiment, it should be noted that the sample label data is encrypted sample labels, where the encryption method includes homomorphic encryption, etc.
[0137] Receive the sample label data sent by the first device associated with the second device, and generate a label statistics result based on each of the sample label data and the data party binning result. Specifically, receive the sample label data sent by the first device associated with the second device, and based on the common sample ID corresponding to each of the sample label data, determine one or more sample label data corresponding to each data party bin in the data party binning result, and based on one or more sample label data corresponding to each data party bin, calculate the label statistical value corresponding to each data party bin to obtain the label statistics result, where the label statistics result includes the label statistical value corresponding to each data party bin.
[0138] Wherein, the data party binning result includes one or more sample bins, the sample bin includes one or more data party samples, and the label statistics result includes the label statistical value corresponding to each sample bin.
[0139] The step of generating a label statistics result based on each of the sample label data and the data party binning result includes:
[0140] Step B21: Determine the sample label data corresponding to each data party sample in each sample bin;
[0141] In this embodiment, to determine the sample label data corresponding to each data party sample in each sample bin, specifically, obtain the common sample IDs corresponding to each sample label data, and based on the one-to-one correspondence between the sample label data and the common sample IDs, determine the sample label data corresponding to each data party sample in each sample bin, where the common sample ID is the identifier of the data party sample.
[0142] Step B22: Calculate the sum of each sample label data corresponding to each sample bin respectively to obtain each label statistical value.
[0143] In this embodiment, to calculate the sum of each sample label data corresponding to each sample bin respectively to obtain each label statistical value, specifically, sum each sample label data corresponding to each sample bin respectively to obtain the sum of the sample label data corresponding to each sample bin, and use the sum of the sample label data corresponding to each sample bin as the respective corresponding label statistical value to obtain the label statistical values corresponding to each sample bin. For example, assume that sample bin A includes data party sample a, data party sample b, and data party sample c, and the sample label data corresponding to data party sample a is (0, 1), the sample label data corresponding to data party sample b is (1, 0), and the sample label data corresponding to data party sample c is (1, 0). Then the label statistical value is (2, 1). Among them, when the sample label data is (0, 1), it means that the sample label of the label party sample corresponding to the common sample ID in the first device is negative; when the sample label data is (1, 0), it means that the sample label of the label party sample corresponding to the common sample ID in the first device is positive, and the sample label data is data after homomorphic encryption.
[0144] Step B30: Feed back the label statistical result to the first device for the first device to execute a preset optimal binning process based on the label statistical result to obtain a target binning result.
[0145] In this embodiment, the label statistical result is fed back to the first device, so that the first device can execute a preset optimal binning process based on the label statistical result to obtain a target binning result. Specifically, the label statistical result is fed back to the first device, so that the first device can determine the sample category statistical values corresponding to the label statistical values in the label statistical result, and then execute the preset optimal binning process based on each of the sample category statistical values to obtain the target binning result. Herein, the sample category statistical values are the number of positive samples and negative samples in the sample binning. For example, assuming that the label statistical value corresponding to the sample binning is (2, 3), then the sample binning data is that there are 2 positive samples and 3 negative samples in the sample binning.
[0146] In this embodiment, by obtaining the to-be-binned feature data, binning the to-be-binned feature data to obtain a data provider binning result, then receiving the sample label data sent by the first device associated with the second device, and generating a label statistical result based on each of the sample label data and the data provider binning result, and then feeding back the label statistical result to the first device, so that the first device can execute a preset optimal binning process based on each of the sample category statistical values to obtain a target binning result. That is to say, this embodiment realizes the purpose of assisting the label provider in vertical federation to perform feature binning of the samples of the data provider. That is, the data provider bins the samples locally, and after obtaining each of the sample binnings, receives the sample label data corresponding to each sample sent by the label provider, and then based on the sample label data, counts the number of positive and negative samples in each of the sample binnings to generate the sample label statistical value, and feeds back the sample label statistical value to the label provider. Herein, since the sample label data is homomorphically encrypted, the number of positive and negative samples in each sample binning of the data provider is counted without exposing the label provider. Then, the label provider can perform optimal binning on each sample of the data provider after obtaining the number of positive and negative samples in each sample binning of the data provider, thus realizing the purpose of performing feature binning based on sample labels on the samples of the data provider in vertical federation, and avoiding the situation of performing feature binning on the data of the data provider by means of equal-width binning or equal-frequency binning. Moreover, compared with the equal-width binning method or the equal-frequency binning method, this embodiment can perform more detailed and optimal binning based on sample labels on the data, so that the binning evaluation index corresponding to the obtained target binning result after binning reaches the optimal, thereby improving the feature binning effect in vertical federation. Therefore, the technical problem of poor feature binning effect in vertical federation is solved.
[0147] Refer to Figure 3 , Figure 3It is a schematic diagram of the device structure of the hardware operating environment involved in the embodiment solution of the present application.
[0148] As shown in Figure 3 , the feature binning device may include: a processor 1001, such as a CPU, a memory 1005, and a communication bus 1002. Among them, the communication bus 1002 is used to realize the connection and communication between the processor 1001 and the memory 1005. The memory 1005 may be a high-speed RAM memory or a stable memory (non-volatile memory), such as a disk memory. Optionally, the memory 1005 may also be a storage device independent of the aforementioned processor 1001.
[0149] Optionally, the feature binning device may further include a rectangular user interface, a network interface, a camera, an RF (Radio Frequency) circuit, sensors, an audio circuit, a WiFi module, etc. The rectangular user interface may include a display screen and an input sub-module such as a keyboard. Optionally, the rectangular user interface may further include a standard wired interface and a wireless interface. The network interface may optionally include a standard wired interface and a wireless interface (such as a WI-FI interface).
[0150] Those skilled in the art can understand that Figure 3 the feature binning device structure shown in
[0151] does not constitute a limitation on the feature binning device, and may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements. Figure 3 As shown in
[0152] In Figure 3 the feature binning device shown, the processor 1001 is used to execute the feature binning program stored in the memory 1005 to implement the steps of the feature binning method described in any one of the above.
[0153] The specific implementation manner of the feature binning device of the present application is basically the same as that of each embodiment of the above feature binning method, and will not be repeated here.
[0154] The embodiment of the present application further provides a feature binning device, which is applied to a first device. The feature binning device includes:
[0155] A sending module, configured to obtain each sample label data and send each of the sample label data to a second device associated with the first device, so that the second device generates a label statistical result based on each of the sample label data, the obtained data party binning, and the public sample ID;
[0156] A determining module, configured to receive the label statistical result fed back by the second device and determine the sample category statistical value corresponding to each of the data party binning based on the label statistical result;
[0157] A feature binning module, configured to execute a preset optimal binning process based on each of the sample category statistical values to obtain a target binning result.
[0158] Optionally, the determining module includes:
[0159] An extraction unit, configured to extract the first numerical value and the second numerical value in each of the label statistical vectors;
[0160] A first determination unit, configured to determine the positive sample quantity corresponding to each of the data party binning based on each of the first numerical values;
[0161] A first determination unit, configured to determine the negative sample quantity corresponding to each of the data party binning based on each of the second numerical values.
[0162] Optionally, the feature binning module includes:
[0163] A merging unit, configured to determine a first initial binning result corresponding to each of the sample category statistical values and merge each of the first target initial binning in the first initial binning result based on a preset first feature binning strategy to obtain a second initial binning result;
[0164] A first determination unit, configured to determine whether the second initial binning result meets a preset optimal binning end condition. If the second initial binning result meets the preset optimal binning end condition, use the second initial binning result as the target binning result;
[0165] A second determination unit, configured to, if the second initial binning result does not meet the preset optimal binning end condition, merge each of the second target initial binning in the second initial binning result until the second initial binning result meets the preset optimal binning end condition to obtain a target binning result.
[0166] Optionally, the merging unit includes:
[0167] A calculation subunit, configured to calculate a chi-square statistical score set commonly corresponding to each of the first initial binning based on the preset feature binning strategy;
[0168] A merging subunit, configured to determine each first target initial bin in the first initial binning result based on the set of chi-square statistical scores, and merge each first target initial bin to generate the second initial binning result.
[0169] Optionally, the feature binning further includes:
[0170] A determination unit, configured to determine a third initial binning result corresponding to each sample category statistical value, and determine a target binning point corresponding to the third initial binning result based on a preset second feature binning strategy;
[0171] A splitting unit, configured to split each third initial bin in the third initial binning result based on the target binning point to obtain a fourth initial binning result;
[0172] A third determination unit, configured to determine whether the fourth initial binning result meets a preset optimal binning end condition. If the fourth initial binning result meets the preset optimal binning end condition, use the fourth initial binning result as the target binning result;
[0173] A fourth determination unit, configured to, if the fourth initial binning result does not meet the preset optimal binning end condition, split each fourth initial bin in the fourth initial binning result respectively until the fourth initial binning result meets the preset optimal binning end condition, to obtain the target binning result.
[0174] Optionally, the sending module includes:
[0175] A sample alignment sub-module, configured to perform sample alignment with a second device associated with the first device to obtain a set of common sample IDs;
[0176] An encryption sub-module, configured to obtain sample labels corresponding to each common sample ID in the set of common sample IDs, and perform encryption processing on each sample label respectively to obtain each sample label data.
[0177] The specific implementation manner of the feature binning device in this application is basically the same as that of each embodiment of the above feature binning method, and will not be elaborated here.
[0178] To achieve the above object, an embodiment of this application further provides a feature binning device. The feature binning device is applied to a second device, and the feature binning device includes:
[0179] A binning module, configured to obtain feature data to be binned, and perform binning on the feature data to be binned to obtain a data party binning result;
[0180] A generation module, configured to receive each sample tag data sent by a first device associated with the second device, and generate a tag statistical result based on each of the sample tag data and the data party binning result;
[0181] A feedback module, configured to feedback the tag statistical result to the first device, so that the first device executes a preset optimal binning process based on the tag statistical result to obtain a target binning result.
[0182] Optionally, the generation module includes:
[0183] A determination sub-module, configured to determine the sample tag data corresponding to each data party sample in each sample bin;
[0184] A summation sub-module, configured to calculate the sum of each of the sample tag data corresponding to each sample bin respectively to obtain each of the tag statistical values.
[0185] The specific implementation manners of the feature binning device of the present application are basically the same as those of the above-mentioned embodiments of the feature binning method, and will not be described in detail herein.
[0186] The embodiments of the present application provide a readable storage medium, and the readable storage medium stores one or more programs, and the one or more programs can also be executed by one or more processors to be used to implement the steps of the feature binning method described in any one of the above.
[0187] The specific implementation manners of the readable storage medium of the present application are basically the same as those of the above-mentioned embodiments of the feature binning method, and will not be described in detail herein.
[0188] The above are only the preferred embodiments of the present application, and do not limit the patent scope of the present application accordingly. Any equivalent structure or equivalent process transformation made by using the specification and drawings of the present application, or directly or indirectly applied to other related technical fields, shall be included in the patent scope of the present application by the same token.
Claims
1. A feature binning method, characterized in that The feature binning method is applied to a first device, and the feature binning method includes: Performing sample alignment on a second device associated with the first device to obtain a set of common sample IDs; Obtaining the sample labels corresponding to each common sample ID in the set of common sample IDs, and respectively performing encryption processing on each of the sample labels to obtain each sample label data. The encryption processing method includes additive homomorphic encryption, and sending each of the sample label data to a second device associated with the first device for the second device to generate a label statistical result based on each of the sample label data, the obtained binning of each data party, and the common sample IDs; Receiving the label statistical result fed back by the second device, and determining the sample category statistical value corresponding to each binning of the data parties based on the label statistical result; Determining a first initial binning result corresponding to each sample category statistical value, and merging each first target initial binning in the first initial binning result based on a preset first feature binning strategy to obtain a second initial binning result; Determining whether the second initial binning result meets a preset optimal binning end condition. If the second initial binning result meets the preset optimal binning end condition, using the second initial binning result as the target binning result; If the second initial binning result does not meet the preset optimal binning end condition, merging each second target initial binning in the second initial binning result until the second initial binning result meets the preset optimal binning end condition to obtain the target binning result.
2. The feature binning method according to claim 1, wherein The label statistical result includes a label statistical vector corresponding to each binning of the data parties, and the sample category statistical value includes the number of positive samples and the number of negative samples. The step of determining the sample category statistical result based on each of the label statistical results includes: Extracting the first numerical value and the second numerical value in each label statistical vector; Determining the number of positive samples corresponding to each binning of the data parties based on each of the first numerical values; Determining the number of negative samples corresponding to each binning of the data parties based on each of the second numerical values.
3. The feature binning method according to claim 1, wherein The step of merging each first target initial binning in the first initial binning result based on a preset first feature binning strategy to obtain a second initial binning result includes: Calculating a set of chi-square statistical scores commonly corresponding to each first initial binning in the first initial binning result based on the preset first feature binning strategy; Determining each first target initial binning in the first initial binning result based on the set of chi-square statistical scores, and merging each first target initial binning to generate the second initial binning result.
4. The feature binning method according to claim 1, wherein The step of performing a preset optimal binning process based on each of the sample category statistical values to obtain the target binning result includes: Determining a third initial binning result corresponding to each sample category statistical value, and determining a target binning point corresponding to the third initial binning result based on a preset second feature binning strategy; Dividing each third initial binning in the third initial binning result based on the target binning point to obtain a fourth initial binning result; Determine whether the fourth initial binning result meets the preset optimal binning end condition. If the fourth initial binning result meets the preset optimal binning end condition, then use the fourth initial binning result as the target binning result; If the fourth initial binning result does not meet the preset optimal binning end condition, then split each of the fourth initial bins in the fourth initial binning result until the fourth initial binning result meets the preset optimal binning end condition to obtain the target binning result.
5. A feature binning method, characterized in that, The feature binning method is applied to a second device, and the feature binning method includes: Obtain the feature data to be binned, and perform binning on the feature data to be binned to obtain a data party binning result; Receive each sample label data sent by a first device associated with the second device, and generate a label statistical result based on each sample label data and the data party binning result; Feed back the label statistical result to the first device for the first device to execute a preset optimal binning process based on the label statistical result to obtain a target binning result; Among them, the obtaining method of each sample label data includes: the first device performs sample alignment with a second device associated with the first device to obtain a set of common sample IDs; The first device obtains the sample label corresponding to each common sample ID in the set of common sample IDs, and respectively performs encryption processing on each sample label to obtain each sample label data, and the encryption processing method includes additive homomorphic encryption; Among them, the step of executing the preset optimal binning process to obtain the target binning result includes: The first device determines a first initial binning result corresponding to each sample category statistical value, and merges each first target initial bin in the first initial binning result based on a preset first feature binning strategy to obtain a second initial binning result; The first device determines whether the second initial binning result meets the preset optimal binning end condition. If the second initial binning result meets the preset optimal binning end condition, then use the second initial binning result as the target binning result; If the second initial binning result does not meet the preset optimal binning end condition, then merge each second target initial bin in the second initial binning result until the second initial binning result meets the preset optimal binning end condition to obtain the target binning result.
6. The feature binning method according to claim 5, wherein The data party binning result includes one or more sample bins, and the label statistical result includes the label statistical value corresponding to each sample bin, The step of generating the label statistical result based on each sample label data and the data party binning result includes: Determine the sample label data corresponding to each data party sample in each sample bin; Respectively calculate the sum of each sample label data corresponding to each sample bin to obtain each label statistical value.
7. A feature binning device, characterized in that, The feature binning device includes: a memory, a processor, and a program stored on the memory for implementing the feature binning method, The memory is used to store the program for implementing the feature binning method; The processor is used to execute a program for implementing the feature binning method, so as to implement the steps of the feature binning method as described in any one of claims 1 to 4 or 5 to 6.
8. A readable storage medium, characterized in that, A program for implementing the feature binning method is stored on the readable storage medium, and the program for implementing the feature binning method is executed by the processor to implement the steps of the feature binning method as described in any one of claims 1 to 4 or 5 to 6.
Citation Information
Patent Citations
A continuous feature automatic binning algorithm based on similarity combination
CN109840843A
Safe feature engineering method and device
CN110032878A