Singular value decomposition methods, apparatus, computer equipment and media

CN116383583BActive Publication Date: 2026-08-14HANGZHOU QULIAN TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-03-01
Publication Date
2026-08-14

AI Technical Summary

Technical Problem

但是,通常奇异值分解所需要的特征数据是分散的

Benefits of technology

[0040]本申请实施例,每个数据持有方可以对应一个第一设备,每个第一设备或第二设备上可以包括数据矩阵,多个第一设备和第二设备的数据矩阵组成了需要进行奇异值分解的全量矩阵。由于需要进行数据保密,因此,第一设备可以确定数据矩阵与均值矩阵的差值矩阵,并根据差值矩阵,计算第一特征值和中间矩阵,中间矩阵包括数据矩阵的全部特征;将第一特征值发送至各个第二设备,并将中间矩阵发送至目标第二设备;接收各个第二设备返回的第二特征值,第二特征值根据第二设备的差值矩阵和第二设备接收到的中间矩阵得到;每个第二设备在计算得到第二特征值之后可以将第二特征值发送至各个第二设备及第一设备,这样每个设备均可以根据第一特征值和第二特征值,确定全量矩阵的特征值,全量矩阵由第一设备的数据矩阵和第二设备的数据矩阵共同组成;确定全量矩阵的特征向量;将全量矩阵的特征向量发送至各个第二设备,以在各个第二设备上完成对全量矩阵的奇异值分解第二设备在获得特征值和特征向量的同时,实现了对全量矩阵的数据保密。本申请实施例通过不需要通过协调方,而是基于计算在实现数据保密的同时,获得了全量矩阵的特征值和特征向量,从而在保护各个数据持有方的隐私数据的前提下,完成了全量矩阵的奇异值分解。

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116383583B_ABST
    Figure CN116383583B_ABST
Patent Text Reader

Abstract

This application, applicable to the field of machine learning technology, provides a singular value decomposition method, apparatus, computer device, and medium. The method includes: determining a difference matrix; calculating a first eigenvalue and an intermediate matrix based on the difference matrix; sending the first eigenvalue to each second device and sending the intermediate matrix to a target second device; receiving second eigenvalues ​​returned by each second device, the second eigenvalues ​​being obtained based on the difference matrix of the second device and the intermediate matrix received by the second device; determining the eigenvalues ​​of the full matrix based on the first and second eigenvalues, the full matrix being composed of the data matrices of the first and second devices; determining the eigenvectors of the full matrix; and sending the eigenvalues ​​and eigenvectors of the full matrix to each second device to complete the singular value decomposition of the full matrix on each second device. This method enables singular value decomposition of joint data without using a coordinator.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application belongs to the field of machine learning technology, and in particular relates to a singular value decomposition method, apparatus, computer equipment and medium. Background Technology

[0002] Singular Value Decomposition (SVD) is a widely used algorithm in machine learning. It can be used not only for feature decomposition in dimensionality reduction algorithms, but also for recommendation systems and natural language processing. For example, SVD can be used for dimensionality reduction in Principal Component Analysis (PCA).

[0003] Currently, performing singular value decomposition (SVD) requires obtaining complete feature data. However, the feature data needed for SVD is usually scattered. In many scenarios with high data confidentiality requirements, different data holders do not share their data. To achieve data confidentiality, SVD needs to be performed without observing the data of other holders.

[0004] Currently, most singular value decomposition methods are based on Trusted Execution Environment (TEE) hardware and Paillier encryption, requiring additional third-party coordination during the singular value decomposition process. Summary of the Invention

[0005] In view of this, embodiments of this application provide a singular value decomposition method to improve the singular value decomposition of joint data without the application of a coordinating party.

[0006] A first aspect of this application provides a singular value decomposition method, applied to a first device, comprising:

[0007] Determine a difference matrix, which is the difference between the data matrix and the mean matrix of the first device. The data matrix includes the numerical values ​​of the features, and the mean matrix is ​​composed of the average value of the feature values ​​in each column of the data matrix.

[0008] Based on the difference matrix, calculate the first eigenvalue and the intermediate matrix, wherein the intermediate matrix includes all the features of the data matrix;

[0009] The first feature value is sent to each of the second devices, and the intermediate matrix is ​​sent to the target second device;

[0010] Receive the second feature value returned by each of the second devices, the second feature value being obtained based on the difference matrix of the second devices and the intermediate matrix received by the second devices;

[0011] Based on the first eigenvalue and the second eigenvalue, the eigenvalues ​​of the full matrix are determined, wherein the full matrix is ​​composed of the data matrix of the first device and the data matrix of the second device.

[0012] Determine the eigenvectors of the full matrix;

[0013] The eigenvectors of the full matrix are sent to each of the second devices to perform singular value decomposition of the full matrix on each of the second devices.

[0014] A second aspect of this application provides a singular value decomposition method applied to a third device, the method comprising:

[0015] Determine the difference matrix, which is the difference between the data matrix and the mean matrix of the third device, wherein the data matrix includes the numerical values ​​of the features, and the mean matrix is ​​composed of the average value of the numerical values ​​of the features in each column of the data matrix;

[0016] A plurality of first matrices are determined based on the difference matrix, and the sum of the plurality of first matrices is the product of the transpose of the difference matrix and the difference matrix.

[0017] Each of the third matrices is encrypted to obtain a third encryption result, which includes the third encryption matrix corresponding to each of the third matrices.

[0018] The third encryption result is sent to the corresponding fourth device to obtain the aggregation matrix returned by the fourth device. The aggregation matrix is ​​obtained by aggregating the third encryption result and the fourth encryption result of the fourth device.

[0019] Determine the complete matrix corresponding to the aggregation matrix, the complete matrix being used to characterize all features of the full matrix composed of the data matrices of the third device and multiple fourth devices;

[0020] The eigenvalues ​​and eigenvectors of the complete matrix are calculated to perform singular value decomposition of the complete matrix on the third device.

[0021] A third aspect of this application provides a singular value decomposition apparatus, applied to a first device, comprising:

[0022] A difference matrix determination module is used to determine a difference matrix, wherein the difference matrix is ​​the difference between the data matrix and the mean matrix of the first device, the data matrix includes the numerical values ​​of the features, and the mean matrix is ​​composed of the average value of the numerical values ​​of the features in each column of the data matrix;

[0023] The feature calculation module is used to calculate a first feature value and an intermediate matrix based on the difference matrix, wherein the intermediate matrix includes all features of the data matrix;

[0024] The sending module is used to send the first feature value to each of the second devices and to send the intermediate matrix to the target second device;

[0025] The receiving module is used to receive the second feature value returned by each of the second devices, the second feature value being obtained based on the difference matrix of the second devices and the intermediate matrix received by the second devices;

[0026] The eigenvalue determination module is used to determine the eigenvalues ​​of the full matrix based on the first eigenvalue and the second eigenvalue, wherein the full matrix is ​​composed of the data matrix of the first device and the data matrix of the second device.

[0027] The eigenvector determination module is used to determine the eigenvectors of the full matrix;

[0028] The singular value decomposition module is used to send the eigenvectors of the full matrix to each of the second devices, so as to complete the singular value decomposition of the full matrix on each of the second devices.

[0029] A fourth aspect of this application provides a singular value decomposition method, the method comprising:

[0030] A difference matrix determination module is used to determine a difference matrix, wherein the difference matrix is ​​the difference between the data matrix and the mean matrix of the third device, the data matrix includes the numerical values ​​of the features, and the mean matrix is ​​composed of the average value of the numerical values ​​of the features in each column of the data matrix;

[0031] The difference matrix splitting module is used to determine multiple first matrices based on the difference matrix, wherein the sum of the multiple first matrices is the product of the transpose of the difference matrix and the difference matrix.

[0032] An encryption module is used to encrypt each of the third matrices to obtain a third encryption result, wherein the third encryption result includes the third encryption matrix corresponding to each of the third matrices;

[0033] A sending module is used to send the third encryption result to the corresponding fourth device to obtain an aggregation matrix returned by the fourth device. The aggregation matrix is ​​obtained by aggregating the third encryption result and the fourth encryption result of the fourth device.

[0034] A complete matrix determination module is used to determine the complete matrix corresponding to the aggregate matrix, wherein the complete matrix is ​​used to characterize all features of the full matrix composed of the data matrices of the third device and multiple fourth devices;

[0035] A singular value decomposition module is used to calculate the eigenvalues ​​and eigenvectors of the complete matrix to perform singular value decomposition on the complete matrix on the third device.

[0036] A fifth aspect of this application provides a computer device including a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the method described in the first or second aspect above.

[0037] A sixth aspect of this application provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in the first or second aspect above.

[0038] A seventh aspect of this application provides a computer program product that, when run on a computer device, causes the computer device to perform the method described in the first or second aspect.

[0039] Compared with the prior art, the embodiments of this application have the following advantages:

[0040] In this embodiment, each data holder can correspond to a first device. Each first device or second device can include a data matrix. The data matrices of multiple first devices and second devices form a full matrix that requires singular value decomposition. Due to the need for data confidentiality, the first device can determine the difference matrix between the data matrix and the mean matrix, and calculate a first eigenvalue and an intermediate matrix based on the difference matrix. The intermediate matrix includes all features of the data matrix. The first eigenvalue is sent to each second device, and the intermediate matrix is ​​sent to the target second device. The second eigenvalue is received from each second device, and the second eigenvalue is obtained based on the difference matrix of the second device and the intermediate matrix received by the second device. After calculating the second eigenvalue, each second device can send the second eigenvalue to each second device and the first device. In this way, each device can determine the eigenvalues ​​of the full matrix based on the first and second eigenvalues. The full matrix is ​​composed of the data matrices of the first device and the data matrices of the second device. The eigenvectors of the full matrix are determined. The eigenvectors of the full matrix are sent to each second device to complete the singular value decomposition of the full matrix on each second device. The second devices achieve data confidentiality of the full matrix while obtaining the eigenvalues ​​and eigenvectors. This application embodiment obtains the eigenvalues ​​and eigenvectors of the full matrix without the need for a coordinator, and achieves data confidentiality through computation. This allows for the singular value decomposition of the full matrix while protecting the privacy of each data holder. Attached Figure Description

[0041] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments or the prior art will be briefly introduced below.

[0042] Figure 1 This is a singular value decomposition scenario provided in an embodiment of this application;

[0043] Figure 2 This is another singular value decomposition scenario provided in the embodiments of this application;

[0044] Figure 3 This is a flowchart illustrating the steps of a singular value decomposition method provided in an embodiment of this application;

[0045] Figure 4 This is a flowchart illustrating a singular value decomposition method in a scenario involving two devices, as provided in an embodiment of this application.

[0046] Figure 5 This is a flowchart illustrating a singular value decomposition method in a scenario involving three devices, as provided in an embodiment of this application.

[0047] Figure 6This is a flowchart illustrating the steps of a singular value decomposition method provided in an embodiment of this application;

[0048] Figure 7 This is a flowchart illustrating a singular value decomposition method for a feature-joint scenario provided in an embodiment of this application;

[0049] Figure 8 This is a schematic diagram of a singular value decomposition device provided in an embodiment of this application;

[0050] Figure 9 This is a schematic diagram of another singular value decomposition device provided in an embodiment of this application;

[0051] Figure 10 This is a schematic diagram of a computer device provided in an embodiment of this application. Detailed Implementation

[0052] In the following description, specific details such as particular system architectures and techniques are set forth for illustrative purposes and not for limitation, in order to provide a thorough understanding of the embodiments of this application. However, those skilled in the art will understand that this application may also be implemented in other embodiments without these specific details. In other instances, detailed descriptions of well-known systems, apparatuses, circuits, and methods have been omitted so as not to obscure the description of this application with unnecessary detail.

[0053] Singular Value Decomposition (SVD) is a widely used algorithm in machine learning. It's not only used for feature decomposition in dimensionality reduction algorithms, but also in recommendation systems and natural language processing. PCA dimensionality reduction is closely related to SVD. PCA dimensionality reduction is the most popular algorithm, reducing feature dimensionality by mapping data from high to low dimensions while retaining as much information as possible. It has strong applications in image recognition and high-dimensional data dimensionality reduction. The algorithm mainly performs basis transformation on the original data by selecting eigenvectors with larger eigenvalues, which not only removes useless noise but also reduces computational cost. It is widely used in dimensionality reduction, lossy data compression, feature extraction, and data visualization. However, in reality, data is often fragmented and isolated due to data privacy concerns. How to perform SVD / PCA dimensionality reduction for data analysis without observing other people's data is a challenging problem.

[0054] In the process of data analysis, it is often necessary to extract features based on sample data. Sample data can generally include multiple features, each of which has a corresponding feature vector. Multiple sample data can form a matrix. Each row of the matrix can represent a sample, each column of the matrix can represent a feature, and each element in the matrix represents the value of the feature of the matrix column corresponding to the sample in the matrix row.

[0055] In applications such as image recognition and dimensionality reduction of high-dimensional data, singular value decomposition (SVD) is required for sample data, which can be distributed across various data holders. This dispersion can fall into two categories. One category involves each data holder containing multiple sample data sets, with each set including feature values ​​from all features. In this case, performing SVD on the target data composed of sample data from all holders constitutes joint SVD, such as... Figure 1 As shown, this is equivalent to each data holder having one or more rows of a matrix. Another scenario is that each data holder includes partial features from multiple samples. In this case, performing singular value decomposition (SVD) on the target data composed of sample data from each holder is a feature-joint SVD, such as... Figure 2 As shown, this is equivalent to each data holder having one or more columns of a matrix.

[0056] In summary, depending on the data storage method, multi-party joint singular value decomposition scenarios can include sample joint singular value decomposition and feature joint singular value decomposition.

[0057] Singular value decomposition (SVD) of a joint sample refers to a situation where the data held by different data holders share common characteristics, but the sample data differs. For example, if the data requiring SVD is deposit data, this data could include account name, balance, account holder, account holder's age, account holder's occupation, etc. The data holders could include deposit data from many individuals; for instance, data holder 1 might have deposit data from 6 customers, and data holder 2 might have deposit data from 10 customers. In this case, performing SVD on the data from each data holder constitutes a joint sample SVD.

[0058] Singular value decomposition (SVD) based on joint features refers to a situation where the data held by different data holders have different features, but the sample data are different. For example, the data that needs SVD is deposit data. Deposit data can include account name, balance, account holder, account holder's age, account holder's occupation, etc. The data holders can include deposit data from many people. For example, data holder 1 has account name, balance, and account holder information, while data holder 2 has account holder's age and occupation information. In this case, performing SVD on the data from each data holder is a SVD based on joint features.

[0059] The technical solution of this application will be described below through specific embodiments.

[0060] Reference Figure 3 The diagram illustrates a step-by-step flowchart of a singular value decomposition method provided in an embodiment of this application, which may specifically include the following steps:

[0061] S301, determine the difference matrix, which is the difference between the data matrix and the mean matrix of the first device, the data matrix includes eigenvalues, and the mean matrix is ​​composed of the average value of the eigenvalues ​​of each column of the data matrix.

[0062] The execution subject in this embodiment can be a computer device, which can be a mobile phone, tablet computer, wearable device, in-vehicle device, augmented reality (AR) / virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA) and other terminal devices.

[0063] The aforementioned first device is a computer device corresponding to a data holder. The aforementioned first device can be the device of the initiator of singular value decomposition.

[0064] This embodiment applies to a sample-joint singular value decomposition (SVD) scenario. The first device is the initiating device for SVD, and the second device is a participating device in the SVD. Both the first and second devices can include a data matrix. The data matrices of the first and second devices are combined to form the full matrix for SVD. The data matrix of the first or second device can be one or more rows of the full matrix. The data matrix can include rows and columns. The data matrix of the first device can include at least one column, and each column can correspond to a feature with a corresponding numerical value. This feature describes the meaning of the numerical value of the column in the data matrix. The data matrix can consist of at least one numerical value. For example, if the feature corresponding to a column of the data matrix is ​​age, then the values ​​12, 34, and 40 in that column can represent 12 years old, 34 years old, and 40 years old, respectively.

[0065] In this embodiment of the application, the singular value decomposition scenario of sample union may include a first device and at least one second device.

[0066] For example, there are two middle schools in the local area, and the student information of each middle school is stored in the server of that middle school. When performing data analysis on the students of these two middle schools, it may be necessary to perform singular value decomposition on the student data of the two middle schools. At this time, the servers of these two schools may include the first device mentioned above and the second device mentioned above. The student data stored in each server can correspond to a data matrix. All the student data on the two servers form the full matrix mentioned above. Each data matrix is ​​one or more rows in the full matrix.

[0067] Since both the first and second devices include one or more rows of a data matrix, the average value of each column can only be obtained by relying on the data matrix of the second device. In other words, the calculation of the mean matrix requires the participation of the second device's data matrix. The difference matrix is ​​the difference between the data matrix and the mean matrix; therefore, data exchange with the second device is necessary when determining the difference matrix. However, for data confidentiality, encryption is required during data exchange between the first and second devices. Specifically, the data matrix of the first device is obtained; the secret sum vector and the secret row sum are determined, where the secret sum vector is the encrypted value of the sum vector, and the sum vector is composed of the sum of the eigenvalues ​​of each column of the full matrix, and the secret row sum is the encrypted value of the total number of rows of the full matrix; the secret sum vector is encrypted to obtain the encrypted sum vector, and the encrypted sum vector is sent to each of the second devices; each second device can do the same, calculating its own encrypted sum vector and encrypted row sum, and each second device can send its encrypted row sum to the first device, which can receive the encrypted row sum from each of the second devices; based on the encrypted sum vector and encrypted row sum, the first device can determine the mean matrix corresponding to the full matrix; then, based on the mean matrix and the data matrix, the difference matrix is ​​calculated. The steps for calculating the secret row sum and secret vector can be as follows: Calculate the data vector corresponding to the data matrix, where the data vector is composed of the sum of the feature values ​​of each column of the data matrix; split the data vector into multiple first vectors, the number of first vectors being equal to the total number of first and second devices, and the sum of the multiple first vectors being equal to the data vector; determine multiple first row numbers based on the number of rows in the data matrix, the number of first row numbers being equal to the number of first vectors, and the sum of the multiple first row numbers being equal to the number of rows in the data matrix; encrypt each first vector and each first row number to obtain multiple first encrypted vectors and multiple first encrypted row numbers; send one first encrypted vector and one first encrypted row number to each second device respectively; receive a second encrypted vector and a second encrypted row number from each second device; determine the secret row sum based on the first encrypted vector and the second encrypted vector; and determine the secret sum vector based on the first encrypted row number and the second encrypted row number. Based on the second encryption vector and the first encryption vector, calculate the first vector secret fragment; based on the second encryption row number and the first encryption row number, calculate the first row number secret fragment; send the first row number secret fragment to the target second device, and receive the second vector secret fragment from the target second device; calculate the sum of the second vector secret fragment and the first vector secret fragment to obtain the secret sum vector; receive the secret row number sum from the target second device, the target second device is used to receive the first row number secret fragment and the second row number secret fragments of each other second device, the secret row number sum is the sum of the first row number secret fragment and the second row number secret fragments of each other second device.Determine the encryption parameters, which include a first parameter, a second parameter, and a third parameter, where the third parameter is the product of the first and second parameters; based on the first parameter, determine the first parameter vector; subtract the first parameter vector from the secret vector to obtain the encrypted vector.

[0068] After obtaining the encrypted sum vector and the sum of the number of encrypted rows, the mean vector can be determined. Then, based on the number of rows in the data matrix, the mean vector is expanded into a mean matrix. The mean vector is determined using the following formula based on the encrypted sum vector and the sum of the number of encrypted rows:

[0069] [avg]=[c]+α·[b]+β·[a]+α·β

[0070] Where [avg] is the mean vector, a is the first parameter, b is the second parameter, c is the third parameter, α is the encryption sum vector, and β is the encryption row number sum.

[0071] After determining the mean vector, the first device can return the mean vector to the second device. Both devices can then expand the mean vector according to their respective data matrices to obtain mean matrices. Based on the mean matrix and the data matrix, the first and second devices can respectively calculate their respective difference matrices.

[0072] For ease of explanation, let's take a joint singular value decomposition (SVD) operation using two devices as an example. The first device is the initiating device, and the second device is the participating device. The corresponding data vectors for the first and second devices are as follows: The corresponding data matrices have n rows. a and n b The first and second devices decompose the data matrix and the number of rows, respectively, to obtain the first vector. The second vector is The first row contains {a1, a2}, and the second row contains {b1, b2}, where... n a =a1+a2 and n b =b1 + b2. The first and second devices can each generate random vectors. and It is a vector consisting entirely of 1s. Then, a random vector is used to encrypt the first vector, the second vector, and the first and second row numbers, resulting in: First encrypted vector: First encrypted line number: Second encryption vector: Second encrypted line number: The first device will Send it to the second device, the second device will... Send to the first device. The first device can compute the first vector secret fragment: First line number of secret fragments The second device calculates the second vector secret fragment. The second line contains secret fragments. The second device can send the second vector secret fragment to the first device, and the first device can send the first row of secret fragments to the second device. The first device can calculate the secret and the vector: The second device can calculate the secret row sum: n = n1 + n2. The first and second devices can generate triplets [a], [b], [c] based on the Beaver triplet encryption method, where c = a·b. The first device can encrypt the secret and vector based on the triplets to obtain the encrypted vector: And The result is passed to the second device; the second device can encrypt the secret row sum based on the triplet to obtain the encrypted row sum: [β] = [1 / n] - [b], and then pass [β] to the first device. The first device can calculate the mean vector as: As can be seen, the calculated result is the mean vector. The first device can expand the mean vector into a mean matrix with the same dimensions as the data matrix. This example is only used to illustrate the scheme and is therefore relatively simple.

[0073] S302, Calculate the first eigenvalue and the intermediate matrix based on the difference matrix, wherein the intermediate matrix includes all the features of the data matrix.

[0074] Based on the difference matrix, the first eigenvalue and the intermediate matrix are calculated using the following formula:

[0075]

[0076] λ A ={λ / m}, for allλ

[0077]

[0078] Where, λ A Let X be the first eigenvalue, m be the number of rows in the data matrices of the first and second devices, and X be the first eigenvalue. A Let I be the difference matrix. A M is the identity matrix. A The intermediate matrix is ​​calculated for the first device.

[0079] S303, the first feature value is sent to each of the second devices, and the intermediate matrix is ​​sent to the target second device.

[0080] After the first device calculates the first eigenvalue, it can send the first eigenvalue to the other devices, that is, to each of the second devices. This first eigenvalue is used to determine the eigenvalues ​​of the full matrix on each device.

[0081] The aforementioned target second device can be predetermined. In one possible approach, if multiple devices are performing joint singular value decomposition, each device can be numbered, and the target second device for each device can be determined as the device numbered after it. The last numbered device may not have a specified target second device. For example, when two devices are performing joint singular value decomposition, this can include one initiator and one participant, namely, a first device A and a second device B. In this case, the target second device for the first device is the second device B, and the second device B may not have a specified target second device. When three devices are performing joint singular value decomposition, this can include one initiator and two participants, namely, a first device A and two second devices B and C. In this case, the target second device for the first device can be the second device B and the second device C, and the target second device for the second device B can be the second device C. The second device C may not have a specified target second device.

[0082] If the second device receives the intermediate matrix, it can calculate the second eigenvalue and the intermediate matrix based on the difference matrix between the received intermediate matrix and its own. The second device can then send the calculated eigenvalue to other second devices and the first device. If the second device has a corresponding target second device, it can send the intermediate matrix to the target second device to continue calculating the eigenvalue on that target second device. If the second device does not have a corresponding target second device, it may not need to calculate the intermediate matrix.

[0083] S304, receive the second feature value returned by each of the second devices, the second feature value is obtained according to the difference matrix of the second device and the intermediate matrix received by the second device.

[0084] S305, determine the eigenvalues ​​of the full matrix based on the first eigenvalue and the second eigenvalue, wherein the full matrix is ​​composed of the data matrix of the first device and the data matrix of the second device.

[0085] The first and second eigenvalues ​​are both part of the eigenvalues ​​of the full matrix. The set of the first and second eigenvalues ​​is the eigenvalue of the full matrix.

[0086] To more clearly describe the process of determining the eigenvalues ​​of the full matrix, the steps S302-S305 above will be explained below with a specific example.

[0087] Taking a joint singular value decomposition with two devices as an example. If the first device is A and the second device is B, then the first device A can calculate the first eigenvalue and the intermediate matrix using the following formula:

[0088]

[0089] λ A ={λ / m}, for allλ

[0090]

[0091] Where, λ A Let X be the first eigenvalue, m be the number of rows in the data matrices of the first and second devices, and X be the first eigenvalue. A Let I be the difference matrix. A M is the identity matrix. A The intermediate matrix is ​​calculated for the first device.

[0092] In this embodiment of the application, the data matrices of the first device and each of the second devices can have the same number of rows.

[0093] The first device A can λ A Send to the second device B. The first device A will send M. A The data is sent to the target second device, namely second device B. Second device B can calculate the second feature value using the following formula:

[0094]

[0095] λ B ={λ / m}, for allλ

[0096] λ B X is the second eigenvalue. B Let I be the difference matrix. B It is an identity matrix.

[0097] The second device B can calculate λ B Send to the first device A.

[0098] Based on the first eigenvalue λ A Second eigenvalue λ B The first device A and the second device B can obtain the eigenvalues ​​λ of the full matrix. all ={λ A ,λ B}

[0099] Taking a joint singular value decomposition with three devices as an example. If the first device is A, and the second devices are B and C, then the first device can calculate the first eigenvalue and the intermediate matrix using the following formula:

[0100]

[0101] λ A ={λ / m}, for allλ

[0102]

[0103] Where, λ A Let X be the first eigenvalue, m be the number of rows in the data matrices of the first and second devices, and X be the first eigenvalue. A Let I be the difference matrix. A M is the identity matrix. A This is the intermediate matrix calculated by the first device A. The first device A can convert λ... A Send to the second devices B and C.

[0104] First device A will M A The data is sent to the target second device, namely second device B and C. Second device B can calculate the second eigenvalue and the intermediate matrix using the following formula:

[0105]

[0106] λ B ={λ / m}, for allλ

[0107]

[0108] M2 = (IM A )·X B

[0109]

[0110] λ B M1, M2, and M3 are the second eigenvalues, and M1, M2, and M3 are the intermediate matrices calculated by the second device B.

[0111] The second device B will calculate the second characteristic value λ. B Send to the first device A and the second device C, and send intermediate matrices M1, M2 and M3 to the second device C.

[0112] The second device C can be based on the received intermediate matrix M A Calculate the second eigenvalue λ using M1, M2, and M3. C :

[0113]

[0114] λ C ={λ / m}, for allλ

[0115] Based on the first eigenvalue λ A The second eigenvalue λ B Second eigenvalue λ c The first device A, the second device B, and the second device C can all obtain the eigenvalues ​​λ of the full matrix. all ={λ A ,λ B ,λ C}

[0116] S306, Determine the eigenvectors of the full matrix.

[0117] To perform singular value decomposition, in addition to determining the eigenvalues ​​of the full matrix, the eigenvectors of the security matrix are also needed. Since data confidentiality is required, the determination of the eigenvectors of the full matrix can also be jointly performed by the first and second devices.

[0118] In one possible implementation, the process of determining the feature vector can be as follows:

[0119] The first device calculates a first intermediate value based on the eigenvalues ​​of the full matrix and its own difference matrix; and calculates an intermediate result based on its own difference matrix. The first device can send the intermediate result to an associated device, which can be one or more second devices, so that the associated device can calculate a second intermediate value based on the eigenvalues, the difference matrix, and the received intermediate result; each second device can send the calculated second intermediate value to the first device, so that the first device can determine the eigenvector based on the first intermediate value and the received second intermediate value.

[0120] To more clearly describe the process of determining the eigenvalues ​​of the full matrix, the steps for determining the eigenvectors are illustrated below with a specific example.

[0121] Take the example of performing joint singular value decomposition on two devices. These two devices can be device A and device B.

[0122] The first device A can calculate the first intermediate value using the following formula, based on the eigenvalues ​​and the difference matrix:

[0123]

[0124] Where, λ all Let X be the eigenvalue of the full matrix, R1 be the first intermediate value, and X be the eigenvalue of the full matrix. A Let I be the difference matrix. A It is an identity matrix.

[0125] Based on the difference matrix, the first device A calculates the intermediate results: The intermediate result is then sent to the associated device, namely the second device B.

[0126] The second device B can calculate the second intermediate value using the following formula, based on the intermediate results, its own difference matrix, and eigenvalues:

[0127]

[0128]

[0129]

[0130] Among them, R3, R4, and R5 are the second intermediate values, X B Let λ be the difference matrix of device B. all These are the eigenvalues ​​of the full matrix.

[0131] The second device B sends the second intermediate value to the first device A. The first device A can determine the feature vector based on the first and second intermediate values ​​using the following formula:

[0132]

[0133]

[0134]

[0135] in, Let R1 be the first intermediate value, and R3, R4 and R5 be the second intermediate values.

[0136] It should be noted that the eigenvalues ​​can be a set, which can include multiple values. For each value, the corresponding eigenvector can be calculated, thus finally obtaining the eigenvector set of the full matrix.

[0137] Taking a joint singular value decomposition with three devices as an example. If the first device is A, and the second devices are B and C, then the first device A can calculate the first intermediate value using the following formula, based on the eigenvalues ​​and the difference matrix:

[0138]

[0139] Where, λ all Let X be the eigenvalue of the full matrix, R1 be the first intermediate value, and X be the eigenvalue of the full matrix. A Let I be the difference matrix. A It is an identity matrix.

[0140] Based on the difference matrix, the first device A calculates the intermediate results: The intermediate result is then sent to the associated device, namely the second device B.

[0141] The second device B can calculate:

[0142]

[0143]

[0144]

[0145] In this context, the second intermediate values ​​corresponding to the second device B are R2, R3, and R4, and the intermediate result calculated by the second device B is R3. The second device B can send the second intermediate values ​​R2, R3, and R4 to the first device A, and send the intermediate result R3 to the second device C.

[0146] The second device C can calculate based on the received intermediate results, eigenvalues, and difference matrix:

[0147]

[0148]

[0149]

[0150] R8 = R3·X C

[0151] In this context, R5, R6, R7, and R8 are the second intermediate values ​​corresponding to the second device C, and R6 is the intermediate result. The second device C can send the second intermediate values ​​R5, R6, R7, and R8 to the first device A. The second device C can also send the intermediate result R6 to the corresponding associated device, which is the second device B.

[0152] The second device B can calculate the second intermediate value based on the received intermediate result R6:

[0153] R9 = R6·X B

[0154] The second device B can send the second intermediate value R9 to the first device A.

[0155] The first device A can determine the feature vector based on the first intermediate value and the second intermediate value using the following formula:

[0156]

[0157]

[0158]

[0159]

[0160] in, Let R1 be the first intermediate value, and R2, R3, R4, R5, R6, R7, R8 and R9 be the second intermediate values.

[0161] S307, the eigenvectors of the full matrix are sent to each of the second devices to perform singular value decomposition of the full matrix on each of the second devices.

[0162] After determining the eigenvalues ​​and eigenvectors of the full matrix, the singular value decomposition of the full matrix can be completed. Therefore, after the first device sends the eigenvalues ​​and eigenvectors to each of the second devices, the singular value decomposition or principal component analysis dimensionality reduction of the full matrix is ​​completed.

[0163] In this embodiment, singular value decomposition is achieved through matrix encryption between the first and second devices. During encryption, the same value is added to each fragment, and during decryption, the key can be eliminated based on addition. Thus, data encryption is achieved while obtaining the correct matrix information. This embodiment, while protecting the security of the data sets of both parties, can achieve singular value decomposition of joint data without the need for third-party coordination.

[0164] Figure 4 This is a flowchart illustrating a singular value decomposition method in a scenario involving two devices, as provided in an embodiment of this application. Figure 4 As shown, one device is the initiator, and the other is a participant. The specific singular value decomposition process is as follows:

[0165] The initiator and the participants each perform row summation on their own matrices to obtain a vector. and and the number of rows n a With n b And each will assign its own vector. and and the number of columns n a and n b Decomposed into secret fragments and And {a1, a2} and {b1, b2}, where n a =a1+a2 and n b = b1 + b2.

[0166] Both the initiator and the participants generate random vectors. and Encrypt your own secret fragments

[0167] The initiator will encrypt the fragments The encrypted fragments are then passed to the participants. The secret fragment is passed to the initiator. The initiator then calculates the secret fragment. Participants calculate secret fragments

[0168] The initiator sends n1 to the participants, and the participants will... Send to the initiator.

[0169] The initiator calculates the sum. The participants calculate n = n1 + n2.

[0170] The initiator and participants generate a triplet [a], [b], [c] based on the Beaver triplet encryption method, where c = a·b.

[0171] Initiator Calculation And Passed to the participating parties.

[0172] The participants calculate [β] = [1 / n] - [b] and pass [β] to the initiator.

[0173] The initiator and participants calculate the mean [avg] = [c] + α·[b] + β·[a] + α·β for each row.

[0174] The initiator and participants will use the mean vector Expand into a mean matrix of the same size as your own matrix. And calculate the difference matrix.

[0175] The initiator calculates the determinant. All eigenvalues ​​λ A ={λ / m}, for allλ, and calculate the matrix. Where m represents the number of rows in the data matrix.

[0176] The initiator will use matrix M A Passed to the participating parties.

[0177] Participants calculate the determinant All eigenvalues ​​λ B ={λ / m}, for allλ, where m is the number of rows in the data matrix.

[0178] The initiator and participants exchange their respective feature values.

[0179] After obtaining all the eigenvalues, the initiator and participants can obtain the eigenvalues ​​λ of the full matrix. all ={λA ,λ B}

[0180] Initiator Calculation And Passed to participant B.

[0181] Participant B calculates and as well as The result will then be returned to the initiator, A.

[0182] Initiator A calculates the final feature vector based on all results.

[0183]

[0184]

[0185] The initiator obtains the complete feature vector. The results are then shared with the participants, allowing SVD decomposition and PCA dimensionality reduction to be performed on both the initiator's and the participants' devices.

[0186] Figure 5 This is a flowchart illustrating a singular value decomposition method in a scenario involving three devices, as provided in an embodiment of this application. Figure 5 As shown, the three devices can include one initiator and two participants. The singular value decomposition steps are as follows:

[0187] The initiator and the participants each perform row summation on their own data matrix to obtain a vector. and and the number of rows n a n b and n c And each will assign its own vector. and and the number of columns n a n b With n c Decomposed into secret fragments and And {a1, a2, a3}, {b1, b2, b3} and {c1, c2, c3}, where n a =a1+a2+a3,n b =b1+b2+b3 and n c = c1 + c2 + c3.

[0188] Both the initiator and the participants generate random vectors. and Encrypt your own secret fragments

[0189] The initiator will encrypt the fragments Passed to participant B, The fragment is passed to participant C; participant B then encrypts the fragment. Passed to initiator A, The fragment is passed to participant C; participant C will then encrypt the fragment. Passed to initiator A, Passed to participant B;

[0190] The initiator calculates the secret fragment. Participant B calculates the secret fragment Participant C calculates the secret fragment

[0191] Initiator A sends n1 to participant B; participant B will... Send to initiator A; participant C sends n3 to participant B, Send to initiator A;

[0192] The initiator calculates the sum. Participant B calculates n = n1 + n2 + n3;

[0193] The initiator and participants generate a triplet [a], [b], [c] based on the Beaver triplet encryption method, where c = a·b;

[0194] Initiator Calculation And Passed to the participants;

[0195] The participating party calculates [β] = [1 / n] - [b] and passes [β] to the initiating party;

[0196] The initiator and participants calculate the mean [avg] = [c] + α·[b] + β·[a] + α·β for each row;

[0197] The initiator and participants will use the mean vector Expand into a mean matrix of the same size as your own matrix. And calculate the difference matrix.

[0198] Initiator A calculates the determinant All eigenvalues ​​λ A ={λ / m}, for allλ, and calculate the matrix. Where m represents the number of rows in the data matrix;

[0199] Initiator A will use matrix M A Passed to participants B and C;

[0200] Participant B calculates the determinant All eigenvalues ​​λ B ={λ / m}, for allλ;

[0201] Participant B will use the matrix M2 = (IM A )·X B and Passed to participant C;

[0202] Participant C calculates the determinant All eigenvalues ​​λ C ={λ / m}, for allλ, and send the eigenvalues ​​to the initiator;

[0203] Both the initiator and the participants can determine the eigenvalues ​​λ of the full matrix based on the eigenvalues ​​they share with each other. all ={λ A ,λ B ,λ C}

[0204] Initiator A calculates And Passed to participants B and C;

[0205] Participant B calculates and as well as Then R2, R3, and R4 are passed to the initiator A, and R3 is passed to the participant C;

[0206] Participant C calculates and as well as And R8 = R3·X C R5, R6, R7, and R8 are then passed to the initiator A, and R6 is passed to the participant B.

[0207] After receiving R6, participant B calculates R9 = R6·X B And pass R9 to the initiator A;

[0208] Initiator A calculates the final feature vector based on all results.

[0209]

[0210]

[0211]

[0212] The initiator obtains the complete feature vector. The results were then shared with the participants to further complete SVD decomposition and PCA dimensionality reduction.

[0213] Reference Figure 6 This illustration shows a flowchart of another singular value decomposition method provided in an embodiment of this application, which may specifically include the following steps:

[0214] S601, determine the difference matrix, which is the difference between the data matrix and the mean matrix of the third device, the data matrix includes the values ​​of the features, and the mean matrix is ​​composed of the average value of the values ​​of the features in each column of the data matrix.

[0215] The execution subject in this embodiment can be a computer device, which can be a mobile phone, tablet computer, wearable device, in-vehicle device, augmented reality (AR) / virtual reality (VR) device, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA) and other terminal devices.

[0216] The aforementioned third device is a computer device corresponding to a data holder. This third device can be the initiator of singular value decomposition. In this application, the first, second, third, and fourth devices are essentially computer devices; that is, each device can execute the method embodiments described in this application.

[0217] The third device may include a data matrix. The data matrices of the third and fourth devices are combined to form the full matrix for which singular value decomposition (SVD) needs to be performed. The data matrix can be one or more columns of the full matrix. Each column of the full matrix can correspond to a feature, and the feature has a corresponding numerical value. The data matrix can be composed of numerical values. The average of all the values ​​in a column of the data matrix is ​​the average of the features in that column.

[0218] The data matrix of the third device is one or more columns of the full matrix, so the average value of the feature values ​​of each column can be calculated directly; then the mean matrix is ​​obtained based on the average value of each column; subtracting the mean matrix from the data matrix yields the corresponding difference matrix.

[0219] S602, determine a plurality of third matrices based on the difference matrix, and the sum of the plurality of third matrices is the product of the transpose of the difference matrix and the difference matrix.

[0220] The third and fourth devices can calculate the product matrix respectively. The product matrix is ​​decomposed into multiple third matrices. Where X i Let N be the difference matrix, where i can be the number of the third or fourth device, and N is the sum of the number of all third and fourth devices.

[0221] S603, each of the third matrices is encrypted to obtain a third encryption result, the third encryption result including the third encryption matrix corresponding to each of the third matrices.

[0222] The third device can generate perturbation values. This perturbation value is used to encrypt the third matrix. The third perturbation value can then be used to encrypt the third matrix to obtain the third encrypted result:

[0223] S604, the third encryption result is sent to the corresponding fourth device to obtain the aggregation matrix returned by the fourth device. The aggregation matrix is ​​obtained by aggregating the third encryption result and the fourth encryption result of the fourth device.

[0224] Following the sequential numbering of the third and fourth devices, the third encryption result is sent to the fourth device corresponding to the next number. The fourth device with the last number can aggregate all received encryption results to obtain an aggregation matrix. The fourth device with the last number then sends the aggregation matrix to the third device.

[0225] S605, determine the complete matrix corresponding to the aggregation matrix, the complete matrix being used to characterize all features of the full matrix composed of the data matrices of the third device and multiple fourth devices.

[0226] The third device can detect the perturbation value of the aggregation matrix. Removing the matrix yields a complete matrix, which is equivalent to the transformation matrix of the full matrix. The two can have the same shape and properties, meaning their eigenvalues ​​and eigenvectors are the same.

[0227] S606, calculate the eigenvalues ​​and eigenvectors of the complete matrix to perform singular value decomposition of the complete matrix on the third device.

[0228] Since a complete matrix can be equivalent to a translation of a full matrix, and the two can have the same characteristics and eigenvectors, determining the eigenvalues ​​and eigenvectors of a complete matrix is ​​equivalent to determining the eigenvalues ​​and eigenvectors of a full matrix, which can complete the singular value decomposition of the full matrix.

[0229] In this embodiment, singular value decomposition of the joint matrix can be achieved without the need for third-party coordination, ensuring information security. At the same time, data processing can be performed based on multi-party data, ensuring data security while making full use of the information expressed by the data.

[0230] It should be noted that the sequence number of each step in the above embodiments does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this application.

[0231] Figure 7 This is a flowchart illustrating a singular value decomposition method for a feature-joint scenario provided in an embodiment of this application. Figure 7 As shown, the process of a multi-party sample joint SVD decomposition / PCA dimensionality reduction method that is resistant to malicious attacks and requires no coordinator is as follows:

[0232] The initiator and participants calculate their own difference matrix based on their own matrix mean AVG.

[0233] The initiator and participants use their own product matrix. Decomposed into secret fragments

[0234] The initiator generates the perturbation value. And use the disturbances from all parties to encrypt our secrets a second time.

[0235] The results are passed to the next party in the order of initiator and participant, until the last participant obtains the final result and aggregates it;

[0236] The last participant returns the aggregation result to the initiator;

[0237] Initiator removes perturbation value And calculate the eigenvalues ​​and eigenvectors based on the true aggregation matrix;

[0238] The initiator sends the feature results to each participant;

[0239] The initiator and participants perform PCA dimensionality reduction / SVD decomposition.

[0240] Reference Figure 8 The diagram illustrates a singular value decomposition device according to an embodiment of this application, which may specifically include a difference matrix determination module 81, a feature calculation module 82, a sending module 83, a receiving module 84, an eigenvalue determination module 85, an eigenvector determination module 86, and a singular value decomposition module 86, wherein:

[0241] The difference matrix determination module 81 is used to determine the difference matrix, which is the difference between the data matrix and the mean matrix of the first device. The data matrix includes the numerical values ​​of the features, and the mean matrix is ​​composed of the average value of the numerical values ​​of the features in each column of the data matrix.

[0242] The feature calculation module 82 is used to calculate a first feature value and an intermediate matrix based on the difference matrix, wherein the intermediate matrix includes all features of the data matrix;

[0243] The sending module 83 is used to send the first feature value to each of the second devices and to send the intermediate matrix to the target second device;

[0244] The receiving module 84 is used to receive the second feature value returned by each of the second devices, the second feature value being obtained based on the difference matrix of the second devices and the intermediate matrix received by the second devices;

[0245] The eigenvalue determination module 85 is used to determine the eigenvalues ​​of the full matrix based on the first eigenvalue and the second eigenvalue, wherein the full matrix is ​​composed of the data matrix of the first device and the data matrix of the second device.

[0246] The eigenvector determination module 86 is used to determine the eigenvectors of the full matrix;

[0247] The singular value decomposition module 87 is used to send the eigenvectors of the full matrix to each of the second devices, so as to complete the singular value decomposition of the full matrix on each of the second devices.

[0248] In one possible implementation, the difference matrix determination module 81 described above:

[0249] The data matrix acquisition submodule is used to acquire the data matrix of the first device;

[0250] The secret and vector determination submodule is used to determine the secret and vector and the secret row number sum, wherein the secret and vector is the encrypted value of the sum vector, the sum vector is composed of the sum of the values ​​of the features in each column of the full matrix, and the secret row number sum is the encrypted value of the total number of rows of the full matrix;

[0251] An encryption submodule is used to encrypt the secret and vector to obtain an encrypted and vector, and send the encrypted and vector to each of the second devices;

[0252] An encrypted row count and receiving submodule is used to receive the encrypted row count and sum from each of the second devices;

[0253] The mean matrix determination submodule is used to determine the mean matrix based on the encryption vector and the sum of the number of encryption rows;

[0254] The difference matrix calculation submodule is used to take the difference between the data matrix and the mean matrix as the difference matrix.

[0255] In one possible implementation, the aforementioned secret and vector determination submodule includes:

[0256] A data vector calculation unit is used to calculate the data vector corresponding to the data matrix, wherein the data vector is composed of the sum of the values ​​of the features in each column of the data matrix;

[0257] A vector splitting unit is used to split the data vector into multiple first vectors, the number of first vectors being equal to the total number of the first devices and the second devices, and the sum of the multiple first vectors being equal to the data vector;

[0258] The row number splitting unit is used to determine multiple first row numbers based on the number of rows in the data matrix. The number of first row numbers is equal to the number of first vectors, and the sum of the multiple first row numbers is equal to the number of rows in the data matrix.

[0259] An encryption unit is used to encrypt each of the first vectors and each of the first row numbers to obtain multiple first encryption vectors and multiple first encryption row numbers;

[0260] An encrypted data sending unit is configured to send a first encryption vector and a first encryption line number to each of the second devices respectively;

[0261] An encrypted data receiving unit is configured to receive a second encryption vector and a second encryption line number from each of the second devices;

[0262] The secret row number and determination module is configured to determine the secret row number and the secret vector based on the first encryption vector and the second encryption vector; and to determine the secret and vector based on the first encryption row number and the second encryption row number.

[0263] In one possible implementation, the aforementioned secret row number and determining unit include:

[0264] The first vector secret fragment calculation subunit is used to calculate the first vector secret fragment based on the second encryption vector and the first encryption vector;

[0265] The first row number secret fragment calculation subunit is used to calculate the first row number secret fragment based on the second encrypted row number and the first encrypted row number;

[0266] The transmission subunit is configured to send the first row of secret fragments to the target second device and receive the second vector secret fragments from the target second device;

[0267] The secret and vector calculation subunit is used to calculate the sum of the second vector secret fragment and the first vector secret fragment to obtain the secret and vector;

[0268] A secret line count and receiving submodule is used to receive a secret line count sum from a target second device, wherein the target second device is used to receive a first line count secret fragment and second line count secret fragments from other second devices, and the secret line count sum is the sum of the first line count secret fragment and the second line count secret fragments from each of the second devices.

[0269] In one possible implementation, the aforementioned encryption unit includes:

[0270] Determine encryption parameters, which include a first parameter, a second parameter, and a third parameter, wherein the third parameter is the product of the first parameter and the second parameter;

[0271] Based on the first parameter, determine the first parameter vector;

[0272] Subtracting the first parameter vector from the secret and vector yields the encryption and vector.

[0273] In one possible implementation, the aforementioned encryption unit includes:

[0274] The mean vector is determined based on the encryption vector and the sum of the number of encrypted rows;

[0275] Based on the number of rows in the data matrix, the mean vector is expanded into the mean matrix.

[0276] In one possible implementation, the mean vector is determined based on the encryption vector and the sum of the number of encrypted rows using the following formula:

[0277] [avg]=[c]+α·[b]+β·[a]+α·β

[0278] Wherein, [avg] is the mean vector, a is the first parameter, b is the second parameter, c is the third parameter, α is the encryption vector, and β is the encryption row number sum.

[0279] In one possible implementation, the first eigenvalue and the intermediate matrix are calculated based on the difference matrix using the following formula:

[0280]

[0281]

[0282]

[0283] Where, λ A Let X be the first eigenvalue, m be the number of rows in the data matrices of the first device and the second device, and X be the first eigenvalue. A Let I be the difference matrix. A M is the identity matrix. A The intermediate matrix calculated for the first device.

[0284] In one possible implementation, the feature vector determination module 86 includes:

[0285] The first intermediate value calculation submodule is used to calculate the first intermediate value based on the eigenvalue and the difference matrix;

[0286] An intermediate result calculation submodule is used to calculate intermediate results based on the difference matrix and send the intermediate results to associated devices, wherein the associated devices are one or more of the second devices;

[0287] The second intermediate value receiving submodule is used to receive second intermediate values ​​from each of the second devices, wherein the second intermediate value is determined based on the difference matrix of the second devices and the received intermediate results;

[0288] The feature vector determination submodule is used to determine the feature vector based on the first intermediate value and the second intermediate value.

[0289] In one possible implementation, the first intermediate value is calculated based on the eigenvalues ​​and the difference matrix using the following formula:

[0290]

[0291] Where, λ all Let X be the eigenvalue of the full matrix, R1 be the first intermediate value, and X be the eigenvalue of the full matrix. A Let I be the difference matrix. A It is an identity matrix.

[0292] In one possible implementation, the feature vector is determined based on the first intermediate value and the second intermediate value using the following formula:

[0293]

[0294]

[0295]

[0296] in, Let R1 be the first intermediate value, and R3, R4 and R5 be the second intermediate values.

[0297] In one possible implementation, the feature vector is determined based on the first intermediate value and the second intermediate value using the following formula:

[0298]

[0299]

[0300]

[0301]

[0302] in, Let R1 be the first intermediate value, and R2, R3, R4, R5, R6, R7, R8 and R9 be the second intermediate values.

[0303] Reference Figure 9 This diagram illustrates another singular value decomposition device provided in an embodiment of this application, which may specifically include a difference matrix determination module 91, a difference matrix splitting module 92, an encryption module 93, a sending module 94, a complete matrix determination module 95, and a singular value decomposition module 96, wherein:

[0304] The difference matrix determination module 91 is used to determine the difference matrix, which is the difference between the data matrix and the mean matrix of the third device. The data matrix includes the numerical values ​​of the features, and the mean matrix is ​​composed of the average value of the numerical values ​​of the features in each column of the data matrix.

[0305] The difference matrix splitting module 92 is used to determine a plurality of first matrices based on the difference matrix, wherein the sum of the plurality of first matrices is the product of the transpose of the difference matrix and the difference matrix.

[0306] The encryption module 93 is used to encrypt each of the third matrices to obtain a third encryption result, wherein the third encryption result includes the third encryption matrix corresponding to each of the third matrices.

[0307] The sending module 94 is used to send the third encryption result to the corresponding fourth device to obtain the aggregation matrix returned by the fourth device. The aggregation matrix is ​​obtained by aggregating the third encryption result and the fourth encryption result of the fourth device.

[0308] The complete matrix determination module 95 is used to determine the complete matrix corresponding to the aggregate matrix. The complete matrix is ​​used to characterize all the features of the full matrix composed of the data matrices of the third device and multiple fourth devices.

[0309] The singular value decomposition module 96 is used to calculate the eigenvalues ​​and eigenvectors of the complete matrix to perform singular value decomposition on the complete matrix on the third device.

[0310] As the apparatus embodiments are basically similar to the method embodiments, they are described in a relatively simple manner. For relevant details, please refer to the description in the method embodiment section.

[0311] Figure 10 This is a schematic diagram of the structure of a computer device provided in an embodiment of this application. Figure 10 As shown, the computer device 100 of this embodiment includes: at least one processor 1000 ( Figure 10 (Only one is shown) a processor, a memory 1001, and a computer program 1002 stored in the memory 1001 and executable on the at least one processor 1000, wherein the processor 1000 executes the computer program 1002 to implement the steps in any of the above method embodiments.

[0312] The computer device 100 may be a desktop computer, laptop, handheld computer, or cloud computing device, etc. This computer device may include, but is not limited to, a processor 1000 and a memory 1001. Those skilled in the art will understand that... Figure 10 The computer device 100 is merely an example and does not constitute a limitation on the computer device 100. It may include more or fewer components than shown, or combine certain components, or different components, such as input / output devices, network access devices, etc.

[0313] The processor 1000 may be a Central Processing Unit (CPU), or it may be other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor may be a microprocessor or any conventional processor.

[0314] In some embodiments, the memory 1001 may be an internal storage unit of the computer device 100, such as a hard disk or memory of the computer device 100. In other embodiments, the memory 1001 may be an external storage device of the computer device 100, such as a plug-in hard disk, smart media card (SMC), secure digital (SD) card, flash card, etc., equipped on the computer device 100. Further, the memory 1001 may include both internal and external storage units of the computer device 100. The memory 1001 is used to store the operating system, applications, bootloader, data, and other programs, such as the program code of the computer program. The memory 1001 can also be used to temporarily store data that has been output or will be output.

[0315] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps described in the various method embodiments above.

[0316] This application provides a computer program product that, when run on a computer device, enables the computer device to perform the steps described in the above-described method embodiments.

[0317] The embodiments described above are only used to illustrate the technical solutions of this application, and are not intended to limit it. Although this application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the spirit and scope of the technical solutions of the embodiments of this application, and should all be included within the protection scope of this application.

Claims

1. A singular value decomposition method, characterized in that, Applied to the first device, including: Determine a difference matrix, which is the difference between the data matrix and the mean matrix of the first device. The data matrix includes the numerical values ​​of the features, and the mean matrix is ​​composed of the average value of the feature values ​​in each column of the data matrix. Based on the difference matrix, calculate the first eigenvalue and the intermediate matrix, wherein the intermediate matrix includes all the features of the data matrix; The first feature value is sent to each of the second devices, and the intermediate matrix is ​​sent to the target second device; Receive the second feature value returned by each of the second devices, the second feature value being obtained based on the difference matrix of the second devices and the intermediate matrix received by the second devices; Based on the first eigenvalue and the second eigenvalue, the eigenvalues ​​of the full matrix are determined, wherein the full matrix is ​​composed of the data matrix of the first device and the data matrix of the second device. Determine the eigenvectors of the full matrix; The eigenvectors of the full matrix are sent to each of the second devices to perform singular value decomposition of the full matrix on each of the second devices; The determination of the difference matrix includes: Obtain the data matrix of the first device; Determine the secret and vector and the secret row number sum, wherein the secret and vector is the encrypted value of the sum vector, the sum vector is composed of the sum of the values ​​of the features in each column of the full matrix, and the secret row number sum is the encrypted value of the total number of rows of the full matrix; The secret and vector are encrypted to obtain an encrypted vector, and the encrypted vector is sent to each of the second devices; Receive the sum of encrypted line counts from each of the second devices; The mean matrix is ​​determined based on the encryption vector and the sum of the number of encrypted rows; The difference between the data matrix and the mean matrix is ​​used as the difference matrix.

2. The method as described in claim 1, characterized in that, The determination of the secret and vector, as well as the sum of the number of secret rows, includes: Calculate the data vector corresponding to the data matrix, wherein the data vector is composed of the sum of the values ​​of the features in each column of the data matrix; The data vector is split into multiple first vectors, the number of which is equal to the total number of the first devices and the second devices, and the sum of the multiple first vectors is equal to the data vector. Multiple first row numbers are determined based on the number of rows in the data matrix. The number of first row numbers is equal to the number of first vectors, and the sum of the multiple first row numbers is equal to the number of rows in the data matrix. Each of the first vectors and each of the first row numbers are encrypted to obtain multiple first encrypted vectors and multiple first encrypted row numbers; Send one of the first encryption vectors and one of the first encryption lines to each of the second devices respectively; Receive the second encryption vector and the second encryption line number from each of the second devices; The secret row number and the secret sum are determined based on the first encryption vector and the second encryption vector; and the secret sum vector is determined based on the first encryption row number and the second encryption row number.

3. The method as described in claim 2, characterized in that, The step of determining the secret row number sum based on the first encryption vector and the second encryption vector; and determining the secret sum vector based on the first encryption row number and the second encryption row number, includes: Calculate the first vector secret fragment based on the second encryption vector and the first encryption vector; Calculate the secret fragment of the first row based on the second encrypted row number and the first encrypted row number; The first row of secret fragments is sent to the target second device, and the second vector secret fragment is received from the target second device; Calculate the sum of the second vector secret fragment and the first vector secret fragment to obtain the secret sum vector; The target second device receives a secret row number sum from a target second device, which is used to receive a first row number secret fragment and second row number secret fragments from other second devices, wherein the secret row number sum is the sum of the first row number secret fragment and the second row number secret fragments from each of the second devices.

4. The method as described in claim 1, characterized in that, The encryption of the secret and vector to obtain the encrypted vector includes: Determine encryption parameters, which include a first parameter, a second parameter, and a third parameter, wherein the third parameter is the product of the first parameter and the second parameter; Based on the first parameter, determine the first parameter vector; Subtracting the first parameter vector from the secret and vector yields the encryption and vector.

5. The method as described in claim 4, characterized in that, The determination of the mean matrix based on the encryption vector and the sum of the number of encrypted rows includes: The mean vector is determined based on the encryption vector and the sum of the number of encrypted rows; Based on the number of rows in the data matrix, the mean vector is expanded into the mean matrix.

6. The method as described in claim 5, characterized in that, Based on the encryption vector and the sum of the number of encrypted rows, the mean vector is determined using the following formula: in, Let a be the mean vector, b be the first parameter, and c be the third parameter. For the encryption and vector, Let S be the number of encrypted rows.

7. The method according to any one of claims 1-6, characterized in that, Based on the difference matrix, the first eigenvalue and the intermediate matrix are calculated using the following formula: in, Let m be the first feature value, and m be the number of rows in the data matrices of the first device and the second device. The difference matrix is... It is the identity matrix. The intermediate matrix calculated for the first device.

8. The method as described in claim 1, characterized in that, Determining the eigenvectors of the full matrix includes: Calculate the first intermediate value based on the eigenvalues ​​and the difference matrix; Based on the difference matrix, intermediate results are calculated and sent to associated devices, which are one or more of the second devices. Receive a second intermediate value from each of the second devices, the second intermediate value being determined based on the difference matrix of the second devices and the received intermediate result; The feature vector is determined based on the first intermediate value and the second intermediate value.

9. The method as described in claim 8, characterized in that, The first intermediate value is calculated using the following formula, based on the eigenvalues ​​and the difference matrix: in, The eigenvalues ​​of the full matrix are... The first intermediate value, The difference matrix is... It is an identity matrix.

10. The method as described in claim 8, characterized in that, The feature vector is determined based on the first intermediate value and the second intermediate value using the following formula: : in, For the feature vector, The first intermediate value, , and This is the second intermediate value.

11. The method as described in claim 8, characterized in that, The feature vector is determined based on the first intermediate value and the second intermediate value using the following formula: : in, For the feature vector, The first intermediate value, , , , , , , and This is the second intermediate value.

12. A singular value decomposition method, characterized in that, Applied to a third device, the method includes: Determine the difference matrix, which is the difference between the data matrix and the mean matrix of the third device, wherein the data matrix includes the numerical values ​​of the features, and the mean matrix is ​​composed of the average value of the numerical values ​​of the features in each column of the data matrix; Multiple third matrices are determined based on the difference matrix, and the sum of the multiple third matrices is the product of the transpose of the difference matrix and the difference matrix. Each of the third matrices is encrypted to obtain a third encryption result, which includes the third encryption matrix corresponding to each of the third matrices. The third encryption result is sent to the corresponding fourth device to obtain the aggregation matrix returned by the fourth device. The aggregation matrix is ​​obtained by aggregating the third encryption result and the fourth encryption result of the fourth device. Determine the complete matrix corresponding to the aggregation matrix, the complete matrix being used to characterize all features of the full matrix composed of the data matrices of the third device and multiple fourth devices; The eigenvalues ​​and eigenvectors of the complete matrix are calculated to perform singular value decomposition of the complete matrix on the third device.

13. A computer device comprising 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 computer program, it implements the method as described in any one of claims 1-11 or 12.

14. A computer-readable storage medium storing a computer program, characterized in that, When the computer program is executed by a processor, it implements the method as described in any one of claims 1-11 or 12.

Citation Information

Patent Citations

  • Method and device for multi-party joint dimension reduction processing of private data

    CN111401479A

  • Image feature generation method, image recognition method and device

    CN113344004A