Clustering method, device, electronic device and storage medium
By generating and encrypting cluster vectors in the clustering algorithm, updating the cluster center and re-clustering, the problem of data leakage during the clustering algorithm training process is solved, and data security and confidentiality are achieved.
Patent Information
- Application Number
- CN202110360295.3
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-04-02
- Publication Date
- 2025-04-18
- Estimated Expiration
- 2041-04-02
AI Technical Summary
During the training of the clustering algorithm, there is a risk of data leakage, because participating nodes can calculate the label information of the samples in the entire cluster through the results output from the training.
A clustering method is proposed, by generating cluster vectors and encrypting them and sending them to participating nodes, obtaining the difference matrix generated by participating nodes, updating the cluster center with the difference matrix generated by business nodes, and reclustering the samples with the updated cluster vector.
It effectively ensures the security of data, prevents data leakage, and ensures the confidentiality of sample data.
Smart Images

Figure CN114118180B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of data statistical analysis, and in particular to a clustering method, device, electronic device and storage medium. Background Art
[0002] During the training of the clustering algorithm model, the business node party will want to synchronize the identity document (ID) and cluster center of the samples in the cluster with the participating nodes in each round of training. According to the characteristics of the clustering algorithm, it can be seen that the sample points of the same cluster output by the training of the clustering algorithm have high similarity. The participating nodes can easily infer the label information of the samples in the entire cluster through the label information of a certain point in a certain cluster in the training output results. The security of the data during the training process cannot be guaranteed, and there is a risk of leakage. Summary of the invention
[0003] The present application aims to solve one of the technical problems in the related art at least to some extent.
[0004] To this end, the first aspect of the present application proposes a clustering method.
[0005] The second aspect of the present application also proposes another clustering method.
[0006] A third aspect of the present application provides a clustering device.
[0007] In a fourth aspect, the present application proposes another clustering device.
[0008] A fifth aspect of the present application provides an electronic device.
[0009] A sixth aspect of the present application proposes a computer-readable storage medium.
[0010] The seventh aspect of the present application proposes a computer program product.
[0011] In a first aspect, the present application proposes a clustering method applicable to business nodes, comprising: for each cluster, based on the number of the target first sample belonging to the cluster, generating a cluster vector of the cluster, and encrypting the cluster vector and sending it to the participating nodes, wherein the cluster vector is used to represent the cluster center of the cluster; obtaining a first difference matrix from the first sample of the business node to the cluster center corresponding to each cluster, and a second difference matrix from the second sample of the participating node to the cluster center; updating the cluster center according to the first difference matrix and the second difference matrix of each cluster, re-clustering the first sample with the updated cluster center, and using each cluster obtained after re-clustering as the cluster corresponding to the next iteration, returning to execute the above steps until the iteration ends to generate the final target cluster.
[0012] In addition, the clustering method applicable to service nodes proposed in the first aspect of the present application may also have the following additional technical features:
[0013] According to one embodiment of the present application, the process of obtaining the first difference matrix includes: repeating the cluster vector of the current iteration in the column direction according to the number of samples to construct the cluster matrix of the current iteration; obtaining the multiplication of the cluster matrix and the feature space matrix of the business node to obtain a multiplication matrix, and subtracting the feature space matrix from the multiplication matrix to generate the first difference matrix corresponding to the current iteration.
[0014] According to one embodiment of the present application, for the first iteration, the process of obtaining the second difference matrix includes: receiving the encrypted second difference matrix corresponding to the first iteration sent by the participating node, decrypting the encrypted second difference matrix, and obtaining the second difference matrix, wherein the encrypted second difference matrix is determined by the participating node based on its own encrypted feature space matrix and the encrypted initial cluster vector.
[0015] According to one embodiment of the present application, for non-initial iterations, the process of acquiring the second difference matrix includes: receiving the encrypted updated difference matrix corresponding to the current iteration sent by the participating nodes, wherein the encrypted updated difference matrix is used to characterize the distance between the cluster center obtained in the previous iteration and the cluster center obtained in the current iteration, and is generated by the participating nodes based on their own feature space matrix, the encrypted cluster vector of the previous iteration and the encrypted cluster vector of the current iteration; decrypting the encrypted updated difference matrix to obtain an updated difference matrix; adding the second difference matrix corresponding to the previous iteration to the updated difference matrix of the current iteration to obtain the second difference matrix of the current iteration.
[0016] According to one embodiment of the present application, the clustering method also includes: randomly setting a number of first samples in the first iteration, and taking each first sample in the set number of first samples as an initial cluster center, wherein one initial cluster center corresponds to an initial cluster; determining the first sample serving as the initial cluster center as the target first sample of the initial cluster; and generating a cluster vector of the initial cluster using the number of the target first sample of the initial cluster.
[0017] According to one embodiment of the present application, the cluster vector generation process includes: determining the position of the target first sample in the cluster vector according to the number, and encoding the vector element at the position as a first coding value; encoding the vector elements at the remaining positions as a second coding value, wherein the vector elements at the remaining positions correspond to the first sample that does not belong to the class cluster.
[0018] According to one embodiment of the present application, encoding the vector element at the position into a first encoding value includes: for any cluster, obtaining the number of the target first samples belonging to any cluster, and determining the first encoding value based on the number of the target first samples.
[0019] According to one embodiment of the present application, the clustering method further includes: receiving an encrypted verification vector sent by the participating node, and decrypting the encrypted verification vector based on the private key to obtain a decrypted verification vector, wherein the encrypted verification vector is generated based on the encrypted cluster vector; and sending the decrypted verification vector to the participating node for security verification.
[0020] According to one embodiment of the present application, the clustering method further includes: based on the identification information of the sample, aligning the sample with the participating nodes, and sequentially numbering the aligned first samples; and generating a feature space matrix of the business node based on the aligned first samples.
[0021] According to one embodiment of the present application, the clustering method further includes: generating an encryption key, the encryption key including a public key and a private key, and sending the public key to the participating nodes.
[0022] The second aspect of the present application also proposes a clustering method suitable for participating nodes, including: receiving an encrypted cluster vector of each cluster sent by a business node in each iteration, wherein the cluster vector is determined by the business node based on the number of a target first sample belonging to the cluster, and the target first sample belongs to a sample among the first samples of the business node; for each cluster, based on the encrypted cluster vector of the cluster, obtaining an encrypted target matrix corresponding to the cluster, and sending it to the business node until the iteration ends.
[0023] The clustering method proposed in the second aspect of the present application may also have the following additional technical features:
[0024] According to one embodiment of the present application, in the first iteration, the encrypted target matrix is the encrypted difference matrix of the second sample pairs of cluster centers on the participating nodes corresponding to the cluster, and the encrypted cluster vector based on the cluster is used to obtain the encrypted target matrix corresponding to the cluster, including: repeating the encrypted cluster vector of the initial cluster in the column direction according to the number of samples to construct a cluster matrix of the initial cluster; obtaining the cluster matrix of the initial cluster and multiplying it with the feature space matrix of the participating nodes to obtain a multiplication matrix, and subtracting the encrypted feature space matrix from the multiplication matrix to generate the encrypted difference matrix corresponding to the first iteration.
[0025] According to an embodiment of the present application, when it is not the first iteration, the encrypted target matrix is the encrypted update difference matrix between the cluster center obtained in the previous iteration and the cluster center obtained in the current iteration, and the encrypted cluster vector based on the class cluster is used to obtain the encrypted target matrix corresponding to the class cluster, including: repeating the encrypted cluster vector corresponding to the previous iteration and the encrypted cluster vector corresponding to the current iteration in the column direction according to the number of samples to construct two encrypted cluster matrices; obtaining the two encrypted cluster matrices and multiplying them with the feature space matrices of the participating nodes to obtain multiplication matrices; subtracting the multiplication matrix corresponding to the previous iteration from the multiplication matrix corresponding to the current iteration to obtain the encrypted update difference matrix corresponding to the current iteration.
[0026] According to an embodiment of the present application, in the first iteration, the corresponding encrypted cluster vector is determined based on the serial number of the target first sample belonging to the initial class cluster.
[0027] According to one embodiment of the present application, after receiving the encrypted cluster vector of each class cluster sent by the service node in each iteration, it also includes: adding each dimension of the encrypted cluster vector to obtain verification data; and verifying the security verification of the service node based on the verification data.
[0028] According to one embodiment of the present application, the security verification of the business node is verified based on the verification data, including: randomly generating a first column vector and a second column vector, and encrypting the second column vector using a public key; based on the verification data, performing an affine transformation on the first column vector and the encrypted second column vector to generate an encrypted verification vector; sending the encrypted verification vector to the business node, and receiving a decrypted verification vector returned by the business node; in response to the encryption verification vector and the decryption verification vector being consistent, determining that the business node has passed the security verification.
[0029] According to one embodiment of the present application, before receiving the encrypted cluster vector of each class cluster sent by the participating node in each iteration, it also includes: based on the identification information of the sample, aligning the sample with the business node, and sequentially numbering the second sample of the participating node after alignment; generating the feature space matrix of the participating node based on the aligned second sample.
[0030] According to an embodiment of the present application, the clustering method further includes: receiving a public key sent by the service node.
[0031] The third aspect of the present application proposes a clustering device, including: a cluster vector generation module, which is used to generate a cluster vector of the cluster for each cluster based on the number of the target first sample belonging to the cluster, and encrypt the cluster vector and send it to the participating nodes, wherein the cluster vector is used to represent the cluster center of the cluster; a difference matrix acquisition module, which is used to obtain a first difference matrix from the first sample of the business node to the cluster center corresponding to each cluster, and a second difference matrix from the second sample of the participating node to the cluster center; an update module, which is used to update the cluster center according to the first difference matrix and the second difference matrix of each cluster, re-cluster the first sample with the updated cluster center, and use each cluster obtained after re-clustering as the cluster corresponding to the next iteration, return to execute the above steps until the iteration ends, and generate the final target cluster.
[0032] The clustering device proposed in the third aspect of the present application may also have the following additional technical features:
[0033] According to one embodiment of the present application, the difference matrix acquisition module is also used to: repeat the cluster vector of the current iteration in the column direction according to the number of samples to construct the cluster matrix of the current iteration; obtain the multiplication of the cluster matrix and the feature space matrix of the business node to obtain a multiplication matrix, and subtract the feature space matrix from the multiplication matrix to generate the first difference matrix corresponding to the current iteration.
[0034] According to one embodiment of the present application, the difference matrix acquisition module is also used to: for the first iteration, receive the encrypted second difference matrix corresponding to the first iteration sent by the participating node, decrypt the encrypted second difference matrix, and obtain the second difference matrix, wherein the encrypted second difference matrix is determined by the participating node based on its own encrypted feature space matrix and the encrypted initial cluster vector.
[0035] According to one embodiment of the present application, the difference matrix acquisition module is also used to: for non-initial iterations, receive the encrypted updated difference matrix corresponding to the current iteration sent by the participating nodes, wherein the encrypted updated difference matrix is used to characterize the distance between the cluster center obtained in the previous iteration and the cluster center obtained in the current iteration, and is generated by the participating nodes based on their own feature space matrix, the encrypted cluster vector of the previous iteration and the encrypted cluster vector of the current iteration; decrypt the encrypted updated difference matrix to obtain an updated difference matrix; and add the second difference matrix corresponding to the previous iteration to the updated difference matrix of the current iteration to obtain the second difference matrix of the current iteration.
[0036] According to one embodiment of the present application, the device for implementing the clustering method also includes: a cluster center selection module, which is used to randomly set a number of first samples during the first iteration, and use each first sample in the set number of first samples as an initial cluster center, wherein one initial cluster center corresponds to an initial cluster; a sample determination module, which is used to determine the first sample serving as the initial cluster center as the target first sample of the initial cluster; and the cluster vector generation module, which is also used to generate a cluster vector of the initial cluster using the number of the target first sample of the initial cluster.
[0037] According to one embodiment of the present application, the cluster vector generation module also includes: an encoding unit, used to determine the position of the target first sample in the cluster vector according to the number, and encode the vector elements at the position as a first encoding value, and encode the vector elements at the remaining positions as a second encoding value, wherein the vector elements at the remaining positions correspond to the first sample that does not belong to the class cluster.
[0038] According to an embodiment of the present application, the encoding unit is further used to: for any class cluster, obtain the number of the target first samples belonging to the any class cluster, and determine the first encoding value according to the number of the target first samples.
[0039] According to one embodiment of the present application, the clustering device further includes: a verification module, used to receive the encrypted verification vector sent by the participating node, and decrypt the encrypted verification vector based on the private key to obtain a decrypted verification vector, and send the decrypted verification vector to the participating node to perform security verification, wherein the encrypted verification vector is generated based on the encrypted cluster vector.
[0040] According to one embodiment of the present application, the device for implementing the clustering method also includes: a numbering module, which is used to align samples with the participating nodes based on the identification information of the samples, and sequentially number the first samples after alignment; and a matrix generation module, which is used to generate a feature space matrix of the business node based on the aligned first samples.
[0041] According to one embodiment of the present application, the device for implementing the clustering method further includes: a key generation module, which is used to generate an encryption key, the encryption key includes a public key and a private key, and send the public key to the participating nodes.
[0042] In a fourth aspect, the present application proposes another clustering device, comprising: a cluster vector receiving module, used to receive the encrypted cluster vector of each cluster sent by the business node in each iteration, wherein the cluster vector is determined by the business node based on the number of the target first sample belonging to the cluster, and the target first sample is a sample among the first samples of the business node; a target matrix generating module, used to obtain the encrypted target matrix corresponding to each cluster based on the encrypted cluster vector of the cluster, and send it to the business node until the iteration ends.
[0043] The clustering device proposed in the fourth aspect of the present application may also have the following additional technical features:
[0044] According to one embodiment of the present application, the target matrix generation module is also used to: at the first iteration, repeat the encrypted cluster vector of the initial cluster in the column direction according to the number of samples to construct the cluster matrix of the initial cluster; obtain the cluster matrix of the initial cluster and multiply it with the feature space matrix of the participating nodes to obtain a multiplication matrix, and subtract the encrypted feature space matrix from the multiplication matrix to generate the encrypted difference matrix corresponding to the first iteration.
[0045] According to one embodiment of the present application, the target matrix generation module is also used to: when it is not the first iteration, according to the number of samples, repeat the encrypted cluster vector corresponding to the previous iteration and the encrypted cluster vector corresponding to the current iteration in the column direction to construct two encrypted cluster matrices; obtain the two encrypted cluster matrices and multiply them with the feature space matrices of the participating nodes to obtain multiplication matrices; subtract the multiplication matrix corresponding to the previous iteration from the multiplication matrix corresponding to the current iteration to obtain the encrypted update difference matrix corresponding to the current iteration.
[0046] According to an embodiment of the present application, in the first iteration, the corresponding encrypted cluster vector is determined based on the serial number of the target first sample belonging to the initial class cluster.
[0047] According to one embodiment of the present application, the clustering device further includes: a security verification module, which is used to add each dimension of the encrypted cluster vector to obtain verification data, and verify the security verification of the service node based on the verification data.
[0048] According to one embodiment of the present application, the security verification module includes:
[0049] A column vector generation unit, used to randomly generate a first column vector and a second column vector, and encrypt the second column vector using a public key; a verification vector generation unit, used to perform an affine transformation on the first column vector and the encrypted second column vector based on verification data to generate an encrypted verification vector; a decryption unit, used to send the encrypted verification vector to the business node, and receive a decrypted verification vector returned by the business node; a verification unit, used to determine that the business node has passed the security verification in response to the encryption verification vector and the decryption verification vector being consistent.
[0050] According to one embodiment of the present application, the clustering device also includes: a numbering module, which is used to align samples with the business nodes based on the identification information of the samples, and sequentially number the second samples of the participating nodes after the alignment; and a matrix generation module, which is used to generate a feature space matrix of the participating nodes based on the aligned second samples.
[0051] According to an embodiment of the present application, the clustering device further includes: a receiving module, configured to receive a public key sent by the service node.
[0052] To achieve the above-mentioned purpose, the fifth aspect of the present application proposes an electronic device, comprising: at least one processor; and a memory communicatively connected to the at least one processor; wherein the memory stores instructions executable by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the clustering method proposed in any one of the first and second aspects above.
[0053] The sixth aspect of the present application proposes a computer-readable storage medium, wherein the computer instructions are used to enable the computer to execute the clustering method proposed in any one of the first aspect and the second aspect.
[0054] In a seventh aspect, the present application proposes a computer program product, including a computer program, which, when executed by a processor, implements the clustering method proposed in any one of the first and second aspects above.
[0055] The clustering method applicable to business nodes proposed in the present application generates a cluster vector of a cluster based on the number of the target first sample, encrypts the cluster vector and sends it to the participating nodes, obtains the second difference matrix generated by the participating nodes and the first difference matrix generated by the business nodes, updates the cluster vector based on the first difference matrix and the second difference matrix, and re-clusters the first sample with the updated cluster vector, uses the updated cluster as the initial cluster for the next round of iteration, and continues to iterate until all rounds of iteration are completed to generate the final target cluster. In the present application, the sample data exchanged between the participating nodes and the business nodes is marked with numbers and encrypted at the same time, so that the participating nodes cannot obtain the feature data of the actual samples of the business nodes through data interaction. While ensuring the effect of the clustering method, it effectively ensures the data security of the samples and strengthens the confidentiality of the sample data.
[0056] It should be understood that the contents described in this application are not intended to identify the key or important features of the embodiments of this application, nor are they intended to limit the scope of this application. Other features of this application will become easily understood through the following description. BRIEF DESCRIPTION OF THE DRAWINGS
[0057] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:
[0058] Figure 1 A schematic diagram of a clustering method according to an embodiment of the present application;
[0059] Figure 2 A schematic diagram of a clustering method according to another embodiment of the present application;
[0060] Figure 3 A schematic diagram of a clustering method according to another embodiment of the present application;
[0061] Figure 4 A schematic diagram of a clustering method according to another embodiment of the present application;
[0062] Figure 5 A schematic diagram of a clustering method according to another embodiment of the present application;
[0063] Figure 6 A schematic diagram of a clustering method according to another embodiment of the present application;
[0064] Figure 7 A schematic diagram of a clustering method according to another embodiment of the present application;
[0065] Figure 8 A schematic diagram of a clustering method according to another embodiment of the present application;
[0066] Fig. 9A schematic diagram of a clustering method according to another embodiment of the present application;
[0067] Fig.10 A schematic diagram of a clustering method according to another embodiment of the present application;
[0068] Fig.11 A schematic diagram of a clustering method according to another embodiment of the present application;
[0069] Fig.12 A schematic diagram of a clustering method according to another embodiment of the present application;
[0070] Fig.13 A schematic diagram of a clustering method according to another embodiment of the present application;
[0071] Fig.14 A schematic diagram of a clustering method according to another embodiment of the present application;
[0072] Fig.15 A schematic diagram of a clustering method according to another embodiment of the present application;
[0073] Fig.16 A schematic diagram of a clustering method according to another embodiment of the present application;
[0074] Fig.17 A schematic diagram of a clustering method according to another embodiment of the present application;
[0075] Fig.18 A schematic diagram of a clustering method according to another embodiment of the present application;
[0076] Fig.19 This is a schematic diagram of the structure of a clustering device according to an embodiment of the present application;
[0077] Fig. 20 A schematic diagram of the structure of a clustering device according to another embodiment of the present application;
[0078] Fig.21 A schematic diagram of the structure of a clustering device according to another embodiment of the present application;
[0079] Fig. 22 A schematic diagram of the structure of a clustering device according to another embodiment of the present application;
[0080] Fig.23 A schematic diagram of the structure of an electronic device according to an embodiment of the present application. DETAILED DESCRIPTION
[0081] Embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are intended to be used to explain the present application, and should not be construed as limiting the present application.
[0082] The clustering method, device, electronic device and storage medium of the embodiments of the present application are described below with reference to the accompanying drawings.
[0083] Figure 1 The schematic diagram of the process of a clustering method according to an embodiment of the present application is shown in FIG1 . The clustering method is applicable to a service node. As shown in FIG1 , the method includes:
[0084] S101, for each cluster, based on the serial number of the target first sample belonging to the cluster, generate a cluster vector of the cluster, encrypt the cluster vector and send it to the participating nodes, wherein the cluster vector is used to represent the cluster center of the cluster.
[0085] Clustering is a kind of unsupervised learning method based on similarity. It can classify and analyze a large amount of data according to different data features and define the characteristics of each cluster. It can maximize the aggregation and organization of data subclasses with similar features, improve clustering quality, and approach the local optimal solution.
[0086] Class clusters can combine private, specific subclasses under a public, abstract superclass. It can be understood that a class cluster is a common interface for many subclasses, and a class cluster contains subclasses that can implement many functions.
[0087] In the embodiment of the present application, the service node can be understood as the initiator (Guest) of the clustering method model training, and the sample belonging to the service node is the first sample. The participating node (Host) can be understood as the participating node including the participating party and the data provider, and the sample belonging to the participating node is the second sample. The first sample and the second sample are generated based on different features of the same object.
[0088] It should be noted that the service node includes part of the information of user A, user B, user C, ..., user N, which is used as the first sample, such as the user's call record information, etc. The participation node includes another part of the information of user A, user B, user C, ..., user N, which is used as the second sample, such as the user's online shopping behavior information, etc.
[0089] For each cluster, the service node will determine the first sample belonging to the cluster as the target first sample, and the first sample has a unique non-repetitive number. According to the number of the target first sample, the cluster vector of the cluster can be generated. Among them, the cluster vector of each cluster can represent the cluster center of the cluster. Each cluster has one and only one cluster vector in each round of model training iteration. The cluster vector is a vector that can reflect the cluster center point of the cluster. In order to ensure the confidentiality and security of the feature data in the cluster, the cluster vector needs to be encrypted, and then the encrypted cluster vector is sent to the participating nodes.
[0090] Furthermore, before encrypting the cluster vector, a pair of public and private keys needs to be generated, which can be recorded as {p, p'}, where p is the public key and p' is the private key. The public key is used for encryption and the private key is used for decryption.
[0091] It is assumed that the encoding can be performed using the 0, 1 encoding rule. The sample points selected as cluster vectors are encoded with 1, and the remaining sample points are encoded with 0, so a 1×m-dimensional cluster vector can be obtained. If there are k class clusters, there are k cluster vectors. After encoding, k 1×m cluster vectors can be obtained. Then, the k 1×m cluster vectors are encrypted using the public key p, and the encrypted k 1×m cluster vectors are sent to the participating nodes.
[0092] S102, obtaining a first difference matrix from a first sample of a service node to a cluster center corresponding to each cluster, and a second difference matrix from a second sample of a corresponding participating node to a cluster center.
[0093] In the embodiment of the present application, the service node can construct a difference matrix based on the difference from each first sample to the cluster center, which is the first difference matrix. Optionally, the service node can construct a cluster matrix of each cluster based on the cluster vector of the cluster.
[0094] Furthermore, the service node obtains the first difference matrix of each cluster based on its own feature space matrix and the cluster matrix of each cluster.
[0095] Further, the participating nodes can construct a difference matrix based on the difference from the second sample to the corresponding cluster center, which is the second difference matrix. The business node can receive the second difference matrix sent by the participating node. Similarly, the participating node can obtain the encrypted cluster vector of each cluster sent by the business node. Further, for each cluster, the participating node constructs the cluster matrix of the cluster based on the cluster vector of the cluster, and obtains the second difference matrix of each cluster according to its own feature space matrix and the cluster matrix of each cluster. The participating node sends the second difference matrix of each cluster to the business node. In order to ensure the security of data transmission, the participating node can encrypt the second difference matrix and send it to the business node. Optionally, the second difference matrix is a difference matrix encrypted by the public key p.
[0096] Correspondingly, the service node needs to use the private key p' to decrypt the obtained second difference matrix, and then obtain the second difference matrix from the second sample of the participating node to the cluster center.
[0097] It should be noted that the service node uses the feature information of each first sample to form a feature space matrix, and the feature information of each first sample is a row element of the feature space matrix of the service node. The participating node uses the feature information of each second sample of the participating node to form a feature space matrix of the participating node, and the feature information of each second sample is a row element of the feature space matrix.
[0098] S103, updating the cluster center according to the first difference matrix and the second difference matrix of each cluster, re-clustering the first sample with the updated cluster center, and taking each cluster obtained after re-clustering as the cluster corresponding to the next iteration, returning to execute the above steps until the iteration ends, and generating the final target cluster.
[0099] In the embodiment of the present application, for each cluster, after obtaining the first difference matrix and the second difference matrix, the service node can update the cluster center corresponding to the cluster based on the first difference matrix and the second difference matrix of the cluster, that is, re-determine the new cluster vector of the cluster. Each first sample is re-clustered with the updated cluster center to generate a new cluster, and the generated new cluster is used as the cluster corresponding to the next iteration.
[0100] For the i-th cluster, set the first difference matrix to GD i , the second difference matrix is HD i , the business node obtains the first difference matrix GD i and the second difference matrix HD i After that, the two are spliced, and the service node can obtain the distance from each first sample to the cluster center of the i-th cluster through the splicing matrix. Based on the distance from each first sample to the cluster center of the i-th cluster, each first sample can be re-clustered. After re-clustering, the target first sample belonging to the i-th cluster can be re-determined, and the cluster vector of the cluster can be updated according to the re-determined target first sample to perform the next iteration.
[0101] The distance from the first sample numbered i to the cluster center of the i-th cluster can be calculated according to the following formula:
[0102]
[0103] Furthermore, in order to achieve the optimal effect of the clustering method, the conditions for the end of the iteration can be set. When the clustering method effect output by a certain iteration or the overall number of iterations reaches the conditions specified by the set end of the iteration, the iteration of the clustering method can be ended, and the cluster generated by the last iteration can be used as the final target cluster.
[0104] Among them, the iteration stopping condition can be set to the change of cluster center, the number of algorithm iterations, the minimum loss function, etc.
[0105] For example, the end condition of the iteration is set to the number of iterations N. When the number of iterations of a certain round reaches N, the current round of iteration is the last round of iteration, and the cluster generated by this round of iteration is the final target cluster.
[0106] For another example, the end condition of the iteration is set to be that the aggregation organization of the sample points with feature A in the cluster generated by a certain iteration reaches a certain degree B. Based on the set iteration end condition, a detection program for the aggregation degree of the sample points with feature A in the cluster is set at the same time and stored in the set location. After each round of iteration ends, the detection program detects the aggregation degree of the sample points with feature A in the generated cluster. When the aggregation organization of the sample points with feature A in the cluster generated after a certain iteration reaches degree B, it is determined that the set iteration effect is achieved and the iteration can be ended. Then the current round of iteration is the last round of iteration, and the generated cluster is determined to be the final target cluster.
[0107] The clustering method proposed in the present application generates a cluster vector of a cluster based on the number of the target first sample, and encrypts the cluster vector and sends it to the participating nodes, obtains the second difference matrix generated by the participating nodes and the first difference matrix generated by the business node, updates the cluster vector based on the first difference matrix and the second difference matrix, and re-clusters the first sample with the updated cluster vector, uses the updated cluster as the initial cluster for the next round of iteration, and continues to iterate until all rounds of iteration are completed to generate the final target cluster. In the present application, the sample data exchanged between the participating nodes and the business nodes is marked with numbers and encrypted at the same time, so that the participating nodes cannot obtain the feature data of the actual samples of the business nodes through data interaction. While ensuring the effectiveness of the clustering method, it effectively ensures the data security of the samples and strengthens the confidentiality of the sample data.
[0108] In order to better understand the above embodiment, the acquisition process of the first difference matrix proposed therein can be combined with Figure 2 To further understand, Figure 2 As shown, Figure 2 The following is a flow chart of a clustering method according to an embodiment of the present application. The method includes:
[0109] S201, repeating the cluster vector of the current iteration in the column direction according to the number of samples to construct the cluster matrix of the current iteration.
[0110] The service node constructs a first difference matrix based on the difference from each first sample to the cluster center, and assumes that the first sample on the service node has t-dimensional features and the second sample on the participating node has s-dimensional features.
[0111] In the embodiment of the present application, the number of samples is set to m, and a 1×m cluster vector A of the i-th cluster of the current iteration is generated. i , by cluster vector A i Repeat m times in the column direction to expand and generate the m×m cluster matrix of the current round iteration Among them, the cluster vector A i is a 1×m row vector.
[0112] S202, obtain the cluster matrix and multiply the characteristic space matrix of the service node to obtain a multiplication matrix, and subtract the characteristic space matrix from the multiplication matrix to generate a first difference matrix corresponding to the current iteration.
[0113] It is assumed that the feature information of the first sample on the service node constitutes its own feature space matrix G, and the cluster matrix is multiplied by the feature space matrix of the service node to obtain the multiplied matrix Subtract the feature space matrix from the multiplication matrix to obtain the first difference matrix GD corresponding to the current iteration i , the formula is as follows:
[0114]
[0115]
[0116] The clustering method proposed in the present application is that the business node can obtain the first difference matrix corresponding to the current iteration based on its own feature space matrix and the cluster vector corresponding to the cluster. In the present application, the calculation method of the first difference matrix is limited. By encrypting the first difference matrix, the participating nodes can update the corresponding cluster center without obtaining the sample data of the business node, and then realize the update of the cluster, so that the sample data of the business node can be effectively protected, ensuring the security of the data.
[0117] To better understand the above embodiment, further, the generation process of the cluster vector proposed therein can be combined with FIG. 3. Figure 3 FIG. 1 is a flow chart of a clustering method according to another embodiment of the present application. Figure 3 As shown, the method includes:
[0118] S301, determining a position of a target first sample in a cluster vector according to the serial number, and encoding a vector element at the position into a first encoding value.
[0119] In the embodiment of the present application, each first sample has a unique non-repetitive number, and the numbers are in order. The position of the target first sample in the cluster vector can be determined according to the number, wherein the vector element corresponding to the position of the target first sample in the cluster vector can be encoded as a first encoding value.
[0120] Optionally, for the first iteration, the target first sample may be encoded using a 0, 1 encoding rule, and the vector element at the corresponding position of the target first sample in the cluster vector is encoded as 1. For example, if the sequence number of the target first sample in the cluster vector is set to 5, the vector element at the 5th position in the cluster vector is encoded as 1.
[0121] Optionally, for non-initial iterations, the target first sample may be encoded using the 0, 1 / z encoding rule, and the vector element at the corresponding position of the target first sample in the cluster vector may be encoded as 1 / z. The participating nodes may obtain the number of target first samples belonging to any cluster for any cluster, and determine the first encoding value based on the number of target first samples. In implementation, a counting program may be set in the participating nodes, and for any cluster, the program may be executed to obtain the number z of target first samples in the cluster, and then determine the first encoding value as 1 / z.
[0122] For example, if the sequence number of the first target sample in the cluster vector is set to 5, and the number of the first target samples in the cluster is 100, then the vector element at the 5th position in the cluster vector is encoded as 1 / 100.
[0123] S302: Encode the vector elements at the remaining positions into second encoded values, wherein the vector elements at the remaining positions correspond to the first samples that do not belong to the cluster.
[0124] In the embodiment of the present application, after the position of the vector element corresponding to the target first sample is determined in the cluster vector, all vector elements except the position are encoded as the second encoding value.
[0125] Still taking the above example, all vector elements except the 5th vector element are encoded as 0.
[0126] Optionally, for the first iteration, the target first sample is encoded using the 0, 1 encoding rule, and the vector elements at positions other than the vector element corresponding to the target first sample in the cluster vector are all encoded as 0. For example, if the sequence number of the target first sample in the cluster vector is set to 5, the 0, 1 encoding rule is used to encode the vector element at the 5th position in the cluster vector as 1, and the vector elements at other positions are all encoded as 0, and the obtained cluster vector is <a1>=( <0> , <0> , <0> , <0> , <1> , …, <0> ).
[0127] Optionally, for non-initial iterations, the target first sample is encoded using the 0, 1 / z encoding rule, and the vector elements at positions other than the vector elements corresponding to the target first sample in the cluster vector are encoded as 0. For example, if the sequence number of the target first sample in the cluster vector is set to 5, the 0, 1 / z encoding rule is used to encode the vector element at the 5th position in the cluster vector as 1 / z, and the vector elements at other positions are encoded as 0. For example, if the sequence number of the target first sample in the cluster vector is set to 5, the number of target first samples is 100, the vector element at the 5th position in the cluster vector is encoded as 1 / 100, and the vector elements at other positions are encoded as 0, and the cluster vector obtained is <a1>=( <0> , <0> , <0> , <0> , <1 / 100, ..., 0.
[0128] Among them, except for the vector element at the position where the target first sample is located, which corresponds to the target first sample, the other vector elements in the cluster vector correspond to the first samples of other clusters other than the cluster where the target first sample is located.
[0129] For example, the sequence number of the cluster vector of the first cluster is 3, and the corresponding encrypted cluster vector is <a1>=( <0> , <0> , <1> , ..., <0> ), where the cluster vector A1 represents the cluster center of the first cluster. In this vector, only the sample with the sequence number 3 selected as the center point is encoded as 1, and the rest of the samples are encoded as 0. The cluster vector A1 of the first cluster is generated by encrypting it with the public key p <a1>Similarly, the cluster vectors of the second cluster, the third cluster, and so on can be generated by encrypting them with the public key p <a2> 、 <a3>And so on, the business node can obtain k encrypted cluster vectors { <a1> , <a2> , <a3>, ..., k >} and sends it to the participating nodes.
[0130] The clustering method proposed in the present application limits the generation process of cluster vectors, encodes cluster vectors based on different rules for the initial iteration and non-initial iteration, and thus realizes effective encryption of cluster vectors, thereby ensuring the security of sample data.
[0131] In the above embodiment, the process of determining the initial cluster vector of the first sample proposed can be combined with Figure 4 To further understand, Figure 4 FIG. 1 is a flow chart of a clustering method according to an embodiment of the present application. Figure 4 As shown, the method includes:
[0132] S401, randomly setting a number of first samples in the first iteration, and taking each first sample in the set number of first samples as an initial cluster center, wherein one initial cluster center corresponds to one initial class cluster.
[0133] S402: Determine the first sample as the initial cluster center as the target first sample of the initial cluster.
[0134] In the embodiment of the present application, for the first iteration, the service node needs to set a certain number of initial cluster centers and generate random initial class clusters based on the set initial cluster centers.
[0135] The service node may randomly determine a certain number of first samples as initial cluster centers among the first samples, wherein each initial cluster center corresponds to an initial class cluster.
[0136] In the embodiment of the present application, in the first iteration, the first sample selected as the initial cluster center is used as the target first sample of the initial cluster.
[0137] S403: Generate a cluster vector of the initial cluster using the serial number of the target first sample of the initial cluster.
[0138] The target first sample in the initial cluster has a unique non-repetitive number, and the number is in order. The service node generates a cluster vector corresponding to the initial cluster according to the number in the target first sample of the initial cluster.
[0139] For the first iteration, the cluster vector may be encoded using a 0, 1 encoding rule, and the service node generates a cluster vector corresponding to the initial class cluster based on the cluster vector generation method proposed in the above embodiment.
[0140] S404, starting from the initial cluster, encrypting the cluster vector of each cluster generated in each iteration and sending it to the participating nodes, wherein the cluster vector is used to represent the cluster center of the cluster.
[0141] For step S404, please refer to the above-mentioned related details, which will not be repeated here.
[0142] S405 , obtaining a first difference matrix from a first sample of a service node to a cluster center corresponding to each cluster, and a second difference matrix from a second sample of a corresponding participating node to a cluster center.
[0143] Furthermore, for the first iteration, the process of obtaining the second difference matrix can be combined with Figure 5 Understanding, such as Figure 5 As shown, including:
[0144] S501, receiving the encrypted second difference matrix corresponding to the first iteration sent by the participating node, decrypting the encrypted second difference matrix to obtain the second difference matrix, wherein the encrypted second difference matrix is determined by the participating node based on its own encrypted feature space matrix and the encrypted initial cluster vector.
[0145] In the embodiment of the present application, the service node may receive the encrypted second difference matrix corresponding to the first iteration sent by the participating node, and perform a decryption operation on it using the private key p' to obtain the decrypted second difference matrix.
[0146] Assume that the encrypted second difference matrix received by the service node is encrypted using the private key p' <HD i >Decrypt and obtain the decrypted second difference matrix HD i , the formula is as follows:
[0147]
[0148] Furthermore, for non-initial iterations, the participating nodes generate a difference matrix between the second sample and the corresponding cluster center as an updated difference matrix. The service node obtains the second difference matrix of the current iteration based on the obtained updated difference matrix. This process can be combined with Figure 6 Understanding, such as Figure 6 As shown, including:
[0149] S601, receiving the encrypted update difference matrix corresponding to the current iteration sent by the participating nodes, wherein the encrypted update difference matrix is used to characterize the distance between the cluster center obtained in the previous iteration and the cluster center obtained in the current iteration, and is generated by the participating nodes based on their own feature space matrix, the encrypted cluster vector of the previous iteration and the encrypted cluster vector of the current iteration.
[0150] In order to update the cluster center based on the previous iteration in this iteration, the participating nodes need to generate an update difference matrix, which can represent the distance between the cluster center of the previous iteration and the cluster center of the current iteration.
[0151] Furthermore, after obtaining the update vector sent by the business node, the participating node can generate an update difference matrix based on the update vector that passes the security check. The participating node determines the number of samples in the current round of iteration, and repeats the encrypted cluster vector of the previous round of iteration and the encrypted cluster vector of the current round of iteration in the column direction for a certain number of times to construct the corresponding encrypted cluster matrix, where the number of repetitions is the same as the number of samples. The two encrypted coarse matrices obtained by calculation are multiplied with the feature space matrix of the participating node respectively to obtain the multiplication matrix corresponding to the encrypted cluster vector of the previous round of iteration and the multiplication matrix corresponding to the encrypted cluster vector of the current round of iteration respectively. The two multiplication matrices are subtracted to obtain the update difference matrix corresponding to the current round of iteration. The obtained update difference matrix is encrypted using the public key and sent to the business node.
[0152] S602, decrypt the encrypted update difference matrix to obtain an update difference matrix.
[0153] In the embodiment of the present application, the service node receives the encrypted update difference matrix, performs a decryption operation on the encrypted update difference matrix, and then obtains the decrypted update difference matrix.
[0154] Set, the participating nodes will encrypt the updated difference matrix <hD i >Synchronize to the business node, the business node uses the private key p' to decrypt and obtain the decrypted update difference matrix hD i , the formula is as follows:
[0155]
[0156] S603 , adding the second difference matrix corresponding to the previous iteration to the updated difference matrix of the current iteration to obtain the second difference matrix of the current iteration.
[0157] In the embodiment of the present application, the second difference matrix of the current round iteration is set to HD′ i , the second difference matrix of the previous iteration is HD i , then the formula is as follows:
[0158]
[0159] Then the second difference matrix corresponding to the current round iteration is obtained.
[0160] Furthermore, the difference matrix GD′ between the first sample of the service node and the updated cluster center is i , can be obtained by the following formula:
[0161]
[0162] Update the difference matrix GD′ by obtaining the cluster center of the first sample corresponding to the current round iteration i , and the corresponding second difference matrix HD i , update the cluster center, and then complete the update of the cluster.
[0163] S406, updating the cluster center according to the first difference matrix and the second difference matrix of each cluster, re-clustering the first sample with the updated cluster center, and taking each cluster obtained after re-clustering as the cluster corresponding to the next iteration, and continuing the iteration until the final target cluster is generated.
[0164] Step S406 may refer to the above-mentioned related details, which will not be repeated here.
[0165] The clustering method proposed in the present application defines the generation process of the cluster vector of the initial cluster during the first iteration, and encrypts the cluster vector and sends it to the participating nodes. The acquisition process of the second difference matrix is defined for the first iteration and the non-first iteration, and the cluster vector is updated based on the acquired second difference matrix and the first difference matrix, based on the first difference matrix and the second difference matrix, and the first sample is re-clustered with the updated cluster vector, and the updated cluster is used as the initial cluster for the next round of iteration. Iteration continues until all rounds of iteration are completed to generate the final target cluster. In the present application, the sample data exchanged between the participating nodes and the business nodes is marked with numbers and encrypted at the same time, so that the participating nodes cannot obtain the feature data of the actual samples of the business nodes through data interaction. While ensuring the effect of the clustering method, it effectively ensures the data security of the samples and strengthens the confidentiality of the sample data.
[0166] In order to ensure data security during data interaction between business nodes and participating nodes, business nodes need to assist participating nodes in performing security checks on the encrypted vectors received from business nodes, such as Figure 7 As shown, Figure 7 The present invention is a flow chart of a clustering method according to an embodiment of the present invention. The clustering method is applicable to a service node and includes:
[0167] In the implementation, the clustering method is based on the interaction of the cluster vectors and update difference matrices of the business nodes and participating nodes to achieve the generation of the final target cluster. Therefore, both the business nodes and participating nodes need to ensure the confidentiality and security of the data they hold. Since the cluster vectors as basic data are generated by the business nodes and sent to the participating nodes, there is a certain possibility that the business nodes can have the opportunity to obtain the spatial feature data of the participating nodes that need to be kept confidential through irregular operations.
[0168] Specifically, if the service node sets the cluster vector A i (i=1,2,...,k), replaced with a zero vector and homomorphically encrypted and sent to the participating nodes. The participating nodes cannot judge the zero vector. Then the business node can obtain the illegal feature space data of the participating nodes according to the formula. The formula is as follows:
[0169]
[0170] For the i-th cluster containing z sample points, construct an updated cluster vector b i , and encrypt it with the public key p to obtain the encrypted cluster vector i >, where the encrypted cluster vector b i It is constructed based on the sample number and encoded using the 0, 1 / z rule. For example, in the third cluster, the encrypted cluster vector b3 can be in, The sample points corresponding to the encoded vector elements belong to the third cluster, and the sample points corresponding to the vector elements encoded as 0 do not belong to the third cluster. It can be further known that in the encrypted cluster vector b3, the sample points numbered 1, 3, 6... belong to the third cluster.
[0171] Based on the above method, k encrypted cluster vectors can be obtained: i >.
[0172] If the encrypted cluster vector i > If the replacement is 0, the business node can also obtain the feature space data of the participating nodes through the formula. The formula is as follows:
[0173]
[0174]
[0175] Therefore, in each iteration, the participating node needs to perform a security check on the cluster vector sent by the business node to determine whether it is a zero vector. In order to achieve cooperation between the business node and the participating node, the business node needs to assist the participating node in performing a security check on the data received from the participating node. Specific methods applicable to business nodes include:
[0176] S701, receiving an encrypted verification vector sent by a participating node, and decrypting the encrypted verification vector based on a private key to obtain a decrypted verification vector, wherein the encrypted verification vector is generated according to the encrypted cluster vector.
[0177] Zero-knowledge proof can be understood as a proof that a verifier can determine that a certain assertion is correct without providing any useful information to the verifier. In the embodiment of the present application, the zero-knowledge proof method can be used. The business node can verify the security of the data obtained by the participating node through the zero-knowledge proof method without sending important key information to the participating node.
[0178] The service node obtains the verification vector generated according to the encrypted cluster vector sent by the participating node, decrypts it according to the private key p', and obtains the decrypted verification vector.
[0179] For example, the participating nodes need to detect the security of the obtained cluster vectors. The encryption method of the cluster vectors has the characteristic of being checkable. When the business node sends an untrue cluster vector to the participating node, the participating node needs to check the authenticity of the encrypted cluster vector to ensure the security of the participating node model feature space under the premise of business node data security and confidentiality. The business node needs to prove to the participating node that the sum of the vector elements contained in the cluster vector it sent is 1. Set the encrypted verification vector sent by the business node based on the obtained participating node to <t>, get the verification vector T′, the formula is as follows:
[0180] T′=Decrypt1( <t>) (11)
[0181] S702, sending a decryption verification vector to participating nodes for security verification.
[0182] In the embodiment of the present application, the verification vector T′ obtained after decryption is sent to the participating nodes, so that the participating nodes can complete the security verification.
[0183] The clustering method proposed in this application shows the process of security verification of encrypted data sent by business nodes by participating nodes. While the sample feature data of business nodes can be effectively kept confidential, the security of feature space data of participating nodes is effectively guaranteed, which better promotes the achievement of cooperation between business nodes and participating nodes.
[0184] The feature space matrix proposed in the above embodiment is the basis for the clustering method to be implemented. The generation process of the feature space matrix can be combined with Figure 8 To further understand, Figure 8 As shown, Figure 8 The following is a flow chart of a clustering method according to an embodiment of the present application. The method includes:
[0185] S801, based on the identification information of the sample, align the samples with the participating nodes, and sequentially number the first sample after the alignment.
[0186] In order to achieve effective interaction between the service node and the participating node data, it is necessary to align the samples of the service node based on the participating nodes, and number the first samples belonging to the aligned service node in sequence.
[0187] S802: Generate a feature space matrix of the service node based on the aligned first sample.
[0188] In the embodiment of the present application, after the first samples of the service nodes are aligned and numbered, the feature space of the service nodes is standardized to generate a corresponding feature space matrix.
[0189] The clustering method proposed in the present application limits the generation process of the service node sample alignment number and the feature space matrix, effectively ensures the normal execution of the subsequent operations of the clustering method, and guarantees the feasibility of the clustering method.
[0190] In the clustering method proposed in the above embodiment, the interaction between the participating nodes and the service nodes needs to be encrypted and decrypted using a secret key. Fig. 9 , Fig. 9 FIG. 1 is a flow chart of a clustering method according to an embodiment of the present application. Fig. 9 As shown, the method includes:
[0191] S901, generate an encryption key, which includes a public key and a private key, and send the public key to the participating nodes.
[0192] In the embodiment of the present application, in order to ensure the security and confidentiality of the data sent by the service node, the sent data needs to be encrypted. An encryption key can be generated, and the encryption key includes a public key and a private key.
[0193] Among them, the public key is used for encryption and can be disclosed to participating nodes, and the private key is used for decryption and can only be held by business nodes. The public key and private key are mutually corresponding and unique, and data encrypted by the public key can only be decrypted using the corresponding private key.
[0194] After the business node generates the public key and private key, it can send the public key to the participating node, and the participating node uses the public key sent by the business node to encrypt the data it generates.
[0195] The clustering algorithm proposed in this application allows business nodes to generate encryption keys and send the public keys therein to participating nodes. The business nodes and participating nodes can encrypt interactive data based on the public keys, so that sample data can be effectively kept confidential, thereby strengthening the security of sample data.
[0196] Corresponding to the clustering method applicable to the service nodes proposed in the above embodiment, the present application also proposes a clustering method applicable to the participating nodes, such as Fig.10 As shown, Fig.10 This is a flow chart of a clustering method according to another embodiment of the present application, the method comprising:
[0197] S1001, receiving an encrypted cluster vector of each cluster sent by a service node in each iteration, wherein the cluster vector is determined by the service node based on a serial number of a target first sample belonging to the cluster, and the target first sample is a sample among first samples of the service node.
[0198] In an embodiment of the present application, the service node generates a cluster vector corresponding to each class cluster in each round of iteration based on the method proposed in the above embodiment, and encrypts and sends it to the participating nodes. The participating nodes can receive the encrypted cluster vector.
[0199] Among them, for the first iteration, the encrypted cluster vector is determined by the service node based on the serial number of the target first sample of the initial class cluster. The specific process can be found in the above-mentioned related details, which will not be repeated here.
[0200] S1002, for each cluster, based on the encrypted cluster vector of the cluster, obtain the encrypted target matrix corresponding to the cluster, and send it to the service node until the iteration ends.
[0201] In the embodiment of the present application, after the participating nodes obtain the encrypted cluster vectors, they generate corresponding target matrices based on each cluster, encrypt them and send them to the service nodes.
[0202] Among them, for the first iteration, the target matrix is the second difference matrix of each second sample from the cluster center; for non-first iteration, the target matrix is the updated difference matrix between the cluster center of the previous iteration and the cluster center of the current iteration.
[0203] In the clustering method proposed in the present application, participating nodes generate a target matrix based on the encrypted cluster vectors obtained, and send it to the business nodes after encryption, so that the business nodes can update the cluster centers based on the first difference matrix generated by themselves, thereby realizing the update of the class clusters.
[0204] The encryption target matrix generated by the participating nodes proposed in the above embodiment is, for the first iteration, the encryption target matrix generated by the participating nodes is the corresponding second difference matrix, wherein the generation method of the second difference matrix can be combined with Fig.11 It is further understood that the method comprises:
[0205] S1101, repeating the encrypted cluster vector of the initial cluster in the column direction according to the number of samples to construct a cluster matrix of the initial cluster.
[0206] In the embodiment of the present application, the number of samples is determined, and the cluster vectors of the initial clusters are repeated in the column direction based on the same number of times, thereby generating a coarse matrix of the initial clusters.
[0207] For example, if the number of samples is set to m, the business node generates k 1×m encrypted cluster vectors, and the participating node needs to obtain the second difference matrix corresponding to the i-th cluster vector. After the participating node obtains the encrypted k 1×m cluster vectors, the i-th cluster vector is expanded to generate an m×m matrix by repeating the 1×m row vector m times in the column direction. Generate a cluster matrix of initial class clusters.
[0208] S1102, obtaining the cluster matrix of the initial cluster and multiplying it with the feature space matrix of the participating nodes to obtain a multiplication matrix, and subtracting the encrypted feature space matrix from the multiplication matrix to generate an encrypted difference matrix corresponding to the first iteration.
[0209] The embodiment of the present application defines the calculation process of participating nodes generating the second difference matrix for the first iteration.
[0210] Set the cluster matrix of the participating nodes to obtain the initial cluster And encrypt its own feature space matrix H using the public key p to obtain the encrypted space matrix <h>. Perform calculations according to the set formula to obtain the corresponding second difference matrix. The formula is as follows:
[0211]
[0212]
[0213] Among them, H ij It is the value of the j-th dimension of the i-th sample point of the participating node.
[0214] The second difference matrix obtained in the first iteration is encrypted and synchronized to the service node, which is HD i (i=1, 2, ..., k).
[0215] The clustering method proposed in this application shows the generation process of the second difference matrix for the first iteration, so that the business node can update the cluster center and class cluster based on the first difference matrix generated by itself and the acquired second difference matrix, further enabling the data to obtain effective security protection.
[0216] The target matrix generated by the participating nodes proposed in the above embodiment is, for non-initial iterations, an encrypted target matrix generated by the participating nodes is an updated difference matrix between the cluster centers of the current iteration and the cluster centers of the previous iteration, wherein the generation method of the updated difference matrix can be combined with Fig.12 It is further understood that the method comprises:
[0217] S1201 , according to the number of samples, the encrypted cluster vector corresponding to the previous iteration and the encrypted cluster vector corresponding to the current iteration are repeated in the column direction to construct two encrypted cluster matrices.
[0218] In the embodiment of the present application, the number of samples is set to m, and the service node updates the k update vectors of the previous iteration. i >Sent to participating nodes, and participating nodes obtain the update vector i >After that, i >Repeat m times in the column direction to expand to generate an m×m cluster matrix Use the public key p to obtain the cluster matrix Encrypt and obtain the encrypted cluster matrix The m×m cluster matrix generated by the expansion of the cluster vector in the previous iteration is Encrypt it using the public key p to obtain the encrypted cluster matrix of the previous iteration
[0219] S1202, obtain two encrypted cluster matrices and multiply them with the feature space matrices of the participating nodes respectively to obtain a multiplication matrix.
[0220] The encrypted cluster matrix of the cluster vector of the previous iteration is and the encrypted cluster matrix of the cluster vector of the current iteration Multiply the feature space matrix H of the participating nodes respectively to obtain the multiplication matrix as well as
[0221] S1203, subtract the multiplication matrix corresponding to the previous iteration from the multiplication matrix corresponding to the current iteration to obtain the encryption update difference matrix corresponding to the current iteration.
[0222] According to the formula, the multiplication matrix corresponding to the cluster vector of the previous iteration is obtained The multiplication matrix corresponding to the cluster vector of the current iteration By subtracting, we can get the encrypted update difference matrix corresponding to the current round iteration <hD i >, where:
[0223]
[0224] The obtained encrypted update difference matrix is sent to the business node until the iteration ends.
[0225] The clustering method proposed in this application shows the generation process of the update difference matrix for non-initial iterations, so that the business node can generate the second difference matrix corresponding to the current round of iteration based on the second difference matrix obtained in the previous round of iteration and the obtained updated difference matrix. At the same time, combined with the first difference matrix generated by itself, the cluster center and class cluster are updated, which further enables the data to obtain effective security protection.
[0226] In order to ensure the security of their own feature space data, participating nodes need to perform security checks on the encrypted cluster vectors obtained after obtaining the encrypted cluster vectors of each cluster sent by the business node in each iteration, such as Fig.13 FIG13 is a schematic diagram of a clustering method according to another embodiment of the present application, the method comprising:
[0227] In the implementation, the idea of zero-knowledge proof can be used to implement the security check of the cluster vector sent by the business node. The business node needs to inform the participating nodes that the cluster vector A it sent is i (i=1, 2, ..., k) The sum of each dimension is 1.
[0228] Optionally, if the cluster vector sent by the service node has only one vector element dimension of 1 and the other vector element dimensions are 0, then the cluster vector is a valid and available cluster vector and can be used for data interaction to achieve effective aggregation of class clusters.
[0229] Optionally, the cluster vector sent by the service node may have multiple vector elements with values, and the sum of all values is 1. In this case, the cluster vector sent by the service node is invalid and unusable, but will not threaten the security of the feature space data of the participating nodes.
[0230] Therefore, under the framework of zero-knowledge proof, the business node only needs to inform the participating nodes that the sum of the vector element values of each dimension of the cluster vector sent by it is 1. The participating nodes only need to verify this and determine whether the cluster vector sent by the business node is a zero vector, thereby realizing the security check of the cluster vector and the update vector by the participating nodes. Taking the security check of the cluster vector as an example, combined with Fig.13 For further understanding, the method includes:
[0231] S1301, adding each dimension of the encrypted cluster vector to obtain verification data.
[0232] In the embodiment of the present application, the encrypted cluster vector obtained by the participating nodes is set to i >, i >Adding each dimension can obtain verification data <R i >, the formula is as follows:
[0233]
[0234] Among them, A ij is the i-th encrypted cluster vector A i The value in the j-th dimension.
[0235] S1302: Verify the security verification of the service node based on the verification data.
[0236] In an embodiment of the present application, participating nodes can implement security verification of business nodes based on verification data based on a zero-knowledge proof verification method.
[0237] Furthermore, the specific method of participating in the security verification of the node can be combined with Fig.14 Understanding, such as Fig.14 As shown, the method includes:
[0238] S1401, randomly generate a first column vector and a second column vector, and encrypt the second column vector using a public key.
[0239] S1402: Based on the verification data, perform affine transformation on the first column vector and the encrypted second column vector to generate an encrypted verification vector.
[0240] S1403: Send an encrypted verification vector to the service node, and receive a decrypted verification vector returned by the service node.
[0241] S1404: In response to the encryption verification vector and the decryption verification vector being consistent, it is determined that the service node passes the security verification.
[0242] For example, taking the security verification of the encrypted cluster vector as an example, the verification data obtained by the participating nodes <R i >, the participating nodes can randomly generate two sets of column vectors, the first column vector a and the second column vector b. If the number of samples is set to m, then the first column vector a and the second column vector b of m× 1 can be generated according to the number of samples. The second column vector b is encrypted using the public key p to obtain the encrypted second column vector , for the first column vector a and the encrypted second column vector Perform affine transformation to generate encrypted verification vector <t>, and sent to the business node, where the encrypted verification vector <t>The calculation formula is as follows:
[0243] <t> = <r> a+ (16)
[0244] The business node obtains the encrypted verification vector sent by the participating node <t>Decryption is performed to obtain a decryption verification vector T′, and the decryption verification vector T′ is sent to the participating nodes.
[0245] In the implementation, when the encrypted cluster vector sent by the business node to the participating nodes is correct and valid, <R i >= <1> , the participating nodes can obtain the encryption verification vector T by setting the formula, the formula is as follows:
[0246] T=a+b (17)
[0247] If the encryption verification vector T is an m×1 column vector, the participating nodes can determine whether the encrypted cluster vector sent by the service node can pass the security verification by comparing the decryption verification vector T′ with each dimension of the encryption verification vector T.
[0248] Optionally, if the vector elements of each dimension of the decryption verification vector T′ and the encryption verification vector T are consistent, the security verification is passed; optionally, if there is an inconsistency between the vector elements of each dimension of the decryption verification vector T′ and the encryption verification vector T, it can be determined that the encrypted cluster vector sent by the business node is illegal and invalid and has not passed the security verification.
[0249] Similarly, update vector i >The same approach can be taken for security verification.
[0250] To better understand the security verification proposed in the above embodiment, Fig.15 , Fig.15 The interactive process of participating nodes and business nodes completing security verification together is shown, where:
[0251] S151, adding the vector element values of each dimension of the obtained encryption vector, randomly generating a first column vector and a second column vector, and performing affine transformation to generate an encryption verification vector.
[0252] S152, sending an encrypted verification vector.
[0253] S153, decrypt the encrypted verification vector and send the decrypted verification vector to the participating nodes.
[0254] S154, sending a decryption verification vector.
[0255] S155, comparing the encryption verification vector and the decryption verification vector for consistency of the vector element values of each dimension, thereby completing the security verification.
[0256] The business participating node adds the vector element values of each dimension of the obtained encrypted vector, and randomly generates the first column vector and the second column vector for affine transformation, obtains the encrypted verification vector, and sends it to the business node. The business node decrypts the encrypted verification vector and returns it to the participating node. At the same time, the participating node compares the obtained decrypted verification vector with the encrypted verification vector, and completes the security verification based on the consistency of the vector element values in each dimension.
[0257] The clustering method proposed in this application is that the participating nodes perform security checks on the encrypted data sent by the acquired business nodes, and determine whether the encrypted data sent by the business nodes is correct and secure based on the comparison results of the encryption verification vector and the decryption verification vector. In this application, this verification method only requires the business node to decrypt the encryption verification vector and synchronize it to the participating nodes, without sending valid information to the participating nodes. The participating nodes can implement security verification of the data sent by the business nodes based on the comparison results of the encryption verification vector and the decryption verification vector, thereby ensuring the security and confidentiality of the data.
[0258] In order to better implement the clustering method proposed in the above embodiment, it is necessary to further process the samples, such as Fig.16 As shown, Fig.16 This is a flow chart of a clustering method according to another embodiment of the present application. The method is applicable to participating nodes and includes:
[0259] S1601, based on the identification information of the sample, align the sample with the business node, and sequentially number the second samples of the aligned participating nodes.
[0260] In the embodiment of the present application, in order to realize data interaction between the participating node and the service node, the participating node needs to align samples with the service node and randomly number the second samples belonging to the participating node in sequence.
[0261] S1602: Generate a feature space matrix of participating nodes based on the aligned second samples.
[0262] In the embodiment of the present application, the participating nodes standardize the feature space after alignment and numbering of the second samples, thereby generating a corresponding feature space matrix.
[0263] The clustering method proposed in the present application limits the generation process of the alignment numbering of participating node samples and the feature space matrix, effectively guarantees the normal execution of subsequent operations of the clustering method, and ensures the feasibility of the clustering method.
[0264] Fig.17 FIG. 1 is a flow chart of a clustering method according to another embodiment of the present application. Fig.17 As shown, the method is applicable to participating nodes, including:
[0265] S1701, receiving the public key sent by the business node.
[0266] Participating nodes need to receive the public key in the encryption key sent by the business node to encrypt data such as vectors and matrices returned to the business node.
[0267] The clustering algorithm proposed in this application uses a public key to encrypt the data of participating nodes, so that the data of participating nodes can be encrypted, ensuring the security of sample data and strengthening the confidentiality of sample data.
[0268] To better understand the clustering method proposed in the above embodiment, Fig.18 , Fig.18 The process of implementing clustering by data interaction between participating nodes and business nodes is shown, where:
[0269] S181, samples are aligned, feature space is normalized, and samples are randomly numbered in sequence.
[0270] S182, generate secret keys, including public keys and private keys.
[0271] S183, send the public key.
[0272] S184, receiving the public key.
[0273] S185, first iteration, generating an encrypted cluster vector.
[0274] S186, sending the encrypted cluster vector.
[0275] S187, performing security verification on the encrypted cluster vector, generating a second difference matrix based on the cluster vector that passes the security verification, and encrypting the second difference matrix.
[0276] S188, sending the second difference matrix.
[0277] S189, decrypt to obtain the second difference matrix, calculate to obtain the first difference matrix, update the cluster centers and class clusters based on the first difference matrix and the second difference matrix, generate an update vector, and encrypt.
[0278] S1810, send update vector.
[0279] S1811, perform security check on the update vector, calculate and obtain the update difference matrix, and encrypt it.
[0280] S1812, sending the updated difference matrix.
[0281] S1813, decrypt and update the difference matrix, update the cluster centers, and update the class clusters based on the updated cluster centers, and repeat the above steps until the iteration stops.
[0282] The service node performs sample alignment with the participating node to determine the first sample and the second sample, and the first sample and the second sample have unique, non-repeating, sequential numbers. The service node generates an encryption key, including a public key and a private key, and sends the publicly available public key used for encryption to the participating node.
[0283] For the first iteration, based on the number of the first sample, the business node randomly determines the initial cluster center and the initial class cluster from the first sample, and then generates a cluster vector corresponding to the initial class cluster, and sends the encrypted cluster vector to the participating nodes. The participating nodes obtain the encrypted cluster vector, perform a security check on the cluster vector, generate a second difference matrix based on the encrypted cluster vector that has passed the security verification, and send it to the business node after encryption. The business node decrypts the encrypted second difference matrix to obtain the second difference matrix, and updates the cluster center based on the first difference matrix and the second difference matrix to generate a new class cluster, and uses the updated cluster center and class cluster as the initial cluster center and initial class cluster for the next round of iteration, and generates an update vector for the next round of iteration, which is sent to the participating nodes after encryption.
[0284] For non-initial iterations, participating nodes obtain the encrypted update vectors, perform security verification, calculate and generate the update difference matrix based on the update vectors that pass the security verification, and send it to the service node after encryption. The service node calculates the second difference matrix corresponding to the current iteration based on the obtained update difference matrix and the second difference matrix corresponding to the previous iteration, and then obtains the first difference matrix corresponding to the current iteration. Based on the first difference matrix and the second difference matrix corresponding to the current iteration, the cluster center and the cluster class are updated, and the update vector for the next iteration is generated, which is sent to the participating nodes after encryption.
[0285] The updated clusters in each round of iteration are used to determine whether the iteration stopping condition has been reached. If not, the above steps are continued until the iteration stops, and finally the final target cluster is generated.
[0286] The clustering method proposed in this application can effectively keep the sample feature data of the business nodes confidential by encrypting the interactive data between the participating nodes and the business nodes, and can ensure the security of the spatial feature data of the participating nodes through security verification. Under the premise of the implementation of the clustering method, the security of the data can be effectively guaranteed and the confidentiality of the data can be enhanced.
[0287] Corresponding to the clustering methods proposed in the above-mentioned embodiments, an embodiment of the present application also proposes a clustering method device. Since the clustering method device proposed in the embodiment of the present application corresponds to the clustering methods proposed in the above-mentioned embodiments, the implementation method of the above-mentioned clustering method is also applicable to the clustering method device proposed in the embodiment of the present application, and will not be described in detail in the following embodiments.
[0288] Fig.19 This is a schematic diagram of the structure of a clustering device proposed in an embodiment of the present application. The device is applicable to a service node. As shown in FIG19 , the clustering device 100 includes a cluster vector generation module 11, a difference matrix acquisition module 12, and an update module 13, wherein:
[0289] A cluster vector generating module 11 is used to generate a cluster vector of each cluster based on the serial number of the target first sample belonging to the cluster, and encrypt the cluster vector and send it to the participating nodes, wherein the cluster vector is used to represent the cluster center of the cluster;
[0290] The difference matrix acquisition module 12 is used to obtain a first difference matrix from a first sample of a service node to a cluster center corresponding to each cluster, and a second difference matrix from a second sample of a corresponding participating node to a cluster center;
[0291] The updating module 13 is used to update the cluster center according to the first difference matrix and the second difference matrix of each cluster, re-cluster the first sample with the updated cluster center, and use each cluster obtained after re-clustering as the cluster corresponding to the next iteration, return to execute the above steps until the iteration ends, and generate the final target cluster.
[0292] The clustering device proposed in the present application generates a cluster vector of a cluster based on the serial number of a target first sample, encrypts the cluster vector and sends it to participating nodes, obtains a second difference matrix generated by the participating nodes and a first difference matrix generated by the business node, updates the cluster vector based on the first difference matrix and the second difference matrix, and re-clusters the first sample with the updated cluster vector, uses the updated cluster as the initial cluster for the next round of iteration, continues to iterate until all rounds of iteration are completed, and generates the final target cluster.
[0293] Fig. 20 This is a schematic diagram of the structure of a clustering device of another embodiment of the present application, which is applicable to a service node. As shown in FIG20 , a clustering device 200 includes a cluster vector generation module 21, a difference matrix acquisition module 22, an update module 23, a cluster center selection module 24, a sample determination module 25, a verification module 26, a numbering module 27, a matrix generation module 28, and a key generation module 29, wherein:
[0294] It should be noted that the cluster vector generation module 11 , the difference matrix acquisition module 12 , the update module 13 , the cluster vector generation module 21 , the difference matrix acquisition module 22 , the update module 23 , have the same structure and function.
[0295] In the embodiment of the present application, the difference matrix acquisition module 22 is used to:
[0296] Repeat the cluster vector of the current iteration in the column direction according to the number of samples to construct the cluster matrix of the current iteration;
[0297] The cluster matrix is obtained and multiplied by the feature space matrix of the service node to obtain a multiplication matrix, and the feature space matrix is subtracted from the multiplication matrix to generate a first difference matrix corresponding to the current iteration.
[0298] In the embodiment of the present application, the difference matrix acquisition module 22 is further used for the first iteration:
[0299] The encrypted second difference matrix corresponding to the first iteration is received from the participating node, and the encrypted second difference matrix is decrypted to obtain the second difference matrix, wherein the encrypted second difference matrix is determined by the participating node based on its own encrypted feature space matrix and the encrypted initial cluster vector.
[0300] In the embodiment of the present application, the difference matrix acquisition module 22 is further used for non-initial iteration:
[0301] Receive the encrypted update difference matrix corresponding to the current iteration sent by the participating node, where the encrypted update difference matrix is used to represent the distance between the cluster center obtained in the previous iteration and the cluster center obtained in the current iteration, and is generated by the participating node based on its own feature space matrix, the encrypted cluster vector of the previous iteration, and the encrypted cluster vector of the current iteration;
[0302] Decrypt the encrypted update difference matrix to obtain the update difference matrix;
[0303] The second difference matrix of the current iteration is obtained by adding the second difference matrix corresponding to the previous iteration to the updated difference matrix of the current iteration.
[0304] In the embodiment of the present application, the clustering device 200 further includes a cluster center selection module 24 and a sample determination module 25, wherein:
[0305] A cluster center selection module 24 is used to randomly set a number of first samples in the first iteration, and use each first sample in the set number of first samples as an initial cluster center, wherein one initial cluster center corresponds to one initial class cluster;
[0306] A sample determination module 25, configured to determine the first sample as the initial cluster center as the target first sample of the initial cluster;
[0307] The cluster vector generating module 21 is further used to generate a cluster vector of the initial cluster according to the serial number of the target first sample of the initial cluster.
[0308] In the embodiment of the present application, the cluster vector generation module 21 further includes:
[0309] The encoding unit 211 is used to determine the position of the target first sample in the cluster vector according to the serial number, encode the vector element at the position as a first encoding value, and encode the vector elements at the remaining positions as second encoding values, wherein the vector elements at the remaining positions correspond to the first sample that does not belong to the class cluster.
[0310] In the embodiment of the present application, the encoding unit 211 is further used to: for any cluster, obtain the number of target first samples belonging to any cluster, and determine the first encoding value according to the number of target first samples.
[0311] In the embodiment of the present application, the clustering device 200 further includes a verification module 26, wherein:
[0312] The verification module 26 is used to receive the encrypted verification vector sent by the participating node, decrypt the encrypted verification vector based on the private key to obtain a decrypted verification vector, and send the decrypted verification vector to the participating node for security verification, wherein the encrypted verification vector is generated according to the encrypted cluster vector.
[0313] In the embodiment of the present application, the clustering device 200 further includes a numbering module 27 and a matrix generating module 28, wherein:
[0314] A numbering module 27, used to perform sample alignment with participating nodes based on the identification information of the sample, and to sequentially number the first sample after alignment;
[0315] The matrix generating module 28 is used to generate a feature space matrix of the service node based on the aligned first samples.
[0316] In the embodiment of the present application, the clustering device 200 further includes a key generation module 29, wherein:
[0317] The key generation module 29 is used to generate an encryption key, which includes a public key and a private key, and send the public key to the participating nodes.
[0318] The clustering device proposed in the present application generates a cluster vector of a cluster based on the number of the target first sample, encrypts the cluster vector and sends it to the participating nodes, obtains the second difference matrix generated by the participating nodes and the first difference matrix generated by the business node, updates the cluster vector based on the first difference matrix and the second difference matrix, and re-clusters the first sample with the updated cluster vector, uses the updated cluster as the initial cluster for the next round of iteration, and continues to iterate until all rounds of iteration are completed to generate the final target cluster. In the present application, the sample data exchanged between the participating nodes and the business nodes is marked with a number and encrypted at the same time, so that the participating nodes cannot obtain the feature data of the actual sample of the business node through data interaction, which effectively ensures the data security of the sample and strengthens the confidentiality of the sample data while ensuring the effect of the clustering method.
[0319] In order to implement the clustering method proposed in the above embodiment, the present application also proposes a clustering device, Fig.21 , Fig.21 This is a schematic diagram of the structure of a clustering device according to another embodiment of the present application. Fig.21 As shown, the clustering device 300 includes a cluster vector receiving module 31 and a target matrix generating module 32, wherein:
[0320] A cluster vector receiving module 31 is used to receive the encrypted cluster vector of each class cluster sent by the service node in each iteration, wherein the cluster vector is determined by the service node based on the number of the target first sample belonging to the class cluster, and the target first sample belongs to the sample in the first sample of the service node;
[0321] The target matrix generation module 32 is used to obtain the encrypted target matrix corresponding to each cluster based on the encrypted cluster vector of the cluster, and send it to the service node until the iteration ends.
[0322] The clustering device proposed in the present application generates a corresponding encrypted target matrix based on the encrypted data sent by the business node, and sends it to the business node. In the present application, the sample data exchanged between the participating nodes and the business node are marked with numbers and encrypted at the same time, so that the participating nodes cannot obtain the characteristic data of the actual samples of the business node through data interaction. While ensuring the effectiveness of the clustering method, the data security of the samples is effectively guaranteed and the confidentiality of the sample data is enhanced.
[0323] Fig. 22 FIG. 1 is a schematic diagram of a clustering device according to another embodiment of the present invention. The clustering device is applicable to participating nodes, such as Fig. 22 As shown, the clustering device 400 includes a cluster vector receiving module 41, a target matrix generating module 42, a security verification module 43, a numbering module 44, a matrix generating module 45, and a receiving module 46, wherein:
[0324] It should be noted that the cluster vector receiving module 31 and the target matrix generating module 32 have the same structure and function as the cluster vector receiving module 41 and the target matrix generating module 42 .
[0325] In the embodiment of the present application, the target matrix generation module 42 is used in the first iteration to:
[0326] Repeat the encrypted cluster vector of the initial cluster in the column direction according to the number of samples to construct the cluster matrix of the initial cluster;
[0327] The cluster matrix of the initial cluster is obtained and multiplied by the feature space matrix of the participating nodes to obtain the multiplication matrix, and the encrypted feature space matrix is subtracted from the multiplication matrix to generate the encrypted difference matrix corresponding to the first iteration.
[0328] In the embodiment of the present application, the target matrix generation module 42, when not in the initial iteration, is further used to:
[0329] According to the number of samples, the encrypted cluster vector corresponding to the previous iteration and the encrypted cluster vector corresponding to the current iteration are repeated in the column direction to construct two encrypted cluster matrices;
[0330] Obtain two encrypted cluster matrices and multiply them with the feature space matrices of the participating nodes to obtain a multiplication matrix;
[0331] Subtract the multiplication matrix corresponding to the previous iteration from the multiplication matrix corresponding to the current iteration to obtain the encrypted update difference matrix corresponding to the current iteration.
[0332] In the embodiment of the present application, in the clustering device 400 , in the first iteration, the corresponding encrypted cluster vector is determined based on the serial number of the target first sample belonging to the initial cluster.
[0333] In the embodiment of the present application, the clustering device 400 further includes a security verification module 43, wherein:
[0334] The security verification module 43 is used to add each dimension of the encrypted cluster vector to obtain verification data, and verify the security verification of the service node based on the verification data.
[0335] In the embodiment of the present application, the security verification module 43 includes:
[0336] A column vector generating unit 431, configured to randomly generate a first column vector and a second column vector, and encrypt the second column vector using a public key;
[0337] A verification vector generating unit 432, configured to perform an affine transformation on the first column vector and the encrypted second column vector based on the verification data to generate an encrypted verification vector;
[0338] The decryption unit 433 is used to send the encrypted verification vector to the service node and receive the decrypted verification vector returned by the service node;
[0339] The verification unit 434 is configured to determine that the service node passes the security verification in response to the encryption verification vector and the decryption verification vector being consistent.
[0340] In the embodiment of the present application, the clustering device 400 further includes a numbering module 44 and a matrix generating module 45, wherein:
[0341] A numbering module 44, configured to perform sample alignment with the service node based on the identification information of the sample, and to sequentially number the second samples of the aligned participating nodes;
[0342] The feature space matrix generating module 45 is used to generate the feature space matrix of the participating nodes based on the aligned second samples.
[0343] In the embodiment of the present application, the clustering device 400 further includes a receiving module 46, wherein:
[0344] The receiving module 46 is used to receive the public key sent by the service node.
[0345] The clustering device proposed in the present application generates a corresponding encrypted target matrix based on the encrypted data sent by the business node, and sends it to the business node. In the present application, the sample data exchanged between the participating nodes and the business node are marked with numbers and encrypted at the same time, so that the participating nodes cannot obtain the characteristic data of the actual samples of the business node through data interaction. While ensuring the effectiveness of the clustering method, the data security of the samples is effectively guaranteed and the confidentiality of the sample data is enhanced.
[0346] To achieve the above embodiments, the present application also proposes an electronic device, a computer-readable storage medium and a computer program product.
[0347] Fig.23 A schematic block diagram of an example electronic device 2300 that can be used to implement an embodiment of the present application is shown. The electronic device is intended to represent various forms of digital computers, such as laptop computers, desktop computers, workbenches, personal digital assistants, servers, blade servers, mainframe computers, and other suitable computers. The electronic device can also represent various forms of mobile devices, such as personal digital processing, cellular phones, smart phones, wearable devices, and other similar computing devices. The components shown herein, their connections and relationships, and their functions are merely examples and are not intended to limit the implementation of the present application described and / or required herein.
[0348] like Fig.23 As shown, the device 2300 includes a memory 231, a processor 232, and a computer program stored in the memory 231 and executable on the processor 232. When the processor 232 executes the program instructions, the clustering method proposed in the above embodiment is implemented.
[0349] The electronic device proposed in the embodiment of the present application executes a computer program stored in the memory 231 through the processor 232, and encrypts the interactive data between the participating nodes and the business nodes, so that the sample feature data of the business nodes can be effectively kept confidential. Through security verification, the spatial feature data of the participating nodes can be secured. Under the premise of the implementation of the clustering method, the security of the data can be effectively guaranteed and the confidentiality of the data can be enhanced.
[0350] An embodiment of the present application proposes a computer-readable storage medium, on which a computer program is stored. When the program is executed by the processor 232, the clustering method proposed in the above embodiment is implemented.
[0351] The computer-readable storage medium of the embodiment of the present application stores a computer program and is executed by a processor. The processor 232 executes the computer program stored in the memory 231. By encrypting the interactive data between the participating nodes and the business nodes, the sample feature data of the business nodes can be effectively kept confidential. Through security verification, the spatial feature data of the participating nodes can be secured. Under the premise of the implementation of the clustering method, the security of the data can be effectively guaranteed and the confidentiality of the data can be enhanced.
[0352] Various implementations of the systems and techniques described above herein can be implemented in digital electronic circuit systems, integrated circuit systems, field programmable gate arrays (FPGAs), application specific integrated circuits (ASICs), application specific standard products (ASSPs), systems on chips (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and / or combinations thereof. These various implementations may include: being implemented in one or more computer programs that can be executed and / or interpreted on a programmable system including at least one programmable processor, which can be a special purpose or general purpose programmable processor that can receive data and instructions from a storage system, at least one input device, and at least one output device, and transmit data and instructions to the storage system, the at least one input device, and the at least one output device.
[0353] The program code for implementing the method itself can be written in any combination of one or more programming languages. These program codes can be provided to a processor or controller of a general-purpose computer, a special-purpose computer or other programmable data processing device, so that the program code, when executed by the processor or controller, enables the functions / operations specified in the flow chart and / or block diagram to be implemented. The program code can be executed entirely on the machine, partially on the machine, partially on the machine as a stand-alone software package and partially on a remote machine, or entirely on a remote machine or server.
[0354] In the context of the present application, a machine-readable medium may be a tangible medium that may contain or store a program for use by or in conjunction with an instruction execution system, device, or equipment. A machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, device, or equipment, or any suitable combination of the foregoing. A more specific example of a machine-readable storage medium may include an electrical connection based on one or more lines, a portable computer disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
[0355] To provide interaction with a user, the systems and techniques described herein can be implemented on a computer having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to the user; and a keyboard and pointing device (e.g., a mouse or trackball) through which the user can provide input to the computer. Other types of devices can also be used to provide interaction with the user; for example, the feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user can be received in any form (including acoustic input, voice input, or tactile input).
[0356] The systems and techniques described herein may be implemented in a computing system that includes backend components (e.g., as a data server), or a computing system that includes middleware components (e.g., an application server), or a computing system that includes frontend components (e.g., a user computer with a graphical user interface or a web browser through which a user can interact with implementations of the systems and techniques described herein), or a computing system that includes any combination of such backend components, middleware components, or frontend components. The components of the system may be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: a local area network (LAN), a wide area network (WAN), the Internet, and a blockchain network.
[0357] A computer system may include a client and a server. The client and the server are generally remote from each other and usually interact through a communication network. The relationship between the client and the server is generated by computer programs running on the corresponding computers and having a client-server relationship with each other. The server may be a cloud server, also known as a cloud computing server or cloud host, which is a host product in the cloud computing service system to solve the defects of difficult management and weak business scalability in traditional physical hosts and VPS services ("Virtual Private Server", or "VPS" for short). The server may also be a server for a distributed system, or a server combined with a blockchain.
[0358] In the description of this specification, the description with reference to the terms "one embodiment", "some embodiments", "example", "specific example", or "some examples" etc. means that the specific features, structures, materials or characteristics described in conjunction with the embodiment or example are included in at least one embodiment or example of the present application. In this specification, the schematic representations of the above terms do not necessarily refer to the same embodiment or example. Moreover, the specific features, structures, materials or characteristics described may be combined in any one or more embodiments or examples in a suitable manner. In addition, those skilled in the art may combine and combine the different embodiments or examples described in this specification and the features of the different embodiments or examples, without contradiction.
[0359] In addition, the terms "first" and "second" are used for descriptive purposes only and should not be understood as indicating or implying relative importance or implicitly indicating the number of the indicated technical features. Therefore, a feature defined as "first" or "second" may explicitly or implicitly include at least one of the features. In the description of this application, "plurality" means at least two, such as two, three, etc., unless otherwise clearly and specifically defined.
[0360] Any process or method description in a flowchart or otherwise described herein may be understood to represent a module, fragment or portion of code comprising one or more executable instructions for implementing the steps of a custom logical function or process, and the scope of the preferred embodiments of the present application includes alternative implementations in which functions may not be performed in the order shown or discussed, including performing functions in a substantially simultaneous manner or in reverse order depending on the functions involved, which should be understood by technicians in the technical field to which the embodiments of the present application belong.
[0361] The logic and / or steps represented in the flowchart or otherwise described herein, for example, can be considered as an ordered list of executable instructions for implementing logical functions, and can be embodied in any computer-readable medium for use by an instruction execution system, device or apparatus (such as a computer-based system, a system including a processor, or other system that can fetch instructions from an instruction execution system, device or apparatus and execute instructions), or in combination with these instruction execution systems, devices or apparatuses. For the purposes of this specification, "computer-readable medium" can be any device that can contain, store, communicate, propagate or transmit a program for use by an instruction execution system, device or apparatus, or in combination with these instruction execution systems, devices or apparatuses. More specific examples of computer-readable media (a non-exhaustive list) include the following: an electrical connection with one or more wires (electronic devices), a portable computer disk box (magnetic device), a random access memory (RAM), a read-only memory (ROM), an erasable and programmable read-only memory (EPROM or flash memory), a fiber optic device, and a portable compact disk read-only memory (CDROM). In addition, the computer-readable medium may even be paper or other suitable medium on which the program is printed, since the program may be obtained electronically, for example, by optically scanning the paper or other medium and then editing, interpreting or processing in other suitable ways if necessary, and then stored in a computer memory.
[0362] It should be understood that the various parts of the present application can be implemented by hardware, software, firmware or a combination thereof. In the above-mentioned embodiments, multiple steps or methods can be implemented by software or firmware stored in a memory and executed by a suitable instruction execution system. For example, if implemented by hardware, as in another embodiment, it can be implemented by any one of the following technologies known in the art or their combination: a discrete logic circuit having a logic gate circuit for implementing a logic function for a data signal, a dedicated integrated circuit having a suitable combination of logic gate circuits, a programmable gate array (PGA), a field programmable gate array (FPGA), etc.
[0363] A person skilled in the art may understand that all or part of the steps in the above-mentioned embodiment method may be completed by instructing related hardware through a program, and the program may be stored in a computer-readable storage medium, which, when executed, includes one or a combination of the steps in the method embodiment.
[0364] In addition, each functional unit in each embodiment of the present application may be integrated into a processing module, or each unit may exist physically separately, or two or more units may be integrated into one module. The above-mentioned integrated module may be implemented in the form of hardware or in the form of a software functional module. If the integrated module is implemented in the form of a software functional module and sold or used as an independent product, it may also be stored in a computer-readable storage medium.
[0365] The storage medium mentioned above may be a read-only memory, a disk or an optical disk, etc. Although the embodiments of the present application have been shown and described above, it can be understood that the above embodiments are exemplary and cannot be understood as limiting the present application. A person of ordinary skill in the art may change, modify, replace and modify the above embodiments within the scope of the present application.
[0366] It should be understood that the various forms of processes shown above can be used to reorder, add or delete steps. For example, the steps recorded in this application can be executed in parallel, sequentially or in different orders, as long as the expected results of the technical solution disclosed in this application can be achieved, and this document does not limit this.
[0367] The above specific implementations do not constitute a limitation on the protection scope of this application. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions can be made according to design requirements and other factors. Any modifications, equivalent substitutions and improvements made within the spirit and principles of this application should be included in the protection scope of this application.< / t> < / r> < / t> < / t> < / t> < / h> < / t> < / t> < / a2> < / a1> < / a2>
Claims
1. A clustering method, characterized in that: Applicable to a service node, the method comprises: For each cluster, based on the serial number of the target first sample belonging to the cluster, a cluster vector of the cluster is generated, and the cluster vector is encrypted and sent to the participating nodes, wherein the cluster vector is used to represent the cluster center of the cluster, and the cluster vector is a vector reflecting the cluster center point of the cluster; Obtain a first difference matrix from the first sample of the service node to the cluster center corresponding to each class cluster, and a second difference matrix from the second sample of the corresponding participating node to the cluster center, wherein the first difference matrix is obtained by constructing a difference matrix based on the difference from each first sample to the cluster center by the service node, and the second difference matrix is obtained by constructing a difference matrix based on the difference from the second sample to the corresponding cluster center by the participating node; The cluster center is updated according to the first difference matrix and the second difference matrix of each cluster, the first sample is re-clustered with the updated cluster center, and each cluster obtained after the re-clustering is used as the cluster corresponding to the next iteration, and the above steps are returned to execute until the iteration ends to generate the final target cluster.
2. The method according to claim 1, characterized in that The process of obtaining the first difference matrix includes: Repeat the cluster vector of the current iteration in the column direction according to the number of samples to construct the cluster matrix of the current iteration; The cluster matrix is obtained by multiplying the characteristic space matrix of the service node to obtain a multiplication matrix, and the characteristic space matrix is subtracted from the multiplication matrix to generate the first difference matrix corresponding to the current iteration.
3. The method according to claim 1 or 2, characterized in that: For the first iteration, the process of obtaining the second difference matrix includes: Receive the encrypted second difference matrix corresponding to the first iteration sent by the participating node, decrypt the encrypted second difference matrix, and obtain the second difference matrix, wherein the encrypted second difference matrix is determined by the participating node based on its own encrypted feature space matrix and the encrypted initial cluster vector.
4. The method according to claim 1 or 2, characterized in that: For non-initial iteration, the process of obtaining the second difference matrix includes: Receiving the encrypted update difference matrix corresponding to the current iteration sent by the participating node, wherein the encrypted update difference matrix is used to represent the distance between the cluster center obtained in the previous iteration and the cluster center obtained in the current iteration, and is generated by the participating node based on its own feature space matrix, the encrypted cluster vector of the previous iteration, and the encrypted cluster vector of the current iteration; Decrypting the encrypted update difference matrix to obtain an update difference matrix; The second difference matrix of the current iteration is obtained by adding the second difference matrix corresponding to the previous iteration to the updated difference matrix of the current iteration.
5. The method according to claim 1, characterized in that Also includes: In the first iteration, a number of first samples is randomly set, and each first sample in the set number of first samples is used as an initial cluster center, wherein one initial cluster center corresponds to one initial cluster; Determine the first sample serving as the initial cluster center as the target first sample of the initial cluster; A cluster vector of the initial cluster is generated according to the serial number of the target first sample of the initial cluster.
6. The method according to claim 1 or 5, characterized in that: The generation process of the cluster vector includes: Determine the position of the target first sample in the cluster vector according to the serial number, and encode the vector element at the position into a first encoding value; The vector elements at the remaining positions are encoded as second encoded values, wherein the vector elements at the remaining positions correspond to the first samples that do not belong to the cluster.
7. The method according to claim 6, characterized in that The step of encoding the vector element at the position into a first encoded value comprises: For any cluster, the number of the target first samples belonging to the any cluster is obtained, and the first encoding value is determined according to the number of the target first samples.
8. The method according to claim 1, characterized in that Also includes: receiving an encrypted verification vector sent by the participating node, and decrypting the encrypted verification vector based on a private key to obtain a decrypted verification vector, wherein the encrypted verification vector is generated according to the encrypted cluster vector; The decryption verification vector is sent to the participating node to perform security verification on the service node.
9. The method according to claim 1, characterized in that: Also includes: Based on the identification information of the sample, align the sample with the participating nodes, and sequentially number the aligned first samples; A feature space matrix of the service node is generated based on the aligned first sample.
10. The method according to claim 1, characterized in that Also includes: Generate an encryption key, the encryption key including a public key and a private key, and send the public key to the participating nodes.
11. A clustering method, characterized in that: Applicable to a participating node, the method comprises: Receiving an encrypted cluster vector of each class cluster sent by a service node in each iteration, wherein the cluster vector is determined by the service node based on the number of a target first sample belonging to the class cluster, the target first sample being a sample among the first samples of the service node, wherein the number of the target first sample is used to determine the position of the target first sample in the cluster vector, and the cluster vector is obtained by the encoding value of the target first sample; For each cluster, based on the encrypted cluster vector of the cluster, an encrypted target matrix corresponding to the cluster is obtained, and sent to the service node until the iteration ends; Among them, for the first iteration, the encrypted target matrix generated by the participating nodes is the second difference matrix; For non-initial iterations, the encrypted target matrix generated by the participating nodes is the updated difference matrix between the cluster centers of the current iteration and the cluster centers of the previous iteration.
12. The method according to claim 11, characterized in that In the first iteration, the encrypted target matrix is the encrypted difference matrix of the second sample on the participating node corresponding to the cluster to the cluster center, and the encrypted cluster vector based on the cluster is used to obtain the encrypted target matrix corresponding to the cluster, including: Repeating the encrypted cluster vector of the initial cluster in the column direction according to the number of samples to construct a cluster matrix of the initial cluster; The cluster matrix of the initial cluster is obtained and multiplied by the feature space matrix of the participating nodes to obtain a multiplication matrix, and the encrypted feature space matrix is subtracted from the multiplication matrix to generate the encrypted difference matrix corresponding to the first iteration.
13. The method according to claim 11, characterized in that In a non-initial iteration, the encrypted target matrix is an encrypted updated difference matrix between the cluster centers obtained in the previous iteration and the cluster centers obtained in the current iteration. The encrypted cluster vector based on the cluster is used to obtain the encrypted target matrix corresponding to the cluster, including: According to the number of samples, the encrypted cluster vector corresponding to the previous iteration and the encrypted cluster vector corresponding to the current iteration are repeated in the column direction to construct two encrypted cluster matrices; Obtain the two encrypted cluster matrices and multiply them with the feature space matrices of the participating nodes respectively to obtain a multiplication matrix; The multiplication matrix corresponding to the previous iteration is subtracted from the multiplication matrix corresponding to the current iteration to obtain the encrypted update difference matrix corresponding to the current iteration.
14. The method according to claim 11, characterized in that In the first iteration, the corresponding encrypted cluster vector is determined based on the serial number of the target first sample belonging to the initial cluster.
15. The method according to any one of claims 11 to 14, characterized in that: After receiving the encrypted cluster vector of each class cluster sent by each iterative service node, the method further includes: Adding each dimension of the encrypted cluster vector to obtain verification data; Based on the verification data, the security verification of the service node is verified.
16. The method according to claim 15, characterized in that The verifying the security verification of the service node based on the verification data includes: Randomly generate a first column vector and a second column vector, and encrypt the second column vector using a public key; Based on the verification data, performing an affine transformation on the first column vector and the encrypted second column vector to generate an encrypted verification vector; Sending the encrypted verification vector to the service node, and receiving the decrypted verification vector returned by the service node; In response to the encryption verification vector and the decryption verification vector being consistent, it is determined that the service node passes security verification.
17. The method according to any one of claims 11 to 14, characterized in that: Before receiving the encrypted cluster vector of each class cluster sent by each iteration participating node, the method further includes: Based on the identification information of the sample, align the sample with the service node, and sequentially number the second samples of the participating nodes after the alignment; A feature space matrix of the participating nodes is generated based on the aligned second samples.
18. The method according to claim 11, characterized in that Also includes: Receive the public key sent by the business node.
19. A clustering device, characterized in that: Applicable to business nodes, including: A cluster vector generation module is used to generate a cluster vector of each cluster based on the serial number of the target first sample belonging to the cluster, and encrypt the cluster vector and send it to the participating nodes, wherein the cluster vector is used to represent the cluster center of the cluster, and the cluster vector is a vector reflecting the cluster center point of the cluster; A difference matrix acquisition module is used to acquire a first difference matrix from the first sample of the service node to the cluster center corresponding to each class cluster, and a second difference matrix from the second sample of the corresponding participating node to the cluster center, wherein the first difference matrix is obtained by constructing a difference matrix based on the difference from each first sample to the cluster center by the service node, and the second difference matrix is obtained by constructing a difference matrix based on the difference from the second sample to the corresponding cluster center by the participating node; An updating module is used to update the cluster center according to the first difference matrix and the second difference matrix of each cluster, re-cluster the first samples with the updated cluster center, and use each cluster obtained after re-clustering as the cluster corresponding to the next iteration, return to execute the above steps until the iteration ends, and generate the final target cluster.
20. The device according to claim 19, characterized in that The difference matrix acquisition module is further used for: Repeat the cluster vector of the current iteration in the column direction according to the number of samples to construct the cluster matrix of the current iteration; The cluster matrix is obtained by multiplying the characteristic space matrix of the service node to obtain a multiplication matrix, and the characteristic space matrix is subtracted from the multiplication matrix to generate the first difference matrix corresponding to the current iteration.
21. The device according to claim 19 or 20, characterized in that The difference matrix acquisition module is further used for: For the first iteration, the encrypted second difference matrix corresponding to the first iteration is received from the participating node, and the encrypted second difference matrix is decrypted to obtain the second difference matrix, wherein the encrypted second difference matrix is determined by the participating node based on its own encrypted feature space matrix and the encrypted initial cluster vector.
22. The device according to claim 19 or 20, characterized in that The difference matrix acquisition module is further used for: For a non-initial iteration, receiving an encrypted update difference matrix corresponding to the current iteration sent by the participating node, wherein the encrypted update difference matrix is used to represent the distance between the cluster center obtained in the previous iteration and the cluster center obtained in the current iteration, and is generated by the participating node based on its own feature space matrix, the encrypted cluster vector of the previous iteration, and the encrypted cluster vector of the current iteration; Decrypting the encrypted update difference matrix to obtain an update difference matrix; The second difference matrix of the current iteration is obtained by adding the second difference matrix corresponding to the previous iteration to the updated difference matrix of the current iteration.
23. The device according to claim 19, characterized in that Also includes: A cluster center selection module is used to randomly set a number of first samples in the first iteration, and use each first sample in the set number of first samples as an initial cluster center, wherein one initial cluster center corresponds to one initial class cluster; A sample determination module, used to determine the first sample as the initial cluster center as the target first sample of the initial cluster; The cluster vector generating module is further used to generate the cluster vector of the initial cluster according to the serial number of the target first sample of the initial cluster.
24. The device according to claim 19 or 23, characterized in that The cluster vector generation module further includes: An encoding unit is used to determine the position of the target first sample in the cluster vector according to the number, encode the vector element at the position as a first encoding value, and encode the vector elements at the remaining positions as second encoding values, wherein the vector elements at the remaining positions correspond to the first sample that does not belong to the class cluster.
25. The device according to claim 24, characterized in that The encoding unit is further used for: For any cluster, the number of the target first samples belonging to the any cluster is obtained, and the first encoding value is determined according to the number of the target first samples.
26. The device according to claim 19, characterized in that Also includes: A verification module is used to receive the encrypted verification vector sent by the participating node, decrypt the encrypted verification vector based on a private key to obtain a decrypted verification vector, and send the decrypted verification vector to the participating node to perform security verification on the service node, wherein the encrypted verification vector is generated according to the encrypted cluster vector.
27. The device according to claim 19, characterized in that Also includes: A numbering module, used to perform sample alignment with the participating nodes based on the identification information of the samples, and to sequentially number the first samples after alignment; A matrix generation module is used to generate a feature space matrix of the service node based on the aligned first sample.
28. The device according to claim 19, characterized in that Also includes: The key generation module is used to generate an encryption key, the encryption key includes a public key and a private key, and send the public key to the participating nodes.
29. A clustering device, characterized in that: Applicable to participating nodes, including: A cluster vector receiving module, used for receiving the encrypted cluster vector of each class cluster sent by the service node in each iteration, wherein the cluster vector is determined by the service node based on the number of the target first sample belonging to the class cluster, the target first sample is a sample among the first samples of the service node, wherein the number of the target first sample is used to determine the position of the target first sample in the cluster vector, and the cluster vector is obtained by the encoding value of the target first sample; A target matrix generation module, used for obtaining, for each cluster, an encrypted target matrix corresponding to the cluster based on the encrypted cluster vector of the cluster, and sending the encrypted target matrix to the service node until the iteration ends; Wherein, for the first iteration, the encrypted target matrix generated by the participating nodes is the second difference matrix; For non-initial iterations, the encrypted target matrix generated by the participating nodes is an updated difference matrix between the cluster centers of the current iteration and the cluster centers of the previous iteration.
30. The device according to claim 29, characterized in that In the first iteration, the encrypted target matrix is the encrypted difference matrix of the second sample on the participating node corresponding to the cluster to the cluster center, and the target matrix generation module is further used for: In the first iteration, the encrypted cluster vector of the initial cluster is repeated in the column direction according to the number of samples to construct a cluster matrix of the initial cluster; The cluster matrix of the initial cluster is obtained and multiplied by the feature space matrix of the participating nodes to obtain a multiplication matrix, and the encrypted feature space matrix is subtracted from the multiplication matrix to generate the encrypted difference matrix corresponding to the first iteration.
31. The device according to claim 29, characterized in that In non-initial iteration, the encrypted target matrix is an encrypted updated difference matrix between the cluster centers obtained in the previous iteration and the cluster centers obtained in the current iteration. The target matrix generation module is further used to: In non-initial iterations, the encrypted cluster vector corresponding to the previous iteration and the encrypted cluster vector corresponding to the current iteration are repeated in the column direction according to the number of samples to construct two encrypted cluster matrices; Obtain the two encrypted cluster matrices and multiply them with the feature space matrices of the participating nodes respectively to obtain a multiplication matrix; The multiplication matrix corresponding to the previous iteration is subtracted from the multiplication matrix corresponding to the current iteration to obtain the encrypted update difference matrix corresponding to the current iteration.
32. The device according to claim 29, characterized in that In the first iteration, the corresponding encrypted cluster vector is determined based on the serial number of the target first sample belonging to the initial cluster.
33. The device according to any one of claims 29 to 32, characterized in that Also includes: The security verification module is used to add each dimension of the encrypted cluster vector to obtain verification data, and verify the security verification of the service node based on the verification data.
34. The device according to claim 33, characterized in that The security verification module comprises: A column vector generating unit, used for randomly generating a first column vector and a second column vector, and encrypting the second column vector using a public key; A verification vector generating unit, configured to perform an affine transformation on the first column vector and the encrypted second column vector based on verification data to generate an encrypted verification vector; a decryption unit, configured to send the encrypted verification vector to the service node, and receive the decrypted verification vector returned by the service node; The verification unit is configured to determine that the service node passes the security verification in response to the encryption verification vector and the decryption verification vector being consistent.
35. The device according to any one of claims 29 to 32, characterized in that Also includes: A numbering module, used to align samples with the service nodes based on the identification information of the samples, and to sequentially number the second samples of the participating nodes after the alignment; A matrix generation module is used to generate a feature space matrix of the participating nodes based on the aligned second samples.
36. The device according to claim 29, characterized in that Also includes: The receiving module is used to receive the public key sent by the service node.
37. An electronic device comprising: at least one processor; as well as a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor to enable the at least one processor to perform the method according to any one of claims 1 to 18.
38. A non-transitory computer-readable storage medium storing computer instructions, wherein: The computer instructions are used to cause the computer to execute the method according to any one of claims 1-18.
39. A computer program product comprising a computer program, which, when executed by a processor, implements the method according to any one of claims 1 to 18.
Citation Information
Patent Citations
Verifiable multi-party k-means federated learning method with privacy protection function
CN112487481A
Large-scale data clustering method and apparatus, computer device and computer-readable storage medium
WO2021042844A1