Feature correlation analysis method and apparatus
By removing null features from the sample set in federated modeling and calculating and exchanging encrypted differences, the problem of high computational and communication costs between collaborators is solved, and efficient determination of feature correlation coefficients is achieved.
Patent Information
- Application Number
- CN202310103612.2
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-01-30
- Publication Date
- 2025-12-16
- Estimated Expiration
- 2043-01-30
AI Technical Summary
Before federated modeling, the computational and communication workload was too large when determining the feature correlation coefficients among collaborators, resulting in significant computational and communication costs.
By deleting samples with null values from the sample set, calculating the mean and standard deviation of the features, performing homomorphic encryption, exchanging the encryption difference and sample identifiers, and calculating the correlation coefficient using covariance.
This reduces the amount of data and computation in the feature correlation processing, and improves the efficiency of determining the correlation coefficient.
Smart Images

Figure CN115994298B_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the technical field of computer, in particular to a feature correlation analysis method and device. BACKGROUND
[0002] Currently, before the federal modeling starts, the two partners of modeling need to pass through the federal correlation analysis to view the correlation between the features of both parties to select important features for subsequent model training.
[0003] In the related art, the general process of determining the correlation coefficient between the features of both parties is that a partner A in the two partners directly processes the original sample data of itself, and sends the processing result to a partner B in the two partners, then the partner B processes the corresponding processing result based on the processing result and the original sample data of itself, and sends the corresponding processing result to the partner A again, and the partner determines the correlation coefficient between the features of both parties based on the processing result sent by the partner B. However, in the process of determining the correlation coefficient between the features of both parties, the calculation and communication of the two partners are very large, and the calculation and communication consumption is large. SUMMARY
[0004] The present application provides a feature correlation analysis method and device.
[0005] An embodiment of the present application provides a feature correlation analysis method, which is executed by a first device, and the method comprises the following steps.
[0006] The feature correlation analysis method of the embodiments of the present application can delete the samples in which the first feature is null in the sample set in the process of determining the correlation between the first feature in the first device and the second feature in the second device, perform feature correlation processing based on the processed sample set, send the processing result to the second device, receive the target value returned by the second device for the processing result, and determine the correlation coefficient between the first feature and the second feature based on the target value and the standard deviation of the first feature. Thus, in the process of determining the correlation coefficient between the first feature in the first device and the second feature, the data amount in the feature correlation processing process can be reduced by filtering and null processing on the sample set, and then the calculation amount in the feature correlation processing process can be reduced, and the communication data amount between the two parties can be reduced. While the correlation coefficient between the first feature and the second feature is accurately determined, the efficiency of determining the correlation coefficient can be improved.
[0007] Another aspect of the embodiments of the present application proposes a feature correlation analysis method. In the process of performing correlation analysis on the second feature of the first sample set in the first device and the second feature of the second sample set in the second device, first exchange information from the first device is received, wherein the first exchange information includes an encrypted difference value and sample identifiers of samples in a third sample set, the third sample set is obtained by deleting samples in which the feature value of the first feature in the first sample set is null, the encrypted difference value is obtained by homomorphic encryption of the first device on the first difference value of the first feature of each sample in the third sample set, the first difference value is obtained by subtracting the average feature value of the first feature from the feature value of the first feature of each sample in the third sample set, and the average feature value of the first feature is obtained by averaging the feature value of the first feature of each sample in the third sample set; a plurality of target samples corresponding to the sample identifiers are obtained from the second sample set, and the average feature value and the standard deviation of the second feature are determined according to the feature values of the second feature of the plurality of target samples; the feature values of the second feature of each target sample are subtracted from the average feature value of the second feature to obtain the second difference value of the second feature of each target sample; the covariance between the first feature and the second feature is determined according to the encrypted difference value and the second difference value; the quotient obtained by dividing the covariance by the standard deviation is determined, and the quotient is encrypted to obtain a target value; and second exchange information including the target value is sent to the first device, so that the first device determines the correlation coefficient between the first feature and the second feature based on the target value.
[0008] The feature correlation analysis method of the embodiments of the present application, when performing correlation analysis on the second feature of the first sample set in the first device and the second feature of the second sample set in the second device, obtains a target sample corresponding to a sample identifier in the first exchange information from the second sample set, and determines the average feature value and the standard deviation of the second feature based on the feature value of the second feature of the target sample, subtracts the average feature value of the second feature from the feature value of the second feature of each target sample to obtain a second difference value of the second feature of each target sample; determines the covariance between the first feature and the second feature according to the first difference value and the second difference value; determines the quotient value obtained by dividing the covariance by the standard deviation, and encrypts the quotient value to obtain a target value; sends the second exchange information including the target value to the first device, so that the first device determines the correlation coefficient between the first feature and the second feature based on the target value. Thus, in the process of performing feature correlation analysis on the first feature and the second feature, the calculation amount and the communication data amount of the second device are reduced, and then the efficiency of determining the correlation coefficient between the first feature and the second feature is improved.
[0009] Another aspect of the embodiments of the present application proposes a feature correlation analysis device, which is configured in a first device, and includes: a first deletion module, configured to delete samples with null feature values of a first feature in a first sample set to obtain a third sample set when performing correlation analysis on the first feature of the first sample set and a second feature of a second sample set in a second device; a first determination module, configured to determine an average feature value and a standard deviation of the first feature according to feature values of the first feature of samples in the third sample set; a first processing module, configured to subtract the average feature value from the feature values to obtain difference values of the first feature of samples in the third sample set, and perform homomorphic encryption on the difference values to obtain encrypted difference values; a sending module, configured to send the encrypted difference values and sample identifiers of samples in the third sample set to the second device; a receiving module, configured to receive a target value returned by the second device, wherein the target value is obtained by encrypting a quotient value obtained by dividing a covariance between the first feature and the second feature by a standard deviation of the second feature, and the covariance is determined by the second device based on the encrypted difference values and feature values of the second feature of samples in the second sample set corresponding to the sample identifiers; and a second determination module, configured to determine a correlation coefficient between the first feature and the second feature according to the target value and the standard deviation of the first feature.
[0010] The feature correlation analysis device of the embodiment of the present application deletes the samples in which the first feature is null in the sample set in the process of determining the correlation between the first feature in the first device and the second feature in the second device, performs feature correlation processing based on the processed sample set, sends the processing result to the second device, receives the target value returned by the second device for the processing result, and determines the correlation coefficient between the first feature and the second feature based on the target value and the standard deviation of the first feature. Thus, in the process of determining the correlation coefficient between the first feature in the first device and the second feature, the data amount in the feature correlation processing process can be reduced by filtering and null processing on the sample set, the calculation amount in the feature correlation processing process can be reduced in turn, and the communication data amount between the two parties can be reduced. While the correlation coefficient between the first feature and the second feature is accurately determined, the efficiency of determining the correlation coefficient can be improved.
[0011] Another aspect of the embodiment of the present application provides a feature correlation analysis device, which is configured in a second device, and includes: a receiving module, configured to receive first exchange information from a first device when performing correlation analysis on a second feature of a first sample set in the first device and a second feature of a second sample set in the second device, wherein the first exchange information includes an encrypted difference value and sample identifiers of samples in a third sample set, the third sample set is obtained by deleting samples in which a feature value of a first feature in the first sample set is null, the encrypted difference value is obtained by homomorphic encryption of the first device on first difference values of the first feature of the samples in the third sample set, the first difference values are obtained by subtracting an average feature value of the first feature from feature values of the first feature of the samples in the third sample set, and the average feature value of the first feature is obtained by averaging the feature values of the first feature of the samples in the third sample set; a first processing module, configured to obtain a plurality of target samples corresponding to the sample identifiers from the second sample set, and determine an average feature value and a standard deviation of the second feature according to feature values of the second feature of the target samples; a second processing module, configured to subtract the average feature value of the second feature from the feature values of the second feature of the target samples to obtain second difference values of the second feature of the target samples; a first determining module, configured to determine a covariance between the first feature and the second feature according to the encrypted difference value and the second difference values; a second determining module, configured to determine a quotient value obtained by dividing the covariance by the standard deviation, and perform encryption processing on the quotient value to obtain a target value; and a sending module, configured to send second exchange information including the target value to the first device, so that the first device determines a correlation coefficient between the first feature and the second feature based on the target value.
[0012] The feature correlation analysis device according to the embodiments of the present application, when performing correlation analysis on the second features of the first sample set in the first device and the second features of the second sample set in the second device, obtains target samples corresponding to the sample identifiers in the first exchange information from the second sample set, and determines the average feature value and the standard deviation of the second features based on the feature values of the second features of the target samples, subtracts the average feature value of the second features from the feature values of the second features of each target sample to obtain second difference values of the second features of each target sample; determines the covariance between the first features and the second features according to the first difference values and the second difference values; determines the quotient obtained by dividing the covariance by the standard deviation, and encrypts the quotient to obtain a target value; and sends the second exchange information including the target value to the first device, so that the first device determines the correlation coefficient between the first features and the second features based on the target value. Thus, in the process of performing feature correlation analysis on the first features and the second features, the calculation amount and the communication data amount of the second device are reduced, and the efficiency of determining the correlation coefficient between the first features and the second features is improved.
[0013] Another aspect of the embodiments of the present application provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements any of the feature correlation analysis methods according to the embodiments of the present application when executing the program.
[0014] Another aspect of the embodiments of the present application provides a computer readable storage medium having a computer program stored thereon, wherein the program is executable on a processor to implement any of the feature correlation analysis methods according to the embodiments of the present application. BRIEF DESCRIPTION OF DRAWINGS
[0015] The accompanying drawings are used to better understand the present application, but do not limit the present application. Among them:
[0016] Figure 1 is a flowchart of a feature correlation analysis method according to an embodiment of the present application;
[0017] Figure 2 is a flowchart of a feature correlation analysis method according to another embodiment of the present application;
[0018] Figure 3 is a flowchart of a feature correlation analysis method according to another embodiment of the present application;
[0019] Figure 4 is an interaction diagram between the first device and the second device when performing feature correlation analysis according to an embodiment of the present application;
[0020] Figure 5is a structural schematic diagram of a feature correlation analysis apparatus according to an embodiment of the present application;
[0021] Figure 6 is a structural schematic diagram of a feature correlation analysis apparatus according to an embodiment of the present application;
[0022] Figure 7 is a block diagram of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0023] Embodiments of the present application are described in detail below with reference to the accompanying drawings, in which the same or similar components have the same or similar designations and functions throughout the several views and any change or modification thereof. The embodiments described below are examples in which the present application is applied to explain the present application and should not be understood as limiting the present application.
[0024] Features of a feature correlation analysis method, apparatus, electronic device and storage medium according to embodiments of the present application are described below with reference to the accompanying drawings.
[0025] Figure 1 is a flowchart of a feature correlation analysis method according to an embodiment of the present application. It should be noted that the feature correlation analysis method provided in this embodiment is applied to a first device, that is, the feature correlation analysis method provided in this embodiment is executed by the first device, wherein the first device in this example can be implemented in software and / or hardware, and the first device in this embodiment can be a PC (Personal Computer), a mobile device, a tablet computer or a server, etc., which is not limited here.
[0026] As shown in Figure 1 , the feature correlation analysis method can include:
[0027] In step 101, when performing correlation analysis on the first feature of the first sample set and the second feature of the second sample set in the second device, samples in which the feature value of the first feature in the first sample set is a null value are deleted to obtain a third sample set.
[0028] It should be noted that the first device and the second device in this example are different devices, for example, the first device and the second device can be devices corresponding to different partners.
[0029] In some embodiments, there can be a large number of missing feature values of the first feature of the samples in the first sample set, that is, there can be a large number of samples with null values of the feature values of the first feature in the first sample set. In the related art, in order to facilitate the correlation analysis to proceed normally, the null values of the missing feature values are usually filled with, for example, 0, and then the correlation calculation is performed based on the first sample set after filling. However, these arbitrary fillings without any meaning cause unnecessary consumption of encryption, calculation and communication. Therefore, in the present example embodiment, when the first feature of the first sample set and the second feature of the second sample set in the second device are analyzed for correlation, the samples with null values of the feature values of the first feature in the first sample set are directly deleted to obtain a third sample set. Thus, the calculation amount and the amount of encrypted data of the first device in the feature correlation analysis process can be reduced, the consumption of the calculation resources of the resources of the first device can be reduced, and the amount of data sent by the first device to the second device can be reduced.
[0030] In step 102, the average feature value and the standard deviation of the first feature are determined according to the feature values of the first feature of each sample in the third sample set.
[0031] In the present example embodiment, the feature values of the first feature of each sample in the third sample set can be averaged to obtain the average feature value of the first feature. Correspondingly, the standard deviation of the first feature is determined according to the feature values of the first feature of each sample in the third sample set and the average feature value.
[0032] In step 103, the feature values are subtracted from the average feature value to obtain the difference values of the first feature of each sample in the third sample set, and the difference values are homomorphically encrypted to obtain encrypted difference values.
[0033] In the present example embodiment, after the difference values of the first feature of each sample in the third sample set are determined, the difference values can be homomorphically encrypted by using the homomorphic encryption technology to obtain the encrypted difference values. Thus, while protecting the data in the first device, the corresponding second device can perform correlation processing based on the encrypted difference values without affecting the calculation results.
[0034] In the present example, the result obtained by homomorphically encrypting the difference values is referred to as the encrypted difference value.
[0035] In step 104, the encrypted difference values and the sample identifiers of each sample in the third sample set are sent to the second device.
[0036] It can be understood that the first device and the second device in the present example can communicate.
[0037] In an example embodiment, in order to ensure the security in the data communication process, the sample identifier of each sample in the third sample set can be further subjected to hash processing before the sample identifier of each sample in the third sample set is sent to the second device.
[0038] Step 105: receiving the target value returned by the second device.
[0039] The target value is a ciphered quotient value obtained by dividing the covariance between the first feature and the second feature by the standard deviation of the second feature.
[0040] The covariance is determined by the second device based on the ciphered difference value and the feature value of the second feature of the sample corresponding to the sample identifier in the second sample set.
[0041] In an example implementation, the example process for the second device to determine the covariance between the first feature and the second feature is as follows: the second device acquires a plurality of target samples corresponding to the sample identifier from the second sample set, and determines the average feature value of the second feature based on the feature values of the second feature of the plurality of target samples, and subtracts the average feature value of the second feature from the feature value of the second feature of each target sample to obtain the difference value of the second feature of each target sample, and then determines the covariance between the first feature and the second feature according to the difference value of the second feature of each target sample and the ciphered difference value.
[0042] In some example implementations, the example process for the second device to determine the standard deviation value of the second feature is as follows: the standard deviation of the second feature is determined according to the feature value of the second feature of each target sample and the average feature value of the second feature.
[0043] It can be understood that the number of target samples in the example and the number of samples in the third sample set are the same. For example, the number of samples in the third sample set is 5, and correspondingly, the first device can send the sample identifier of each sample in the third sample set to the second device, and correspondingly, the second device acquires the target sample corresponding to each sample identifier from the second sample set. At this time, the number of target samples is 5.
[0044] Step 106: determining the correlation coefficient between the first feature and the second feature according to the target value and the standard deviation of the first feature.
[0045] In the example implementation, the target value can be decrypted, and the quotient value obtained by dividing the decrypted target value by the standard deviation of the first feature is taken as the correlation coefficient between the first feature and the second feature.
[0046] It should be noted that the encryption algorithm used by the second device when encrypting the target value corresponds to the decryption algorithm used by the second device when decrypting the target device. For example, the first device and the second device can agree on an encryption algorithm and a decryption algorithm corresponding to the encryption algorithm in advance.
[0047] In the process of determining the correlation between the first feature in the first device and the second feature in the second device, the sample set in which the first feature is empty is deleted, and the feature correlation processing is performed based on the processed sample set, and the processing result is sent to the second device, and the target value returned by the second device for the processing result is received, and the correlation coefficient between the first feature and the second feature is determined based on the target value and the standard deviation of the first feature. Thus, in the process of determining the correlation coefficient between the first feature in the first device and the second feature, by filtering the null value processing of the sample set, the amount of data in the feature correlation processing can be reduced, and the amount of calculation in the feature correlation processing can be reduced, and the amount of communication data between the two parties can be reduced. While accurately determining the correlation coefficient between the first feature and the second feature, the efficiency of determining the correlation coefficient can be improved.
[0048] Based on the above embodiment, in order to further reduce the calculation amount of the first device and reduce the consumption of the calculation resources of the first device, before deleting the samples in which the feature value of the first feature in the first sample set is empty to obtain the third sample set, the intersection of the first sample set and the second sample set can be obtained to obtain the common samples of the first sample set and the second sample set, and the other samples in the first sample set except the common samples are deleted.
[0049] In order to clearly understand the present application, the following will be described in combination with Figure 2 The feature correlation analysis method of this embodiment is described exemplarily, as shown in Figure 2 may include:
[0050] Step 201, when performing correlation analysis on the first feature of the first sample set and the second feature of the second sample set of the second device, the intersection of the first sample set and the second sample set is obtained to obtain the common samples of the first sample set and the second sample set.
[0051] Step 202, deleting the other samples in the first sample set except the common samples.
[0052] Step 203, deleting the samples in which the feature value of the first feature in the first sample set is empty to obtain the third sample set.
[0053] In step 204, the average feature value and the standard deviation of the first feature are determined according to the feature values of the first feature of each sample in the third sample set.
[0054] In step 205, the feature values are subtracted by the average feature value to obtain the difference values of the first feature of each sample in the third sample set.
[0055] In step 206, the difference values are homomorphic encrypted to obtain encrypted difference values.
[0056] In step 207, the sample identifiers of each sample in the third sample set are hashed to obtain the hash values of the sample identifiers of each sample in the third sample set.
[0057] In step 208, the encrypted difference values and the hash values are sent to the second device.
[0058] In step 209, the target value returned by the second device is received.
[0059] The target value is obtained by encrypting the quotient of the covariance between the first feature and the second feature and the standard deviation of the second feature.
[0060] The covariance is determined by the second device based on the encrypted difference values and the feature values of the second feature of the samples in the second sample set corresponding to the hash values.
[0061] Correspondingly, after receiving the multiple hash values sent by the first device, the second device hashes the sample identifiers of each sample in the second sample set, and performs intersection processing with the received multiple hash values to obtain common hash values. Then, the target sample identifier corresponding to the common hash values is determined, and the target sample corresponding to the target sample identifier is obtained from the second sample set. Thus, the second device can filter out the null values without service information, and the computational complexity of the second device is greatly reduced.
[0062] Correspondingly, the second device determines the standard deviation of the second feature and the average feature value of the second feature according to the feature value of the second feature of the target sample, and then subtracts the average feature value of the second feature from the feature of the second feature of the target sample to obtain the difference value of the second feature of the target sample. The covariance between the first feature and the second feature is determined based on the difference value of the second feature of the target sample and the encrypted difference value.
[0063] In step 210, the correlation coefficient between the first feature and the second feature is determined according to the target value and the standard deviation of the first feature.
[0064] For specific implementation of step 210, refer to the related description in the above embodiments, which will not be repeated here.
[0065] In the present example, before performing the feature correlation analysis, the first device first deletes the samples in the first sample set whose feature values of the first feature are null values, and then the second device performs a second intersection operation on the sample identifiers in the processing result received from the first device and the sample identifiers corresponding to the second device, and based on the common sample identifiers obtained through the second intersection operation, the second device calculates the feature correlation between the two devices. In this way, the first device can reduce the amount of ciphertext calculation and the amount of communication messages through the null value filtering, and the second device can further reduce the amount of ciphertext calculation through the second intersection operation, thereby improving the calculation efficiency of the feature correlation analysis between the two devices.
[0066] Figure 3 is a flowchart of a feature correlation analysis method according to an embodiment of the present application. It should be noted that the feature correlation analysis method provided in the present embodiment is applied to a second device, that is, the feature correlation analysis method provided in the present embodiment can be executed by a second device, which can be implemented in software and / or hardware. The second device in the present embodiment can be a PC (Personal Computer), a mobile device, a tablet computer, a server, or the like, which is not limited here.
[0067] As shown in Figure 3 , the feature correlation analysis method comprises the following steps.
[0068] In step 301, when performing the correlation analysis on the second feature of the first sample set in the first device and the second feature of the second sample set in the second device, the first intersection information from the first device is received.
[0069] The first intersection information comprises an encrypted difference and sample identifiers of the samples in the third sample set. The third sample set is obtained by deleting the samples in the first sample set whose feature values of the first feature are null values.
[0070] The encrypted difference is obtained by homomorphically encrypting the first difference of the first feature of each sample in the third sample set by the first device.
[0071] For specific description of how the first device determines the encrypted difference, reference can be made to the related description of the above embodiments, which will not be repeated here.
[0072] The first difference is obtained by subtracting the average feature value of the first feature from the feature value of the first feature of each sample in the third sample set.
[0073] The average feature value of the first feature is obtained by averaging the feature values of the first feature of each sample in the third sample set.
[0074] At step 302, a plurality of target samples corresponding to the sample identifier are obtained from the second sample set, and an average feature value and a standard deviation of the second feature are determined according to the feature values of the second feature of the plurality of target samples.
[0075] In an example embodiment, after the plurality of target samples are determined, the feature values of the second feature of the plurality of target samples are averaged to obtain the average feature value of the second feature.
[0076] Correspondingly, the standard deviation of the first feature is determined according to the feature values of the second feature of the plurality of target samples and the average feature value of the second feature.
[0077] At step 303, the feature value of the second feature of each target sample is subtracted by the average feature value of the second feature to obtain a second difference value of the second feature of each target sample.
[0078] At step 304, the covariance between the first feature and the second feature is determined according to the encrypted difference value and the second difference value.
[0079] At step 305, a quotient value obtained by dividing the covariance by the standard deviation is determined, and the quotient value is encrypted to obtain a target value.
[0080] The encryption algorithm used by the second device when performing the encryption processing is previously negotiated with the first device.
[0081] At step 306, the second exchange information including the target value is sent to the first device, so that the first device determines the correlation coefficient between the first feature and the second feature based on the target value.
[0082] Correspondingly, after the first device receives the target value, the first device can perform decryption processing on the target device to obtain a decrypted target value, and then, a quotient value obtained by dividing the decrypted target value by the standard deviation of the first feature is taken as the correlation coefficient between the first feature and the second feature.
[0083] The specific process of determining the standard deviation of the first feature in the first device can be referred to in the related description of the above embodiments, and will not be described here. The feature correlation analysis method of the embodiments of the present application, when performing correlation analysis on the second feature of the first sample set in the first device and the second feature of the second sample set in the second device, obtains the target sample corresponding to the sample identifier in the first exchange information from the second sample set, and determines the average feature value and the standard deviation of the second feature based on the feature value of the second feature of the target sample. Subtract the average feature value of the second feature from the feature value of the second feature of each target sample to obtain the second difference value of the second feature of each target sample; determine the covariance between the first feature and the second feature according to the first difference value and the second difference value; determine the quotient value obtained by dividing the covariance by the standard deviation, and encrypt the quotient value to obtain the target value; send the second exchange information including the target value to the first device, so that the first device determines the correlation coefficient between the first feature and the second feature based on the target value. Thus, in the process of performing feature correlation analysis on the first feature and the second feature, the calculation amount and the communication data amount of the second device are reduced, and then the efficiency of determining the correlation coefficient between the first feature and the second feature is improved.
[0084] Based on the above embodiments, in order to further reduce the calculation amount of the second device, in some exemplary embodiments, before receiving the first exchange information from the first device, the first sample set and the second sample set can also be intersected to obtain the common samples of the first sample set and the second sample set; delete the samples other than the common samples in the second sample set.
[0085] As an example, the sample identifiers of the first sample set and the sample identifiers of the second sample set can be securely calculated to obtain the common sample identifiers of the first sample set and the second sample set, and then the common samples of the first sample set and the second sample set are determined according to the common sample identifiers.
[0086] In order to clearly understand the present application, the following will be described in combination with Figure 4 The feature correlation analysis method of this embodiment is described, for example, in the feature correlation analysis of the first feature A in the first sample set and the second feature B in the second sample set. In this example, the sample identifiers corresponding to the samples in the first sample set and the second sample set are the same as an example. It should be noted that the features corresponding to the samples in the first sample set and the second sample set are different.
[0087] As Figure 4 indicated, it can include:
[0088] Step 401, the first device filters out the samples with the feature value of the first feature being null in the first sample set, and takes the filtered first sample set as a third sample set.
[0089] Step 402, the first device determines the average feature value of the first feature according to the feature value of the first feature of each sample in the third sample set.
[0090] For example, the third sample set includes n samples, and x i represents the feature value of the first feature of the i th sample in the third sample set, and the average value of the first feature can be represented as
[0091] Step 403, subtract the average feature value of the first feature from the feature value of the first feature of each sample in the third sample set to obtain the difference value of the first feature of each sample in the third sample set.
[0092] In the above example, the difference value of the first feature of the i th sample in the third sample set is
[0093] Step 404, the first device determines the standard deviation of the first feature according to the difference value of the first feature of each sample in the third sample set.
[0094] Specifically, the difference value of the first feature of each sample in the third sample set is summed to obtain a corresponding sum value, and the sum value is square rooted to obtain the standard deviation of the first feature.
[0095] In the above example, the standard deviation of the first feature A is
[0096] Step 405, the first device encrypts the difference value δ Ai of the first feature by using a homomorphic encryption technology, hashes the sample identifiers of each sample in the third sample set, and sends the encrypted δ Ai and the hashed sample identifiers to the second device.
[0097] Step 406, the second device hashes the sample identifiers of each sample in the second sample set, and performs intersection again with the received hashed sample identifiers, and determines a plurality of target sample identifiers according to the intersection result.
[0098] It should be noted that in the present example, the value of the target sample identifier is the same as the value of the sample identifier of each sample in the third sample set in the first device.
[0099] In the present example, by performing intersection again, the second device can remove the null value without business significance, and reduce the subsequent calculation amount.
[0100] Step 407, the second device obtains the target sample corresponding to the target sample identifier from the second sample set, and averages the feature values of the second feature of the target sample to obtain the average feature value of the second feature.
[0101] For example, n target samples are determined, and the target value is denoted by y i The average value of the first feature can be denoted by
[0102] Step 408, the second device subtracts the average feature value of the second feature from the feature value of the second feature of each target sample to obtain the difference value of the second feature of each target sample.
[0103] In the above example, the difference value of the second feature of the i-th target sample is
[0104] Step 409, the second device determines the standard deviation of the second feature according to the difference value of the second feature of each sample in the third sample set.
[0105] Specifically, the difference value of the second feature of each target sample is summed to obtain a corresponding sum value, and the square root of the sum value is taken to obtain the standard deviation of the second feature.
[0106] In the above example, the standard deviation of the second feature B is
[0107] Step 410, the second device determines the target value according to the standard deviation of the second feature, the above encrypted difference value, and the difference value of the second feature of each target sample.
[0108] For example, the target value is denoted by β B Correspondingly,
[0109] Step 411, the second device encrypts the target value and sends the encrypted target value to the first device.
[0110] Step 412, the first device decrypts the received encrypted target value to obtain the target value, and divides the target value by the standard deviation of the first feature to obtain the correlation coefficient between the first feature and the second feature.
[0111] Correspondingly, the correlation coefficient between the first feature and the second feature is Wherein, in the formula, α A Indicates the standard deviation of the first feature.
[0112] Corresponding to the feature correlation analysis method provided by the above-mentioned embodiments, an embodiment of the present application further provides a feature correlation analysis device. Since the feature correlation analysis device provided by the embodiment of the present application corresponds to the feature correlation analysis method provided by the above-mentioned embodiments, the implementation of the feature correlation analysis method is also applicable to the feature correlation analysis device of the present embodiment. In the present embodiment, the detailed description is not given again.
[0113] Figure 5 is a structural schematic diagram of the feature correlation analysis device according to an embodiment of the present application.
[0114] As shown in Figure 5 , the feature correlation analysis device is configured in the first device. The feature correlation analysis device 500 includes a first deletion module 501, a first determination module 502, a first processing module 503, a sending module 504, a receiving module 505, and a second determination module 506. Wherein:
[0115] The first deletion module 501 is configured to, when performing correlation analysis on the first feature of the first sample set and the second feature of the second sample set in the second device, delete the samples in which the feature value of the first feature in the first sample set is a null value, to obtain a third sample set.
[0116] The first determination module 502 is configured to determine the average feature value and the standard deviation of the first feature according to the feature value of the first feature of each sample in the third sample set.
[0117] The first processing module 503 is configured to subtract the average feature value from the feature value to obtain the difference value of the first feature of each sample in the third sample set, and homomorphically encrypt the difference value to obtain an encrypted difference value.
[0118] The sending module 504 is configured to send the encrypted difference value and the sample identifier of each sample in the third sample set to the second device.
[0119] The receiving module 505 is configured to receive the target value returned by the second device, wherein the target value is obtained by encrypting the quotient value obtained by dividing the covariance between the first feature and the second feature by the standard deviation of the second feature. The covariance is determined by the second device based on the encrypted difference value and the feature value of the second feature of the sample corresponding to the sample identifier in the second sample set.
[0120] The second determination module 506 is configured to determine the correlation coefficient between the first feature and the second feature according to the target value and the standard deviation of the first feature.
[0121] In an embodiment of the present application, the device further includes:
[0122] The hash processing module is configured to hash the sample identifiers of the samples in the third sample set.
[0123] In an embodiment of the present application, the second determining module 506 is specifically configured to: decrypt the target value; and divide the decrypted target value by the standard deviation of the first feature to obtain a quotient value as the correlation coefficient between the first feature and the second feature.
[0124] In an embodiment of the present application, the apparatus further includes a second processing module configured to intersect the first sample set and the second sample set to obtain common samples of the first sample set and the second sample set.
[0125] The second deleting module is configured to delete the samples other than the common samples in the first sample set.
[0126] The feature correlation analysis apparatus of the embodiments of the present application, in the process of determining the correlation between the first feature in the first device and the second feature in the second device, deletes the samples with the first feature as null in the sample set, and performs the feature correlation processing based on the processed sample set, sends the processing result to the second device, receives the target value returned by the second device for the processing result, and determines the correlation coefficient between the first feature and the second feature based on the target value and the standard deviation of the first feature. Thus, in the process of determining the correlation coefficient between the first feature in the first device and the second feature, by filtering and processing the null values of the sample set, the data amount in the feature correlation processing process can be reduced, and then the calculation amount in the feature correlation processing process can be reduced, and the communication data amount between the two parties can be reduced. While the correlation coefficient between the first feature and the second feature is accurately determined, the efficiency of determining the correlation coefficient can be improved.
[0127] Figure 6 is a structural schematic diagram of a feature correlation analysis apparatus according to another embodiment of the present application. The feature correlation analysis apparatus is configured in the second device.
[0128] As shown in Figure 6 the feature correlation analysis apparatus 600 includes a receiving module 601, a first processing module 602, a second processing module 603, a first determining module 604, a second determining module 605, and a sending module 606. Wherein:
[0129] The receiving module 601 is configured to receive the first exchange information from the first device when performing the correlation analysis on the second feature of the first sample set in the first device and the second feature of the second sample set in the second device.
[0130] The first exchange information includes an encrypted difference value and sample identifiers of samples in a third sample set, the third sample set is obtained by deleting samples with a feature value of the first feature being null in the first sample set, the encrypted difference value is obtained by homomorphic encryption of the first device on first difference values of the first feature of the samples in the third sample set, the first difference value is obtained by subtracting an average feature value of the first feature from the feature value of the first feature of the samples in the third sample set, and the average feature value of the first feature is obtained by averaging the feature values of the first feature of the samples in the third sample set.
[0131] The first processing module 602 is configured to acquire a plurality of target samples corresponding to the sample identifier from the second sample set, and determine an average feature value and a standard deviation of the second feature according to feature values of the second feature of the plurality of target samples.
[0132] The second processing module 603 is configured to subtract the average feature value of the second feature from the feature value of the second feature of each target sample to obtain a second difference value of the second feature of each target sample.
[0133] The first determining module 604 is configured to determine a covariance between the first feature and the second feature according to the encrypted difference value and the second difference value.
[0134] The second determining module 605 is configured to determine a quotient value obtained by dividing the covariance by the standard deviation, and perform encryption processing on the quotient value to obtain a target value.
[0135] The sending module 606 is configured to send second exchange information including the target value to the first device, so that the first device determines a correlation coefficient between the first feature and the second feature based on the target value.
[0136] In an embodiment of the present application, the apparatus can further include:
[0137] The intersection processing module is configured to intersect the first sample set and the second sample set to obtain common samples of the first sample set and the second sample set.
[0138] The deleting module is configured to delete samples other than the common samples in the second sample set.
[0139] The feature correlation analysis device provided in the embodiments of the present application, when performing correlation analysis on the second features of the first sample set in the first device and the second features of the second sample set in the second device, obtains target samples corresponding to sample identifiers in the first exchange information from the second sample set, and determines the average feature value and the standard deviation of the second features based on the feature values of the second features of the target samples, subtracts the average feature value of the second features from the feature values of the second features of the target samples to obtain second difference values of the second features of the target samples; determines the covariance between the first features and the second features according to the first difference values and the second difference values; determines a quotient value obtained by dividing the covariance by the standard deviation, and performs encryption processing on the quotient value to obtain a target value; and sends the second exchange information including the target value to the first device, so that the first device determines the correlation coefficient between the first features and the second features based on the target value. Thus, in the process of performing feature correlation analysis on the first features and the second features, the calculation amount and the communication data amount of the second device are reduced, and the efficiency of determining the correlation coefficient between the first features and the second features is improved.
[0140] According to the embodiments of the present application, the present application further provides an electronic device and a readable storage medium.
[0141] Figure 7 is a structural block diagram of an electronic device according to an embodiment of the present application.
[0142] As shown in Figure 7 , the electronic device 700 includes a memory 710, a processor 720, and computer instructions stored in the memory 710 and executable on the processor 720.
[0143] The processor 720 implements the feature correlation analysis method provided in the above embodiments when executing the instructions.
[0144] Further, the electronic device 700 further includes:
[0145] A communication interface 730 for communication between the memory 710 and the processor 720.
[0146] The memory 710 is used to store computer instructions executable on the processor 720.
[0147] The memory 710 can include a high-speed RAM memory, and can also include a non-volatile memory (non-volatile memory), such as at least one disk memory.
[0148] The processor 720 is used to execute the program to implement the feature correlation analysis method of the above embodiments.
[0149] If the memory 710, the processor 720 and the communication interface 730 are implemented independently, the communication interface 730, the memory 710 and the processor 720 can be connected with each other through a bus and complete communication between each other. The bus can be an Industry Standard Architecture (ISA) bus, a Per ipheral Component (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 7 Only one thick line is used to represent the bus in the figure, but it does not mean that there is only one bus or only one type of bus.
[0150] Optionally, in a specific implementation, if the memory 710, the processor 720 and the communication interface 730 are integrated on a chip, the memory 710, the processor 720 and the communication interface 730 can complete communication between each other through an internal interface.
[0151] The processor 720 can be a central processing unit (CPU), or an application specific integrated circuit (ASIC), or one or more integrated circuits configured to implement one or more embodiments of the present application.
[0152] Another aspect of the embodiments of the present application provides a computer readable storage medium, which stores a computer program, and the computer program is executed by a processor to implement the feature correlation analysis method of any of the embodiments of the present application.
[0153] In the description of the present specification, the description of the terms "one embodiment", "some embodiments", "an example", "a specific example" or "some examples" means that the specific features, structures, materials or characteristics described in connection with the embodiment or example are included in at least one embodiment or example of the present application. In the present specification, the illustrative description of the above terms does not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described can be combined in any appropriate manner in any one or more embodiments or examples. In addition, the person skilled in the art can combine and combine the different embodiments or examples described in the present specification and the features of the different embodiments or examples without contradiction.
[0154] Furthermore, the terms "first", "second", etc. are used only for descriptive purposes and do not connote or imply relative importance or a quantity of the indicated technical features. Thus, a feature defined with "first", "second", etc. can include at least one of the features implicitly or explicitly. In the description of the present application, the meaning of "a plurality" is at least two, for example, two, three, etc., unless otherwise specifically defined.
[0155] Although the embodiments of the present application have been shown and described above, it is understood that the above-described embodiments are exemplary and are not to be construed as limiting the present application, and that changes, modifications, substitutions and variations can be made by those skilled in the art without departing from the scope of the present application.
Claims
1. A feature correlation analysis method, characterized in that, The method is performed by a first device, and the method includes: When performing correlation analysis on the first feature of the first sample set and the second feature of the second sample set in the second device, the samples in the first sample set whose feature value of the first feature is null are deleted to obtain the third sample set. Based on the feature values of the first feature of each sample in the third sample set, determine the average feature value and standard deviation of the first feature; Subtract the average feature value from the feature value to obtain the difference of the first feature of each sample in the third sample set, and perform homomorphic encryption on the difference to obtain the encrypted difference; Send the encrypted difference and the sample identifier of each sample in the third sample set to the second device; The second device receives a target value, wherein the target value is obtained by encrypting the quotient obtained by dividing the covariance between the first feature and the second feature by the standard deviation of the second feature, and the covariance is determined by the second device based on the encrypted difference and the feature value of the second feature of the sample corresponding to the sample identifier in the second sample set. The correlation coefficient between the first feature and the second feature is determined based on the target value and the standard deviation of the first feature.
2. The method as described in claim 1, characterized in that, Before sending the first exchange information to the second device, the method further includes: The sample identifiers of each sample in the third sample set are hashed.
3. The method as described in claim 1, characterized in that, Determining the correlation coefficient between the first feature and the second feature based on the target value and the standard deviation of the first feature includes: Decrypt the target value; The quotient obtained by dividing the decrypted target value by the standard deviation of the first feature is used as the correlation coefficient between the first feature and the second feature.
4. The method according to any one of claims 1-3, characterized in that, Before deleting samples from the first sample set whose feature values for the first feature are null to obtain the third sample set, the method further includes: The intersection of the first sample set and the second sample set is obtained to find the common samples of the first sample set and the second sample set; Delete all samples in the first sample set except for the common samples.
5. A feature correlation analysis method, characterized in that, The method is performed by a second device, and the method includes: When performing correlation analysis on the second feature of the first sample set in the first device and the second feature of the second sample set in the second device, first exchange information is received from the first device. The first exchange information includes an encrypted difference and a sample identifier of each sample in the third sample set. The third sample set is obtained by deleting samples in the first sample set whose feature values of the first feature are null. The encrypted difference is obtained by homomorphically encrypting the first difference of the first feature of each sample in the third sample set by the first device. The first difference is obtained by subtracting the average feature value of the first feature from the feature value of the first feature of each sample in the third sample set. The average feature value of the first feature is obtained by averaging the feature values of the first feature of each sample in the third sample set. Multiple target samples corresponding to the sample identifier are obtained from the second sample set, and the average feature value and standard deviation of the second feature are determined based on the feature values of the second feature of the multiple target samples. Subtract the average feature value of the second feature from the feature value of the second feature of each target sample to obtain the second difference of the second feature of each target sample; Based on the encryption difference and the second difference, determine the covariance between the first feature and the second feature; The quotient obtained by dividing the covariance by the standard deviation is determined, and the quotient is encrypted to obtain the target value; Send second exchange information, including the target value, to the first device so that the first device determines the correlation coefficient between the first feature and the second feature based on the target value.
6. The method as described in claim 5, characterized in that, Before receiving the first exchange information from the first device, the method further includes: The intersection of the first sample set and the second sample set is obtained to find the common samples of the first sample set and the second sample set; Delete all samples in the second sample set except for the common samples.
7. A feature correlation analysis device, characterized in that, The device is disposed in the first equipment, and the device includes: The first deletion module is used to delete samples in the first sample set whose feature value of the first feature is null when performing correlation analysis between the first feature of the first sample set and the second feature of the second sample set in the second device, so as to obtain a third sample set. The first determining module is used to determine the average feature value and standard deviation of the first feature based on the feature values of the first feature of each sample in the third sample set. The first processing module is used to subtract the average feature value from the feature value to obtain the difference of the first feature of each sample in the third sample set, and to perform homomorphic encryption on the difference to obtain the encrypted difference. The sending module is used to send the encryption difference and the sample identifier of each sample in the third sample set to the second device; The receiving module is configured to receive the target value returned by the second device, wherein the target value is obtained by encrypting the quotient obtained by dividing the covariance between the first feature and the second feature by the standard deviation of the second feature, and the covariance is determined by the second device based on the encrypted difference and the feature value of the second feature of the sample corresponding to the sample identifier in the second sample set; The second determining module is used to determine the correlation coefficient between the first feature and the second feature based on the target value and the standard deviation of the first feature.
8. The apparatus as claimed in claim 7, characterized in that, The device further includes: The hash processing module is used to perform hash processing on the sample identifiers of each sample in the third sample set.
9. The apparatus as claimed in claim 7, characterized in that, The second determining module is specifically used for: Decrypt the target value; The quotient obtained by dividing the decrypted target value by the standard deviation of the first feature is used as the correlation coefficient between the first feature and the second feature.
10. The apparatus according to any one of claims 7-9, characterized in that, The device further includes: The second processing module is used to find the intersection of the first sample set and the second sample set to obtain the common samples of the first sample set and the second sample set; The second deletion module is used to delete other samples in the first sample set besides the common samples.
11. A feature correlation analysis device, characterized in that, The device is configured in the second device, and the device includes: A receiving module is configured to receive first exchange information from the first device when performing correlation analysis on the second features of the first sample set in the first device and the second features of the second sample set in the second device. The first exchange information includes an encrypted difference and a sample identifier of each sample in a third sample set. The third sample set is obtained by deleting samples in the first sample set whose feature values of the first feature are null. The encrypted difference is obtained by homomorphically encrypting the first difference of the first feature of each sample in the third sample set by the first device. The first difference is obtained by subtracting the average feature value of the first feature from the feature value of the first feature of each sample in the third sample set. The average feature value of the first feature is obtained by averaging the feature values of the first feature of each sample in the third sample set. The first processing module is used to obtain multiple target samples corresponding to the sample identifier from the second sample set, and to determine the average feature value and standard deviation of the second feature based on the feature values of the second feature of the multiple target samples; The second processing module is used to subtract the average feature value of the second feature from the feature value of the second feature of each target sample to obtain the second difference value of the second feature of each target sample. The first determining module is used to determine the covariance between the first feature and the second feature based on the encryption difference and the second difference; The second determining module is used to determine the quotient obtained by dividing the covariance by the standard deviation, and to encrypt the quotient to obtain the target value; The sending module is configured to send second exchange information including the target value to the first device, so that the first device determines the correlation coefficient between the first feature and the second feature based on the target value.
12. The apparatus as claimed in claim 11, characterized in that, The device further includes: The intersection processing module is used to find the intersection of the first sample set and the second sample set to obtain the common samples of the first sample set and the second sample set; The deletion module is used to delete samples from the second sample set other than the common samples.
13. An electronic device, characterized in that, include: A memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, when the processor executes the program, it implements the feature correlation analysis method as described in any one of claims 1-4, or the feature correlation analysis method as described in any one of claims 5-6.
14. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the feature correlation analysis method as described in any one of claims 1-4, or the feature correlation analysis method as described in any one of claims 5-6.
Citation Information
Patent Citations
Feature correlation calculation method, device and equipment, and computer readable storage medium
CN111079164A
Correlation coefficient calculation method, device and equipment, and computer storage medium
CN114091043A