Logistic regression method, device and system based on full homomorphic encryption

By using fully homomorphic encryption technology in collaborative processing between research institutions and cloud servers, the problems of big data privacy protection and inefficiency in cloud computing are solved, enabling efficient and secure data training and computation.

CN116192358BActive Publication Date: 2025-10-24XIDIAN UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211572710.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-08
Publication Date
2025-10-24
Estimated Expiration
2042-12-08

AI Technical Summary

Technical Problem

Existing technologies suffer from inefficiency and poor training performance on large datasets in big data privacy protection and machine learning algorithms, especially in cloud computing environments where data privacy cannot be guaranteed and computational complexity is high.

Method used

By employing fully homomorphic encryption technology, the dimensionality of the data is reduced through dimensionality reduction and preprocessing at the research institution level, and preprocessing and standardization are performed on the cloud server level. Combined with a dual-cloud model, this enables offline operation by the data owner.

Benefits of technology

It improves the training efficiency and accuracy of large datasets, ensures data security and convenience, and realizes true cloud computing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116192358B_ABST
    Figure CN116192358B_ABST
Patent Text Reader

Abstract

The application discloses a kind of logical regression method, device and system based on homomorphic encryption, mainly applied to research institution and cloud server end, specifically including the following steps: step 1, research institution generates public-private key pair;Step 2, cloud server obtains ciphertext data set uploaded by financial company;Step 3, cloud server pre-processes ciphertext data set;Step 4, research institution calculates eigenvalue and eigenvector of covariance matrix;Step 5, cloud server obtains dimensionality-reduced data set ciphertext;Step 6, cloud server carries out logical regression model operation, and with research institution cooperates and calculates new model parameter after a round of iteration;Step 7, repeat step 6 and carry out cyclic iteration, until reach maximum iteration number, obtain final model parameter.The application is based on homomorphic encryption technology to encrypt financial data, dimensionality reduction is carried out to large dimension ciphertext data, improve the efficiency of model training in logical regression algorithm, improve the practicability of algorithm.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application belongs to the technical field of computer, and particularly relates to a logistic regression method, device and system based on homomorphic encryption. BACKGROUND

[0002] With the rapid development of cloud computing, its powerful computing capability and huge storage space provide strong support for the calculation and processing of big data, so big data is usually combined with cloud computing. Cloud computing has an important influence on the analysis of big data, and provides a configurable computing environment that can be effectively managed and quickly deployed. By offloading the calculation of data to the cloud, cloud customers can easily and conveniently use computing resources without being limited by resource equipment.

[0003] Although cloud computing has various advantages, there are still many challenges in privacy protection, and the storage of data related to big data in the cloud has attracted more and more attention. In the process of collecting big data, some sensitive or proprietary information may be included, and once leaked, it will lead to disastrous consequences. Therefore, it is necessary to encrypt the data participating in cloud computing. However, machine learning algorithms cannot directly access encrypted data. If the decryption key is provided to the cloud server, data privacy cannot be guaranteed. Therefore, it is a challenging problem to process encrypted data using machine learning algorithms running on the cloud.

[0004] The author Kim constructed a privacy-preserving logistic regression algorithm in his published paper "Ensemble Method for Privacy-Preserving Logistic Regression Based on Homomorphic Encryption" (IEEE Access, 2018) using the feature that homomorphic encryption technology can perform arbitrary calculations on ciphertext. The method has the following shortcomings: as the number of iterations increases, the calculation depth of the ciphertext also increases, and in order to avoid the influence of noise on decryption, a large encryption parameter must be set. The larger the encryption parameter, the longer the time required for encryption and decryption and ciphertext operation, resulting in low efficiency of the overall scheme; and the scheme is only suitable for small data sets, and the training results for large data sets are poor.

[0005] Fan in his published paper "Privacy preserving based logistic regression on big data" (Journal of Network and Computer Applications, 2020) proposes that the cloud server sends the ciphertext to the data owner after each round of iteration, and the latter decrypts and performs gradient descent, and then sends the new model parameters to the cloud server for a new round of iteration. By decrypting and re-encrypting the data owner, the calculation depth of the ciphertext can be reduced, so that the maximum encryption parameter in the kim and Song scheme does not need to be set, thereby improving the efficiency of the scheme. The shortcomings of this method are: the data owner needs to be online during the entire model training process. And this scheme has large calculation amount, low efficiency and high communication complexity for large data sets. SUMMARY

[0006] In order to solve the problem of low efficiency and poor training effect of large-dimensional data set in the prior art, the present application provides a logistic regression method, device and system based on full homomorphic encryption. The technical problem to be solved by the present application is solved by the following technical scheme:

[0007] In a first aspect, the present application provides a logistic regression method based on full homomorphic encryption, applied to research institutions, comprising:

[0008] S11: generating a public and private key pair based on the full homomorphic CKKS cryptographic algorithm;

[0009] S12: in response to receiving the covariance matrix ciphertext C X , decrypt it, and calculate the dimension reduction matrix P based on the decrypted covariance matrix X;

[0010] S13: encrypt the dimension reduction matrix P to obtain the ciphertext vector C P , and transmit it to the cloud server;

[0011] S14: in response to receiving the gradient ciphertext vector of the jth iteration, decrypt it, and correct the model parameters according to the decrypted plaintext gradient vector g j ; encrypt the corrected model parameters to obtain the parameter ciphertext of the j+1th iteration, and transmit it to the cloud server;

[0012] S15: continuously receive the gradient ciphertext vector, and repeat step S14 until the maximum iteration number is reached, to obtain the final model parameters.

[0013] In a second aspect, the present invention provides a logistic regression method based on fully homomorphic encryption, which is applied to a cloud server, comprising:

[0014] S21: Get the ciphertext vector C and label ciphertext C uploaded by the user L ; Wherein, the ciphertext vector C is the ciphertext vector corresponding to the feature data, and the ciphertext C L is the ciphertext corresponding to the label data, and the ciphertext vector C and the label ciphertext C L All are encrypted based on the fully homomorphic CKKS cryptographic algorithm;

[0015] S22: Preprocess the ciphertext vector C to obtain a new ciphertext vector C z and the covariance matrix ciphertext C X , and the covariance matrix ciphertext C X sent to research institutions;

[0016] S23: In response to receiving the ciphertext vector C P , based on the ciphertext vector C z and the ciphertext vector C P Calculate the ciphertext vector C after normalization and dimensionality reduction Y ;

[0017] S24: Based on the ciphertext vector C Y and the parameter ciphertext of the current j-th iteration Gradient ciphertext vector for solving the loss function and send it to research institutions;

[0018] S25: In response to receiving the parameter ciphertext Repeat step S24 until the maximum number of iterations is reached.

[0019] In a third aspect, the present invention provides a logistic regression device based on fully homomorphic encryption, which is applied to research institutions and includes:

[0020] Key generation module, used to generate public and private key pairs based on the fully homomorphic CKKS cryptographic algorithm;

[0021] The first dimensionality reduction module is configured to receive the covariance matrix ciphertext C in response to X , decrypt it, and calculate the dimension reduction matrix P based on the decrypted covariance matrix X;

[0022] Encryption module (13), used for encrypting the dimension reduction matrix P to obtain a ciphertext vector C P and transmit it to the cloud server;

[0023] The first computing module is configured to receive the gradient ciphertext vector of the jth iteration in response to decrypting the same and obtaining a plaintext gradient vector g according to the decrypted plaintext j correcting the model parameters and encrypting the corrected model parameters to obtain parameter ciphertext of the j+1th iteration and transmitting to the cloud server.

[0024] In a fourth aspect, the present application provides a logistic regression device based on homomorphic encryption, applied to a cloud server, comprising:

[0025] a data acquisition module configured to acquire ciphertext vector C and label ciphertext C uploaded by a user L ; wherein the ciphertext vector C is a ciphertext vector corresponding to feature data, the ciphertext C is a ciphertext corresponding to label data, and the ciphertext vector C and the label ciphertext C are both encrypted based on a homomorphic CKKS encryption algorithm; L L

[0026] a preprocessing module configured to preprocess the ciphertext vector C to obtain a new ciphertext vector C and a covariance matrix ciphertext C z , and send the covariance matrix ciphertext C to a research institution; X X

[0027] a second dimension reduction module configured to, in response to receiving the ciphertext vector C P , calculate a ciphertext vector C z that has been standardized and reduced in dimension based on the ciphertext vector C P and the ciphertext vector C Y ;

[0028] a second calculation module configured to solve a gradient ciphertext vector of a loss function based on the ciphertext vector C Y and the parameter ciphertext of the current jth iteration and send the same to the research institution.

[0029] In a fifth aspect, the present application provides a logistic regression system based on homomorphic encryption, comprising the logistic regression device based on homomorphic encryption applied to the research institution end and the logistic regression device based on homomorphic encryption applied to the cloud server end provided in the above embodiments.

[0030] The present application has the following advantages:

[0031] ​​​​​1、The privacy protection logistic regression scheme adopted in the present application carries out dimension reduction processing on the encrypted financial data set before iteration, reduces the data dimension, reduces the interference of irrelevant feature items, thereby reducing the calculation amount, and improving the efficiency and accuracy, and has good training effect on large data sets; and the method adopts a double cloud model in the financial field, so that the data owner can be offline after uploading his own data, which ensures the security of customer data, does not need to be online in real time, improves the convenience, and realizes real cloud computing;

[0032] 2、The present application carries out preprocessing on the encrypted financial data set before iteration, since the batch processing technology is used to encrypt the data set column by column during encryption, the calculation of the mean, variance and covariance can be carried out simultaneously on n data, thereby improving the efficiency;

[0033] 3、The present application carries out preprocessing on the encrypted financial data set before iteration, standardizes the data set, subtracts the mean value from the original value and divides by the standard deviation, so that the obtained features satisfy the normal distribution with a mean of 0 and a standard deviation of 1; thereby allowing the features between different dimensions to have certain comparability in numerical value, and the size of the obtained parameters can reflect the contribution of different features to the sample, which can greatly improve the accuracy. BRIEF DESCRIPTION OF DRAWINGS

[0034] Figure 1 is a flowchart of a logistic regression method based on full homomorphic encryption applied to a research institution end provided by an embodiment of the present application;

[0035] Figure 2 is a flowchart of a logistic regression method based on full homomorphic encryption applied to a cloud server end provided by an embodiment of the present application;

[0036] Figure 3 is a structural schematic diagram of a logistic regression device based on full homomorphic encryption applied to a research institution end provided by an embodiment of the present application;

[0037] Figure 4 is a structural schematic diagram of a logistic regression device based on full homomorphic encryption applied to a cloud server end provided by an embodiment of the present application;

[0038] Figure 5 is a structural schematic diagram of a logistic regression system based on full homomorphic encryption provided by an embodiment of the present application;

[0039] Figure 6 is a working flowchart of a logistic regression system based on full homomorphic encryption provided by an embodiment of the present application. DETAILED DESCRIPTION

[0040] The application will be further described in detail below with reference to specific embodiments, but the embodiments of the application are not limited thereto.

[0041] Embodiment one

[0042] The embodiment provides a full homomorphic encryption-based logistic regression method applied to a research institution end. Figure 1 , Figure 1 The embodiment of the application provides a flowchart of a full homomorphic encryption-based logistic regression method applied to a research institution end, and the flowchart comprises the following steps.

[0043] S11: generating a public-private key pair based on a full homomorphic CKKS encryption algorithm.

[0044] Specifically, at the research institution end, a key generation algorithm in the encryption algorithm in the full homomorphic CKKS encryption algorithm is used to generate a required public-private key pair {pk, sk}.

[0045] The key generation algorithm in the CKKS encryption algorithm comprises the following steps.

[0046] Step 1, initializing security parameters λ and depth upper limit L. Setting N as a power of 2, modulus Q=p L , wherein p>0. The set parameters must satisfy the security parameter requirement, that is, the following formula is satisfied:

[0047]

[0048] Step 2, constructing a polynomial quotient ring

[0049] Step 3, randomly and uniformly sampling a private key related distribution χ s , a random distribution χ r , and an error distribution χ e from a discrete Gaussian distribution χ on the polynomial quotient ring R.

[0050] Step 4, randomly selecting a polynomial s from χ s to compose the private key, randomly selecting a polynomial e from χ e as an error distribution polynomial, and randomly and uniformly selecting a polynomial a from R to compose the public key.

[0051] Step 5, setting the private key sk=(1, s) and the public key pk=(b, a), wherein b=-a·s+e mod Q.

[0052] S12: in response to receiving the covariance matrix ciphertext C X , decrypting the covariance matrix ciphertext C X , and calculating a dimension reduction matrix P based on the decrypted covariance matrix X.

[0053] Specifically, when receiving the covariance matrix ciphertext C X , first decrypt the covariance matrix ciphertext using the CKKS encryption algorithm to obtain the plaintext form of the covariance matrix X;

[0054] Then calculate the eigenvalues and eigenvectors of the covariance matrix X.

[0055] According to the size of the eigenvalues, the eigenvectors are arranged from top to bottom in a matrix, and the first k rows are taken to form a new matrix, obtaining the dimension reduction matrix P.

[0056] At this point, the matrix is reduced from the original m dimensions to k dimensions.

[0057] S13: Encrypt the dimension reduction matrix P to obtain the ciphertext vector C P , and transmit it to the cloud server.

[0058] Specifically, continue to use the CKKS encryption algorithm to encrypt the dimension reduction matrix P to obtain the ciphertext vector C P , and transmit it to the cloud server.

[0059] S14: In response to receiving the gradient ciphertext vector C , decrypt it, and according to the decrypted plaintext gradient vector g j , correct the model parameters; encrypt the corrected model parameters to obtain the parameter ciphertext C of the j+1 iteration, and transmit it to the cloud server.

[0060] Specifically, when receiving the gradient ciphertext vector C of the jth iteration sent by the cloud server, first decrypt it using the CKKS encryption algorithm to obtain the plaintext gradient vector g j .

[0061] The steps of the CKKS decryption algorithm are as follows:

[0062] Step 1, calculate the ciphertext decryption result according to the following formula:

[0063] m' = <c, sk> mod Q

[0064] = ((-a·s+e)·r+m+e0)+(a·r·s+e1·s) mod Q

[0065] = e·r+m+e0+e1·s mod Q

[0066] ≈ m

[0067] Where m' is the decryption result, which is an approximation of the plaintext m.

[0068] Then, according to the plaintext gradient vector gj Correct the new model parameters, that is, calculate the model parameters of the next iteration wherein,

[0069]

[0070] is a preset learning rate, i represents the dimension of the gradient vector, and 1≤i≤k, and j represents the current iteration number.

[0071] It should be noted that when j is 1, is the initial model parameter, which can be set by the user.

[0072] Finally, the corrected model parameter w j+1 is encrypted to obtain the parameter ciphertext and transmitted to the cloud server, so that the cloud server starts a new round of iteration.

[0073] S15: Continuously receive the gradient ciphertext vector, and repeat step S14 until the maximum iteration number is reached, to obtain the final model parameter.

[0074] The embodiment performs dimension reduction processing on the encrypted data set before iteration, reduces the data dimension, reduces the interference of irrelevant feature items, thereby reducing the calculation amount, and improves the efficiency and accuracy.

[0075] Embodiment two

[0076] The embodiment provides a logistic regression method based on full homomorphic encryption applied to the cloud server side. Please refer to Figure 2 , Figure 2 is a flowchart of a logistic regression method based on full homomorphic encryption applied to the cloud server side provided by the embodiment of the application, which comprises:

[0077] S21: Obtain the ciphertext vector C uploaded by the user and the label ciphertext C L ; wherein the ciphertext vector C is a ciphertext vector corresponding to the feature data, and the ciphertext C L is a ciphertext corresponding to the label data, and the ciphertext vector C and the label ciphertext C L are both encrypted based on the full homomorphic CKKS encryption algorithm.

[0078] First, the financial company uses the CKKS encryption algorithm to encrypt the data.

[0079] Specifically, the financial company uses the public key pk to use the CKKS encryption algorithm to encrypt the customer data set matrix D to obtain the ciphertext vector C={C1,...,C m} and the ciphertext C L . The matrix D is an n x (m+1) matrix, and is specifically as follows:

[0080]

[0081] where each row represents the entire data of a customer, and there are n customer data in total, and each row of customer data has m feature data d i,j and 1 label data l i For each column vector z i of the matrix D 1,i , {d 1,i ,...,d n,i}, the CKKS encryption algorithm is used to encrypt to obtain ciphertext C i , and for the data representing the classification label of the customer in the last column, the CKKS encryption algorithm is used to encrypt to obtain ciphertext C L .

[0082] Specifically, the steps of the CKKS encryption algorithm are as follows:

[0083] Step 1, randomly select polynomials e0 and e1 from χ e as error distribution polynomials, and randomly select a polynomial r from χ r as a random distribution polynomial.

[0084] Step 2, for a plaintext polynomial m ∈ R, calculate the corresponding ciphertext according to the following formula:

[0085] C = r · pk + (m + e0, e1) mod Q

[0086] where the ciphertext vector C corresponds to a vector of plaintexts. Since the CKKS encryption algorithm supports encrypting a group of real number vectors into a ciphertext, the operation on the ciphertext is equivalent to the operation on each element in the vector in parallel, and this function is called ciphertext batch processing.

[0087] Then, the financial company uploads the ciphertext vector C and the ciphertext C L to the cloud server.

[0088] S22: Preprocess the ciphertext vector C to obtain a new ciphertext vector C z and a covariance matrix ciphertext C X , and send the covariance matrix ciphertext C X to the research institution.

[0089] 22a) Calculate the mean μ i and the standard deviation σ i of each ciphertext C i in the ciphertext vector C.

[0090] First, calculate the mean μ i .

[0091] This embodiment uses batch processing technology to average the data of each feature. Each feature data vector is encrypted to the corresponding ciphertext C i In the ciphertext C i After performing cyclic shift summing, divide by the number of data items m to obtain the mean μ of each column of the data set, that is, each feature i .

[0092] Specifically, the steps of batch processing technology are as follows:

[0093] Step 1: Use the rotate function on the ciphertext CT1 to shift each ciphertext vector in CT1 left by 1 bit to obtain the ciphertext CT2. The details are as follows:

[0094] CT2=rotate(CT1)

[0095] Among them, the ciphertext CT1=Enc(v1,v2,...,v m ), CT2=Enc(v2,v3,...v m ,v1), Enc(·) is the CKKS encryption algorithm.

[0096] Step 2: Add the ciphertext CT1 and ciphertext CT2 to get the new ciphertext CT. The ciphertext CT is as follows:

[0097] CT=Enc(v1+v2,v2+v3,...,v m-1 +v m ,v m +v1)

[0098] Step 3: Repeat the above two steps m times, where m is the dimension of the plaintext vector. After cyclic shift and summation n times, the total ciphertext is as follows:

[0099]

[0100] The plaintext vector corresponding to the sum ciphertext is the sum of each dimension of the vector.

[0101] Then, calculate the standard deviation σ i .

[0102] Specifically, here we still use batch processing technology to calculate the standard deviation of each feature data. For each ciphertext C in the ciphertext vector C i Subtract the corresponding mean μ i Then multiply the ciphertext C i , then cyclically shift and sum and divide by the number of data items n to get the variance of each column of the data set, that is, each feature Variance The standard deviation σ can be obtained by performing an approximate square root operation i .

[0103] The steps of the approximate square root operation are as follows:

[0104] Step 1. Set a0=x, b0=x-1.

[0105] Step 2, iterate 3 times, where

[0106] Step 3: After the iteration, get the square root approximation of x

[0107] This embodiment preprocesses the encrypted financial dataset before iteration. Since batch processing technology is used to encrypt the dataset column by column, the mean, variance, and covariance can be calculated simultaneously for n pieces of data, thereby improving efficiency.

[0108] 22b) For each ciphertext C in the ciphertext vector C i Perform normalization to obtain the new ciphertext vector C z ={C z1 ,C z2 ,...,C zm}, expressed as:

[0109]

[0110] This embodiment preprocesses the encrypted financial data set before iteration and standardizes the data set. The original value is subtracted from the mean and then divided by the standard deviation, so that the obtained features satisfy the normal distribution with a mean of 0 and a standard deviation of 1. This allows the features of different dimensions to be numerically comparable to a certain extent, and the resulting parameter size can reflect the contribution of different features to the sample, which can greatly improve accuracy.

[0111] 22c) According to the ciphertext vector C z Calculate the covariance matrix ciphertext C X , the calculation formula is:

[0112]

[0113] Among them, T represents transposition, and n represents the number of data in the dataset.

[0114] S23: In response to receiving the ciphertext vector C P , based on the ciphertext vector C z and the ciphertext vector C P Calculate the ciphertext vector C after normalization and dimensionality reduction Y .

[0115] Specifically, the received ciphertext vector C P and the ciphertext vector C obtained in step 22b)z C = C Y , and the expression is:

[0116] C Y = C P C z T ;

[0117] Wherein, T represents the transpose.

[0118] At this time, the ciphertext C Y The corresponding plaintext data set has been reduced from the original m-dimensional to k-dimensional, and the number of features has been reduced from m to k.

[0119] S24: based on the ciphertext vector C Y And the parameter ciphertext of the current jth iteration Solve the gradient ciphertext vector of the loss function And send it to the research institution.

[0120] In this embodiment, the ciphertext gradient vector Has k dimensions, denoted as

[0121] First, the i-th dimension of the ciphertext gradient vector of the loss function in the current jth iteration Is calculated in turn The calculation formula is:

[0122]

[0123] Wherein, j represents the current iteration number, C Y,i The i-th dimension of the vector in the ciphertext vector C Y , n represents the number of data in the data set, and the function f(x) is a polynomial approximation function of the sigmoid function in the logistic regression operation, as follows:

[0124]

[0125] Then, the ciphertext gradient vector Is sent to the research institution so that the research institution can update the model parameters.

[0126] S25: in response to receiving the parameter ciphertext Repeat step S24 until the maximum iteration number is reached.

[0127] Specifically, after receiving the parameter ciphertext of the j+1th iteration sent by the research institution According to the operation of step S25, continue to execute until the maximum iteration number is reached.

[0128] The privacy protection logistic regression scheme adopted by the application carries out dimension reduction processing on the encrypted financial data set before iteration, reduces the data dimension, reduces the interference of irrelevant feature items, thereby reducing the calculation amount, and improving the efficiency and accuracy, and has good training effect on large data sets; and the method adopts a double cloud model in the financial field, so that the data owner can be offline after uploading his own data, which ensures the security of customer data, and does not need to be online in real time, improves the convenience, and realizes real cloud computing.

[0129] Embodiment three

[0130] On the basis of the above-mentioned embodiment one, the embodiment provides a logistic regression device based on full homomorphic encryption applied to a research institution end. Figure 3 , Figure 3 is a structural schematic diagram of a logistic regression device based on full homomorphic encryption applied to a research institution end provided by the embodiment of the application, which comprises:

[0131] A key generation module 11 is configured to generate a public and private key pair based on a full homomorphic CKKS cryptographic algorithm;

[0132] A first dimension reduction module 12 is configured to, in response to receiving a covariance matrix ciphertext C X , decrypt it, and calculate a dimension reduction matrix P based on the decrypted covariance matrix X;

[0133] An encryption module 13 is configured to encrypt the dimension reduction matrix P to obtain a ciphertext vector C P , and transmit it to a cloud server;

[0134] A first calculation module 14 is configured to, in response to receiving a gradient ciphertext vector of the jth iteration, decrypt it, and correct model parameters according to a plaintext gradient vector g j obtained by decryption; encrypt the corrected model parameters to obtain parameter ciphertext of the j+1th iteration, and transmit it to the cloud server.

[0135] The device provided by the embodiment can implement the method provided by the above-mentioned embodiment one, and the detailed process is not introduced here.

[0136] Therefore, the device provided by the embodiment can also reduce the calculation amount, and improve the efficiency and accuracy.

[0137] Embodiment four

[0138] On the basis of the above-mentioned embodiment two, the embodiment provides a logistic regression device based on full homomorphic encryption applied to a cloud server end. Please refer to Figure 4 , Figure 4This is a schematic diagram of the structure of a logistic regression device based on fully homomorphic encryption applied to a cloud server provided by an embodiment of the present invention, which includes:

[0139] Data acquisition module 21, used to obtain the ciphertext vector C and label ciphertext C uploaded by the user L ; Among them, the ciphertext vector C is the ciphertext vector corresponding to the feature data, and the ciphertext C L is the ciphertext corresponding to the label data, and the ciphertext vector C and the label ciphertext C L All are encrypted based on the fully homomorphic CKKS cryptographic algorithm;

[0140] The preprocessing module 22 is used to preprocess the ciphertext vector C to obtain a new ciphertext vector C z and the covariance matrix ciphertext C X , and the covariance matrix ciphertext C X sent to research institutions;

[0141] The second dimensionality reduction module 23 is configured to receive the ciphertext vector C in response to the ciphertext vector C received. P , based on the ciphertext vector C z and the ciphertext vector C P Calculate the ciphertext vector C after normalization and dimensionality reduction Y ;

[0142] The second calculation module 24 is used to calculate the ciphertext vector C based on the ciphertext vector C. Y and the parameter ciphertext of the current j-th iteration Gradient ciphertext vector for solving the loss function and send it to research institutions.

[0143] The device provided in this embodiment can implement the method provided in the above-mentioned embodiment 2, and the detailed process will not be introduced here.

[0144] Therefore, the device provided by this embodiment can also reduce the amount of calculation while improving efficiency and accuracy.

[0145] Example 5

[0146] This embodiment provides a logistic regression system based on fully homomorphic encryption, which mainly includes a research institution end device and a cloud server end device. Figure 5 , Figure 5 This is a schematic diagram of the structure of a logistic regression system based on fully homomorphic encryption provided by an embodiment of the present invention. The research institution-side device is the device provided by the above-mentioned embodiment 3, and the cloud server-side device is the device provided by the above-mentioned embodiment 4.

[0147] The working process of the logistic regression system based on fully homomorphic encryption provided in this embodiment is as follows: Figure 6 As shown:

[0148] 1. The research institution generates an encryption system public-private key pair through the key generation module 11;

[0149] 2. The cloud server obtains the encrypted data set uploaded by the financial company through the data acquisition module 21;

[0150] 3. The cloud server performs preprocessing operations on the encrypted data set through the preprocessing module 22, including mean value, standard deviation and covariance matrix, and transmits the covariance matrix ciphertext to the research institution;

[0151] 4. The research institution calculates the eigenvalues and eigenvectors of the covariance matrix using the first dimension reduction module 12 to perform dimension reduction operations, and then encrypts and transmits to the cloud server through the encryption module 13;

[0152] 5. The cloud server calculates the dimension-reduced data set ciphertext through the second dimension reduction module 23;

[0153] 6. The cloud server uses the second calculation module 24 to perform logistic regression model operations, and sends the obtained gradient ciphertext vector to the research institution;

[0154] 7. The research institution updates the model parameters using the first calculation module 14, and sends the new model parameters to the cloud server after encryption;

[0155] 8. The cloud server starts a new round of iterative calculation, and stops iteration when the number of iterations reaches the preset value of the research institution, and obtains the final trained model parameters.

[0156] The detailed working process of the logistic regression system based on full homomorphic encryption provided in this embodiment can refer to the above-mentioned embodiments one and two, and will not be introduced here.

[0157] The privacy protection logistic regression scheme adopted by the present application performs dimension reduction processing on the encrypted financial data set before iteration, reduces the data dimension, reduces the interference of irrelevant feature items, thereby reducing the calculation amount, and improves the efficiency and accuracy, and has good training effect on large data sets; and the method adopts a double cloud model in the financial field, so that the data owner can be offline after uploading his own data, which ensures the security of customer data, and does not need to be online in real time, improves the convenience, and realizes real cloud computing.

[0158] The above is a further detailed description of the present application in combination with a specific preferred embodiment, and cannot be considered as limiting the specific implementation of the present application to these descriptions. For ordinary skilled persons in the technical field to which the present application belongs, without departing from the concept of the present application, a number of simple deductions or substitutions can be made, which should be considered as falling within the protection scope of the present application.

Claims

1. A method for logistic regression based on homomorphic encryption, applied to a research institution, characterized in that, Comprising: S11: generating a public-private key pair based on a full homomorphic CKKS cryptographic algorithm; S12: in response to receiving the covariance matrix ciphertext , decrypting the same, and performing eigenvalue decomposition on the decrypted covariance matrix X to obtain a dimension reduction matrix ; wherein the covariance matrix ciphertext is obtained by the cloud server through batch processing technology on the ciphertext vector uploaded by the user after standardization preprocessing. S13: encrypt the dimension reduction matrix to obtain a ciphertext vector and transmit it to the cloud server ​ S14: in response to receiving the first j gradient ciphertext vector of the second iteration , decrypting the same, and according to the plaintext gradient vector obtained by decryption , correcting the model parameters; encrypting the corrected model parameters to obtain the parameter ciphertext of the first j+ iteration , and transmitting to the cloud server to enable the cloud server to solve the gradient ciphertext vector of the first j+ iteration of the second iteration S15: continuously receiving a gradient ciphertext vector, and repeating step S14 until a maximum iteration number is reached, to obtain a final model parameter.

2. The homomorphic encryption based logistic regression method of claim 1, wherein, Step S12 comprises: The covariance matrix is ​​encrypted using the CKKS cryptographic algorithm Decrypt and get the covariance matrix in plain text X ; computing eigenvalues and eigenvectors of the covariance matrix X of the covariance matrix According to the eigenvalue size, the eigenvectors are arranged from top to bottom into a matrix by rows, and the first k rows are taken to form a new matrix, obtaining a reduced dimension matrix . 3.The full homomorphic encryption based logistic regression method of claim 1, wherein, Step S14 comprises: decrypting the current received first iteration gradient ciphertext vector using the CKKS cryptographic algorithm to obtain a plaintext gradient vector j ;​​ According to the plaintext gradient vector Correct the new model parameters ; wherein, ; is a preset learning rate, i denotes the dimension of the gradient vector, and 1≤ i ≤ k , j denotes the current iteration number; The modified model parameters The parameter ciphertext is obtained by encryption And is transmitted to the cloud server.

4. A homomorphic encryption-based logistic regression method applied to a cloud server, characterized in that, Comprising: S21: Obtain the ciphertext vector uploaded by the user and the label ciphertext ; wherein the ciphertext vector is a ciphertext vector corresponding to the feature data, the ciphertext is a ciphertext corresponding to the label data, and the ciphertext vector and the label ciphertext are obtained by encryption based on the fully homomorphic CKKS cryptographic algorithm; S22: preprocessing the ciphertext vector by using batch processing technology to obtain a new ciphertext vector S23: calculating the covariance matrix ciphertext of the new ciphertext vector S24: sending the covariance matrix ciphertext to the research institution ​​ S23: in response to receiving the ciphertext vector , calculating a ciphertext vector after standardization and dimension reduction based on the ciphertext vector and the ciphertext vector ; wherein the ciphertext vector is obtained by the research institution decrypting the received covariance matrix ciphertext , performing eigenvalue decomposition on the decrypted covariance matrix X to obtain a dimension reduction matrix , and then encrypting the dimension reduction matrix ; S24: a ciphertext vector is generated based on the plaintext vector and the parameters of the current j iteration S25: a gradient ciphertext vector is solved by solving the loss function , and is sent to the research institution, so that the research institution decrypts the gradient ciphertext vector , and corrects the model parameters according to the decrypted plaintext gradient vector . S25: In response to receiving the parameter ciphertext Step S24 is repeated until a maximum number of iterations is reached.

5. The homomorphic encryption based logistic regression method of claim 4, wherein, Step S22 comprises: averaging the ciphertexts in the ciphertext vector ;​​​ The ciphertext vectors are standardized to obtain new ciphertext vectors ​​​ ; According to the ciphertext vector Computing the covariance matrix ciphertext The calculation formula is: ; wherein T denotes the transpose, n denotes the number of data in the data set.

6. The homomorphic encryption based logistic regression method of claim 4, wherein, Step S23 comprises: The received ciphertext vector is multiplied by the ciphertext vector to obtain the normalized and dimension-reduced ciphertext vector , which is expressed as ; in, T Indicates transpose.

7. The homomorphic encryption based logistic regression method of claim 4, wherein, In step S24 comprises: The gradient ciphertext vector of the loss function in the current iteration is calculated in sequence j The gradient ciphertext vector of the loss function in the current iteration is calculated in sequence The gradient ciphertext vector of the loss function in the current iteration is calculated in sequence i The gradient ciphertext vector of the loss function in the current iteration is calculated in sequence The gradient ciphertext vector of the loss function in the current iteration is calculated in sequence ; wherein, n represents the number of data in the data set, is a polynomial approximation function of sigmoid function in logistic regression operation; represents the label ciphertext, represents the ciphertext vector in the i dimensional vector.

8. A device for logistic regression based on homomorphic encryption, applied to a research institution, characterized in that, Comprising: A key generation module (11) for generating a public-private key pair based on a full homomorphic CKKS cryptographic algorithm; A first dimensionality reduction module (12) is configured to receive the covariance matrix ciphertext in response to , decrypt it, and decrypt the covariance matrix X Perform eigenvalue decomposition to obtain the reduced dimension matrix ; Wherein, the covariance matrix ciphertext It is the ciphertext vector uploaded by the cloud server for the user Obtained through standardized preprocessing using batch processing techniques; Encryption module (13), used for the dimension reduction matrix Encrypt to get the ciphertext vector , and transmit it to the cloud server so that the cloud server can solve the j+ Gradient ciphertext vector of 1 iteration; The first computing module (14) is configured to, in response to receiving the first iteration of the gradient ciphertext vector j , decrypt the gradient ciphertext vector of the second iteration , and modify the model parameters according to the decrypted plaintext gradient vector ; and encrypt the modified model parameters to obtain the parameter ciphertext of the first iteration j+ , and transmit the parameter ciphertext of the first iteration to the cloud server.​ 9.A device for logistic regression based on homomorphic encryption, applied to a cloud server, characterized in that, Comprising: The data acquisition module (21) is configured to acquire a ciphertext vector uploaded by a user and a label ciphertext ; wherein the ciphertext vector is a ciphertext vector corresponding to feature data, the ciphertext is a ciphertext corresponding to label data, and the ciphertext vector and the label ciphertext are both encrypted based on a fully homomorphic CKKS cryptographic algorithm. A pre-processing module (22) is used to process the ciphertext vector using a batch processing technique. Perform preprocessing to obtain a new ciphertext vector and covariance matrix ciphertext , and encrypt the covariance matrix sent to research institutions; The second dimensionality reduction module (23) is configured to respond to receiving the ciphertext vector , based on the ciphertext vector and the ciphertext vector Calculate the ciphertext vector after normalization and dimensionality reduction ; Wherein, the ciphertext vector The research institute receives the covariance matrix ciphertext Decrypt and decrypt the covariance matrix X Perform eigenvalue decomposition to obtain the reduced dimension matrix , and then the dimension reduction matrix Encrypted to obtain; The second calculation module (24) is used to calculate the ciphertext vector and the current j The parameter ciphertext of the iteration Gradient ciphertext vector for solving the loss function , and send it to the research institution so that the research institution can analyze the gradient ciphertext vector Decrypt and use the decrypted plaintext gradient vector Correct model parameters.

10. A homomorphic encryption based logistic regression system, comprising: A logic regression device based on full homomorphic encryption according to any one of claims 8 and 9.

Citation Information

Patent Citations

  • Metering device alarm prediction method and device based on federated learning

    CN111737749A

  • Medical data sharing privacy protection method based on fully homomorphic encryption

    CN114978467A