A federated clustering method, system and computer storage medium

By splitting and updating fragments of the data matrix and cluster center matrix, and utilizing multi-party secure computation, the privacy deficiency problem in federated clustering methods is solved, thus achieving data privacy protection.

CN116244735BActive Publication Date: 2026-01-02LINGSHU TECH CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202211664461.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-12-23
Publication Date
2026-01-02
Estimated Expiration
2042-12-23

AI Technical Summary

Technical Problem

Existing federated clustering methods lack privacy, as computing power providers can know the cluster center values ​​of data providers.

Method used

By splitting the data matrix and cluster center matrix into multiple fragments, splicing and updating these fragments, and using multi-party secure computation technology, it is ensured that each computing power provider can only know the fragment information of the cluster centers and not the specific values.

Benefits of technology

This approach protects data privacy during the federated clustering process, ensuring that each computing power provider can only know a portion of the cluster center information, thus preventing the leakage of specific values.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116244735B_ABST
    Figure CN116244735B_ABST
Patent Text Reader

Abstract

The application discloses a federal clustering method, system and computer storage medium. The method comprises the following steps: S101, acquiring a first data matrix and a first clustering center matrix of an initiator, and acquiring a plurality of second data matrices and a plurality of second clustering center matrices corresponding to a plurality of participants; S102, splitting and splicing the first data matrix, the first clustering center matrix, each second data matrix and each second clustering center matrix to obtain a plurality of data fragment pairs and a plurality of clustering center fragment pairs; S103, updating the plurality of clustering center fragment pairs according to the plurality of data fragment pairs and the plurality of clustering center fragment pairs to obtain a plurality of current updated clustering center fragment pairs; and S104, repeating S103 until the difference between the sum of all current updated clustering center fragments and the sum of all last updated clustering center fragments is less than a preset threshold value, and obtaining a target clustering center fragment. In the method, each computing power provider can only know the fragment information of the clustering center, and the privacy of the data is ensured.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the technical field of machine learning, in particular to a federated clustering method, system and computer storage medium. BACKGROUND

[0002] In the prior art, each computing power provider can know the numerical value of the clustering center of the data provider, and the prior art federated clustering method does not have privacy.

[0003] In view of the problem that the prior art federated clustering method does not have privacy, no effective solution has been proposed so far. SUMMARY

[0004] The present application provides a federated clustering method, system and computer storage medium to solve the problem that the prior art federated clustering method does not have privacy.

[0005] To achieve the above-mentioned purpose, on the one hand, the present application provides a federated clustering method, wherein the method comprises: S101, obtaining a first data matrix of an initiator, a first clustering center matrix, and obtaining a plurality of second data matrices corresponding to a plurality of participants, a plurality of second clustering center matrices; S102, splitting and splicing the first data matrix, the first clustering center matrix, each second data matrix, and each second clustering center matrix to obtain a plurality of data fragment pairs and a plurality of clustering center fragment pairs; S103, updating the plurality of clustering center fragment pairs according to the plurality of data fragment pairs and the plurality of clustering center fragment pairs to obtain a plurality of current updated clustering center fragment pairs; S104, repeating the S103 until the sum of all current updated clustering center fragments in the plurality of current updated clustering center fragment pairs and the sum of all last updated clustering center fragments in the plurality of last updated clustering center fragment pairs are less than a preset threshold, and obtaining a target clustering center fragment.

[0006] Optionally, the S102 comprises: splitting the first data matrix and each second data matrix into three parts and splicing according to the characteristics to obtain three data fragments; and splitting the first clustering center matrix and each second clustering center matrix into three parts and splicing according to the characteristics to obtain three clustering center fragments; pairing the three data fragments two by two to obtain three data fragment pairs; and pairing the three clustering center fragments two by two to obtain three clustering center fragment pairs.

[0007] Optionally, the S103 comprises: calculating the sum of squares of Euclidean distances from any sample to any cluster center according to the three data fragment pairs and the three cluster center fragment pairs, to obtain three distance pairs; calculating a corresponding distance matrix according to the three distance pairs, and changing the minimum value of each row in the distance matrix to 1 and the remaining values to 0 to obtain three 0-1 matrix fragment pairs; and calculating the three current update cluster center fragment pairs according to the three data fragment pairs and the three 0-1 matrix fragment pairs.

[0008] Optionally, the calculating the three current update cluster center fragment pairs according to the three data fragment pairs, the transposition of the three 0-1 matrix fragment pairs and the total vector comprises: summing each column in each 0-1 matrix fragment in the three 0-1 matrix fragment pairs to obtain three vector pairs; calculating a total vector according to the three vector pairs; and calculating the three current update cluster center fragment pairs according to the three data fragment pairs, the transposition of the three 0-1 matrix fragment pairs and the total vector.

[0009] Optionally, the calculating the three current update cluster center fragment pairs according to the three data fragment pairs, the transposition of the three 0-1 matrix fragment pairs and the total vector comprises: calculating three current sum cluster center fragment pairs according to the three data fragment pairs and the transposition of the three 0-1 matrix fragment pairs; and calculating the three current update cluster center fragment pairs according to the three current sum cluster center fragment pairs and the total vector.

[0010] Optionally, the calculating the sum of squares of Euclidean distances from any sample to any cluster center according to the three data fragment pairs and the three cluster center fragment pairs, to obtain three distance pairs simultaneously comprises: constructing three encryption matrices, and the sum of the three encryption matrices is a 0 matrix.

[0011] In another aspect, the present application provides a federated clustering system, comprising: an acquisition module configured to acquire a first data matrix and a first cluster center matrix of an initiator, and to acquire a plurality of second data matrices and a plurality of second cluster center matrices corresponding to a plurality of participants; a splitting and splicing module configured to split and splice the first data matrix, the first cluster center matrix, each second data matrix and each second cluster center matrix to obtain a plurality of data fragment pairs and a plurality of cluster center fragment pairs; an update module configured to update the plurality of cluster center fragment pairs according to the plurality of data fragment pairs and the plurality of cluster center fragment pairs to obtain a plurality of current update cluster center fragment pairs; and a repeating module configured to repeat the update module until the difference between the sum of all current update cluster center fragments in the plurality of current update cluster center fragment pairs and the sum of all previous update cluster center fragments in a plurality of previous update cluster center fragment pairs is less than a preset threshold value, to obtain a target cluster center fragment.

[0012] Optionally, the splitting and splicing module comprises: a splitting and splicing submodule, configured to split the first data matrix and each second data matrix into three parts and splice according to features to obtain three data fragments; and split the first cluster center matrix and each second cluster center matrix into three parts and splice according to features to obtain three cluster center fragments; a pairing submodule, configured to pair the three data fragments two by two to obtain three data fragment pairs; and pair the three cluster center fragments two by two to obtain three cluster center fragment pairs.

[0013] Optionally, the updating module comprises: a first calculation unit, configured to calculate the sum of squares of Euclidean distances from any sample to any cluster center according to the three data fragment pairs and three cluster center fragment pairs to obtain three distance pairs; a changing unit, configured to calculate a corresponding distance matrix according to the three distance pairs, and change the minimum value of each row in the distance matrix to 1 and the remaining values to 0 to obtain three 0-1 matrix fragment pairs; and a second calculation unit, configured to calculate three current updated cluster center fragment pairs according to the three data fragment pairs and the three 0-1 matrix fragment pairs.

[0014] In another aspect, the present application also provides a computer storage medium having a computer program stored thereon, wherein the program is executed by a processor to implement the federated clustering method as described above.

[0015] The present application has the following beneficial effects:

[0016] The present application provides a federated clustering method, system and computer storage medium, wherein each computing power provider in the method of the present application can only know the fragment information of the cluster center and cannot know the specific numerical value of the cluster center, and the method of the present application can ensure the privacy of data. BRIEF DESCRIPTION OF DRAWINGS

[0017] Figure 1 is a flowchart of a federated clustering method provided by an embodiment of the present application;

[0018] Figure 2 is a flowchart of obtaining a plurality of data fragment pairs and a plurality of cluster center fragment pairs provided by an embodiment of the present application;

[0019] Figure 3 is a flowchart of obtaining a plurality of current updated cluster center fragment pairs provided by an embodiment of the present application;

[0020] Figure 4 is a structural schematic diagram of a federated clustering system provided by an embodiment of the present application;

[0021] Figure 5 is a structural schematic diagram of a splitting and splicing module provided by an embodiment of the present application;

[0022] Figure 6 is a structural schematic diagram of an updating module provided by an embodiment of the present application. DETAILED DESCRIPTION

[0023] In order to make the objects, technical solutions and advantages of the present application clearer, the present application will be further described in detail below with reference to the drawings. Obviously, the described embodiments are only a part of the embodiments of the present application, but not all the embodiments. Based on the embodiments in the present application, all other embodiments obtained by those skilled in the art without creative work fall within the scope of protection of the present application.

[0024] In the prior art, each computing power provider can know the numerical value of the cluster center of the data provider, and the federated clustering method in the prior art does not have privacy.

[0025] Therefore, the present application provides a federated clustering method, Figure 1 is a flowchart of a federated clustering method provided by an embodiment of the present application, as shown in the figure, the method comprises: Figure 1

[0026] S101, obtaining a first data matrix of an initiator, a first cluster center matrix, and obtaining a plurality of second data matrices corresponding to a plurality of participants, a plurality of second cluster center matrices;

[0027] Specifically, a first data matrix X0 of the initiator guest is obtained, the dimension of the first data matrix X0 is n*f0, wherein n is the sample quantity (i.e. n different IDs) of the initiator, and f0 is the feature quantity of the initiator; that is, the row of the first data matrix X0 represents a sample, and the column represents a feature. The initiator guest selects k IDs as cluster centers from the n sample quantities, and obtains a first cluster center matrix K0, the dimension of the first cluster center matrix K0 is k*f0;

[0028] The second data matrix X i of the participant host i is obtained, the dimension of the second data matrix X i is n*f i , wherein n is the sample quantity (i.e. n different IDs) of the participant, f i is the feature quantity of the participant, i∈{1, 2, 3…, m}, and m is the number of participants; the initiator sends the k IDs selected at random to the participant host i , and the participant obtains the corresponding second cluster center matrix K i , the dimension of the second cluster center matrix K i is k*f i . ​

[0029] S102, split and splice the first data matrix, the first cluster center matrix, each second data matrix, and each second cluster center matrix to obtain a plurality of data fragment pairs and a plurality of cluster center fragment pairs;

[0030] Figure 2 is a flowchart provided by the embodiment of the application for obtaining a plurality of data fragment pairs and a plurality of cluster center fragment pairs, as shown in Figure 2 S102 includes:

[0031] S1021, split the first data matrix and each second data matrix into three parts and splice them according to features to obtain three data fragments, and split the first cluster center matrix and each second cluster center matrix into three parts and splice them according to features to obtain three cluster center fragments;

[0032] Specifically, the first data matrix X0 is split into X 01 , X 02 , and X 03 , where X0 = X 01 + X 02 + X 03 , that is, the specific feature value of each sample and each feature is split into three numbers to obtain three fragment matrices X 01 , X 02 , and X 03 , and the dimensions of the three fragment matrices are n*f0, and X 01 is sent to the first computing power provider Party1 and the third computing power provider Party3, X 02 is sent to the second computing power provider Party2 and the first computing power provider Party1, and X 03 is sent to the second computing power provider Party2 and the third computing power provider Party3. Similarly, the first cluster center matrix K0 is split into K0 = K 01 + K 02 + K 03 , and K 01 is sent to the first computing power provider Party1 and the third computing power provider Party3, K 02 is sent to the second computing power provider Party2 and the first computing power provider Party1, and K 03 is sent to the second computing power provider Party2 and the third computing power provider Party3. The first participant host1 splits its corresponding data set (second data matrix) and cluster center (second cluster center matrix) into X1 = X 11 + X 12 + X 13 , and K1 = K 11 + K12 +K 13 , and according to the form of the initiator data transmission, the second participant host2 splits its corresponding data set and cluster center into X2=X 21 +X 22 +X 23 , K2=K 21 +K 22 +K 23 …, the mth participant host m splits its corresponding data set and cluster center into The same method is used for the data fragment distribution.

[0033] Party1(Party3) splices the fragment matrixes according to the feature dimension to obtain the first data fragment X'1, and the dimension of X'1 is n*f, where f=f0+f1+f2+…+f m .

[0034] Similarly, Party2(Party1) splices the fragment matrixes according to the feature dimension to obtain the second data fragment X'2, and the dimension of X'2 is n*f, where f=f0+f1+f2+…+f m .

[0035] Party3(Party2) splices the fragment matrixes according to the feature dimension to obtain the third data fragment X'3, and the dimension of X'3 is n*f, where f=f0+f1+f2+…+f m .

[0036] Party1(Party3) splices the fragment matrixes according to the feature dimension to obtain the first cluster center fragment K'1, and the dimension of K'1 is k*f, where f=f0+f1+f2+…+f m .

[0037] Party2(Party1) splices the fragment matrixes according to the feature dimension to obtain the second cluster center fragment K'2, and the dimension of K'2 is k*f, where f=f0+f1+f2+…+f m .

[0038] Party3(Party2) splices the fragment matrixes according to the feature dimension to obtain the third cluster center fragment K'3, and the dimension of K'3 is k*f, where f=f0+f1+f2+…+f m .

[0039] S1022, each computing power provider pairs the three data fragments to obtain three data fragment pairs; and pairs the three cluster center fragments to obtain three cluster center fragment pairs.

[0040] The first computing power provider Party1 obtains the data fragment pair (X'1, X'2) and the cluster center fragment pair (K'1, K'2), the second computing power provider Party2 obtains the data fragment pair (X'2, X'3) and the cluster center fragment pair (K'2, K'3), and the third computing power provider Party3 obtains the data fragment pair (X'3, X'1) and the cluster center fragment pair (K'3, K'1).

[0041] S103, updating the plurality of cluster center fragment pairs according to the plurality of data fragment pairs and the plurality of cluster center fragment pairs to obtain a plurality of current updated cluster center fragment pairs;

[0042] Specifically, Figure 3 is a flowchart for updating the plurality of current cluster center fragment pairs provided by the embodiment of the application, as shown in Figure 3 S103 includes:

[0043] S1031, calculating the sum of squares of Euclidean distances from any sample to any cluster center according to the three data fragment pairs and the three cluster center fragment pairs to obtain three distance pairs;

[0044] Specifically, the difference between each sample and cluster center is calculated. Taking Party1 as an example, the difference between each row (i.e. each sample) in X'1 and any row (i.e. each cluster center) in K'1 is calculated to obtain a matrix D1, and the dimension of the matrix D1 is n*k*f; similarly, the difference between each row (i.e. each sample) in X'2 and any row (i.e. each cluster center) in K'2 is calculated to obtain a matrix D2, and the dimension of the matrix D2 is n*k*f; that is, Party1 obtains (D1, D2); similarly, Party2 obtains (D2, D3); and Party3 obtains (D3, D1).

[0045] Further, the matrix D j j∈{1, 2, 3} is multiplied by itself in the second and third feature dimensions (i.e. the cluster center dimension k and the feature dimension f), Party1 obtains (D'1, D'2), Party2 obtains (D'2, D'3), and Party3 obtains (D'3, D'1). The dimensions of D'1, D'2 and D'3 are all n*k*f.

[0046] Further, Party 1 sums up the third dimension (i.e. feature dimension f) to obtain the first distance pair (Dis1, Dis2), and Party 2 and Party 3 obtain the second distance pair (Dis2, Dis3) and the third distance pair (Dis3, Dis1) respectively. Wherein, the dimensions of Dis1, Dis2 and Dis3 are all n*k.

[0047] Specifically, it is equivalent to calculating the sum of squares of distances from any sample to any cluster center, and the sum of squares of distances from the jth sample to the lth cluster center is The jth sample x j = (x j,1 , x j,2 , … x j,f ), and the lth cluster center r l = (r l,1 , r l,2 , … r l,f ). To calculate the sum of squares of distances, the difference d = x j - r l between vectors needs to be calculated first, and then the dot product of d and itself is calculated and summed, i.e. sum (d*d).

[0048] In this application, the specific calculation formula of d*d is as follows:

[0049] For any x = x1+x2+x3 and y = y1+y2+y3, multiplication is implemented; wherein x = D, i.e. d, x1 = D1, x2 = D2, x3 = D3, y = D, i.e. d, y1 = D1, y2 = D2, y3 = D3.

[0050] xy = (x1+x2+x3)(y1+y2+y3)

[0051] = x1y1+x1y2+x2y1

[0052] +x2y2+x2y3+x3y2

[0053] +x3y3+x3y1+x1y3

[0054] Let z1 = x1y1+x1y2+x2y1, z2 = x2y2+x2y3+x3y2 and z3 = x3y3+x3y1+x1y3, z1, z2 and z3 can be calculated by Party 1, Party 2 and Party 3 respectively.

[0055] It should be noted that in the calculation of the sum of squares of Euclidean distances from any sample to any cluster center according to the three pairs of data fragments and three pairs of cluster center fragments, the three distance pairs include:

[0056] Three encryption matrices are constructed, and the sum of the three encryption matrices is a 0 matrix.

[0057] Specifically, three parties realize a secret sharing of 0=α1+α2+α3, and z′ i = z i +α i That is, Party 1 gets z′1, Party 2 gets z′2, and Party 3 gets z′3, and Party 3 transmits z′3 to Party 2, Party 2 transmits z′2 to Party 1, and Party l transmits z′1 to Party 3, then Party l , Party 2 and Party 3 get (z′1, z′2) that is (D′1, D′2), (z′2, z′3) that is (D′2, D′3), and (z′3, z′1) that is (D′3, D′1), respectively. In this way, in the process of transmission, each party gets the encrypted z′ i , and does not know the specific z i , further ensuring the privacy of the data.

[0058] The process of the three-party secret sharing of 0 is as follows:

[0059] Party l , Party 2 and Party 3 generate a, b and c, respectively; Party 1 gives a to Party 2, Party 2 gives b to Party 3, and Party 3 gives c to Party 1; Party 1 calculates a-c, that is, α1=ac; Party 2 calculates b-a, that is, α2=b-a; and Party 3 calculates c-b, that is, α3=c-b. Therefore, α1+α2+α3=a-c+b-a+c-b=0, and the above can realize the secret sharing of 0.

[0060] It should be noted that when the multiplication calculation of d*d is performed, the secret sharing of 0 can be performed synchronously (that is, only the dimension of n*k*f needs to be known to construct α1, α2 and α3), and therefore the method of the present application can efficiently realize the calculation of the result.

[0061] S1032, according to the three distance pairs, a corresponding distance matrix is calculated, and the minimum value of each row in the distance matrix is changed to 1, and the remaining values are changed to 0, to obtain three 0-1 matrix piece pairs.

[0062] Specifically, the obtained three distance pairs (Dis1, Dis2), (Dis2, Dis3), (Dis3, Dis1) are used to calculate the sum values of Dis1, Dis2, Dis3 by using the method of multi-party secure calculation (the sum values of Dis1, Dis2, Dis3 correspond to the distance matrix), and the minimum value of each row in the sum values of Dis1, Dis2, Dis3 is calculated, and the minimum value is 1 and the rest is 0 (the minimum value of each row in the distance matrix can be calculated by using the comparison method of multi-party secure calculation, which is a mature technology and will not be described here), and three 0-1 matrix fragment pairs (Dis'1, Dis'2), (Dis'2, Dis'3), (Dis'3, Dis'1) are obtained. The dimensions of Dis'1, Dis'2, Dis'3 are all n*k.

[0063] S1033, calculate three current updated cluster center fragments according to the three data fragment pairs and the three 0-1 matrix fragment pairs.

[0064] Specifically, the S1033 comprises:

[0065] S10331, sum each column in each 0-1 matrix fragment in the three 0-1 matrix fragment pairs to obtain three vector pairs.

[0066] Party1 sums Dis'1 about column to obtain vector g1, and similarly, Party2 sums Dis'2 about column to obtain vector g2, so as to obtain vector pair (g1, g2), Party2 obtains vector pair (g2, g3), and Party3 obtains vector pair (g3, g1). The dimensions of g1, g2, g3 are all k*1.

[0067] S10332, calculate a total vector according to the three vector pairs.

[0068] The three-party interaction fragment information can restore the vector g=g1+g2+g3.

[0069] S10333, calculate the three current updated cluster center fragments according to the three data fragment pairs, the transpose of the three 0-1 matrix fragment pairs, and the total vector.

[0070] Specifically, the S10333 comprises:

[0071] S103331, calculate three current total sum cluster center fragments according to the three data fragment pairs and the transpose of the three 0-1 matrix fragment pairs.

[0072] Specifically, according to the fragment pair Matrix multiplication is performed on (X′1, X′2), (X′2, X′3), and (X′3, X′1) to obtain (K″1, K″2), (K″2, K″3), and (K″3, K″1), where the matrix multiplication is similar to the matrix dot product calculation in S1031. Party1 obtains the first fragment pair of feature values ​​of the sample belonging to the current cluster center (K″1, K″2), Party2 obtains the second fragment pair of feature values ​​of the sample belonging to the current cluster center (K″2, K″3), and Party3 obtains the third fragment pair of feature values ​​of the sample belonging to the current cluster center (K″3, K″1).

[0073] S103332, the three currently updated cluster center fragment pairs are calculated based on the three current sum cluster center fragment pairs and the total vector.

[0074] Specifically, according to the above We obtain three currently updated cluster center fragment pairs, namely (K′1, K′2), (K′2, K′3), and (K′3, K′1).

[0075] S104, repeat S103 until the difference between the sum of all currently updated cluster center fragments in multiple currently updated cluster center fragment pairs and the sum of all previously updated cluster center fragments in multiple previously updated cluster center fragment pairs is less than a preset threshold, then the target cluster center fragment is obtained.

[0076] Specifically, repeat process S103 until the difference between the sum of all updated cluster center fragments in round i+1 (K′1+K′2+K′3) and the sum of all updated cluster center fragments in round i (K′1+K′2+K′3) is less than a preset threshold, then stop repeated training and obtain the target cluster center fragments.

[0077] In the federated clustering method of this invention, each computing power provider can only know the fragment information of the cluster center, but cannot know the specific value of the cluster center. The method of this invention can guarantee data privacy.

[0078] Figure 4 This is a schematic diagram of the structure of a federated clustering system provided in an embodiment of the present invention, as shown below. Figure 4 As shown, the system includes:

[0079] The acquisition module 201 is used to acquire the first data matrix and the first cluster center matrix of the initiator, and to acquire multiple second data matrices and multiple second cluster center matrices corresponding to multiple participants;

[0080] The splitting and splicing module 202 is configured to split and splice the first data matrix, the first cluster center matrix, each second data matrix, and each second cluster center matrix to obtain a plurality of data piece pairs and a plurality of cluster center piece pairs.

[0081] Figure 5 FIG. 2 is a structural schematic diagram of a splitting and splicing module according to an embodiment of the present application, as shown in the figure, the splitting and splicing module 202 includes: Figure 5

[0082] The splitting and splicing sub-module 2021 is configured to split the first data matrix and each second data matrix into three parts and splice them according to features to obtain three data pieces, and split the first cluster center matrix and each second cluster center matrix into three parts and splice them according to features to obtain three cluster center pieces.

[0083] The pairing sub-module 2022 is configured to pair the three data pieces two by two to obtain three data piece pairs, and pair the three cluster center pieces two by two to obtain three cluster center piece pairs.

[0084] The updating module 203 is configured to update the plurality of cluster center piece pairs according to the plurality of data piece pairs and the plurality of cluster center piece pairs to obtain a plurality of current updated cluster center piece pairs.

[0085] Figure 6 FIG. 3 is a structural schematic diagram of an updating module according to an embodiment of the present application, as shown in the figure, the updating module 203 includes: Figure 6

[0086] The first calculation unit 2031 is configured to calculate the sum of squares of Euclidean distances from any sample to any cluster center according to the three data piece pairs and the three cluster center piece pairs to obtain three distance pairs.

[0087] The changing unit 2032 is configured to calculate a corresponding distance matrix according to the three distance pairs, and change the minimum value of each row in the distance matrix to 1 and the remaining values to 0 to obtain three 0-1 matrix piece pairs.

[0088] The second calculation unit 2033 is configured to calculate the three current updated cluster center piece pairs according to the three data piece pairs and the three 0-1 matrix piece pairs.

[0089] Specifically, the second calculation unit 2023 includes:

[0090] The first calculation sub-unit 20231 is configured to sum each column in each 0-1 matrix piece in the three 0-1 matrix piece pairs to obtain three vector pairs.

[0091] ​​The second calculation subunit 20232 is configured to calculate a total vector according to the three vector pairs.

[0092] The third calculation subunit 20233 is configured to calculate the three current updated cluster center fragment pairs according to the three data fragment pairs, the transpose of the three 0-1 matrix fragment pairs, and the total vector.

[0093] Specifically, the calculation of the three current updated cluster center fragment pairs according to the three data fragment pairs, the transpose of the three 0-1 matrix fragment pairs, and the total vector comprises:

[0094] The three current total cluster center fragment pairs are calculated according to the three data fragment pairs and the transpose of the three 0-1 matrix fragment pairs.

[0095] The three current updated cluster center fragment pairs are calculated according to the three current total cluster center fragment pairs and the total vector.

[0096] The repeating module 204 is configured to repeat the updating module until the sum of all current updated cluster center fragments in the plurality of current updated cluster center fragment pairs and the sum of all previous updated cluster center fragments in the plurality of previous updated cluster center fragment pairs have a difference less than a preset threshold value, and a target cluster center fragment is obtained.

[0097] The present application has the following advantages:

[0098] The present application provides a federal clustering method, system and computer storage medium, in which each computing power provider can only know the fragment information of the cluster center and cannot know the specific value of the cluster center, and the method can ensure the privacy of the data.

[0099] Finally, it should be noted that: the above examples are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing examples, those skilled in the art should understand that: it can still modify the technical solutions recorded in the foregoing examples, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application.

Claims

1. A federated clustering method, characterized in that, include: S101, obtain the first data matrix and the first cluster center matrix of the initiator, and obtain multiple second data matrices and multiple second cluster center matrices corresponding to multiple participants; S102, the first data matrix, the first cluster center matrix, each second data matrix, and each second cluster center matrix are split and spliced ​​together to obtain multiple data fragment pairs and multiple cluster center fragment pairs; S103, update the multiple cluster center fragment pairs according to the multiple data fragment pairs and the multiple cluster center fragment pairs to obtain multiple currently updated cluster center fragment pairs; S104, repeat S103 until the difference between the sum of all currently updated cluster center fragments in multiple currently updated cluster center fragment pairs and the sum of all previously updated cluster center fragments in multiple previously updated cluster center fragment pairs is less than a preset threshold, then the target cluster center fragment is obtained. S102 includes: The first data matrix and each second data matrix are split into three parts and spliced ​​together according to the features to obtain three data fragments; and the first cluster center matrix and each second cluster center matrix are split into three parts and spliced ​​together according to the features to obtain three cluster center fragments. The three data fragments are paired up to obtain three data fragment pairs; and the three cluster center fragments are paired up to obtain three cluster center fragment pairs; S103 includes: The sum of squares of the Euclidean distances from any sample to any cluster center is calculated based on the three data fragment pairs and the three cluster center fragment pairs to obtain three distance pairs; Calculate the corresponding distance matrix based on the three distance pairs, and change the minimum value of each row in the distance matrix to 1 and the rest to 0 to obtain three 0-1 matrix fragment pairs; Based on the three data fragment pairs and the three 0-1 matrix fragment pairs, three currently updated cluster center fragment pairs are calculated.

2. The method according to claim 1, characterized in that, The calculation of the three currently updated cluster center fragment pairs based on the three data fragment pairs and the three 0-1 matrix fragment pairs includes: Sum each column of each of the three 0-1 matrix fragment pairs to obtain three vector pairs; The total vector is calculated based on the three vector pairs; The three currently updated cluster center fragment pairs are calculated based on the three data fragment pairs, the transpose of the three 0-1 matrix fragment pairs, and the total vector.

3. The method according to claim 2, characterized in that, The process of calculating the three currently updated cluster center fragment pairs based on the three data fragment pairs, the transpose of the three 0-1 matrix fragment pairs, and the total vector includes: Based on the three data fragment pairs and the transpose of the three 0-1 matrix fragment pairs, three current sum cluster center fragment pairs are calculated; The three currently updated cluster center fragment pairs are calculated based on the three current sum cluster center fragment pairs and the total vector.

4. The method according to claim 3, characterized in that, The process involves calculating the sum of squares of the Euclidean distances from any sample to any cluster center based on the three data fragment pairs and the three cluster center fragment pairs. This yields three distance pairs that simultaneously include: Construct three encryption matrices, the sum of which is a zero matrix.

5. A federated clustering system, characterized in that, include: The acquisition module is used to acquire the first data matrix and the first cluster center matrix of the initiator, as well as multiple second data matrices and multiple second cluster center matrices corresponding to multiple participants; The splitting and splicing module is used to split and splice the first data matrix, the first cluster center matrix, each second data matrix, and each second cluster center matrix to obtain multiple data fragment pairs and multiple cluster center fragment pairs. The update module is used to update the multiple cluster center fragment pairs based on the multiple data fragment pairs and the multiple cluster center fragment pairs to obtain multiple currently updated cluster center fragment pairs; The repeat module is used to repeat the update module until the difference between the sum of all currently updated cluster center fragments in multiple currently updated cluster center fragment pairs and the sum of all previously updated cluster center fragments in multiple previously updated cluster center fragment pairs is less than a preset threshold, and then the target cluster center fragment is obtained. The splitting and splicing module includes: The splitting and splicing submodule is used to split the first data matrix and each second data matrix into three parts and splice them according to features to obtain three data fragments; and to split the first cluster center matrix and each second cluster center matrix into three parts and splice them according to features to obtain three cluster center fragments. The pairing submodule is used to pair the three data fragments into three data fragment pairs; and to pair the three cluster center fragments into three cluster center fragment pairs. The update module includes: The first calculation unit is used to calculate the sum of squares of the Euclidean distances from any sample to any cluster center based on the three data fragment pairs and the three cluster center fragment pairs, thereby obtaining three distance pairs; The modification unit is used to calculate the corresponding distance matrix based on the three distance pairs, and change the minimum value of each row in the distance matrix to 1 and the remaining values ​​to 0, so as to obtain three 0-1 matrix fragment pairs; The second calculation unit is used to calculate three currently updated cluster center fragment pairs based on the three data fragment pairs and the three 0-1 matrix fragment pairs.

6. A computer storage medium having a computer program stored thereon, characterized in that, When the program is executed by the processor, it implements the federated clustering method as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Federated data clustering method and device, computer equipment and storage medium

    CN112508203A

  • Federal image classification method based on graph depth clustering and storage medium

    CN115311478A