A sample clustering processing method and device, a storage medium and an electronic device

CN116028832BActive Publication Date: 2026-08-21CHINA NAT TOBACCO CORP GUIZHOU CO
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202310064936.X
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-02-06
Publication Date
2026-08-21
Estimated Expiration
2043-02-06

AI Technical Summary

Technical Problem

[0005]本公开提供了一种样本聚类处理方法、装置、存储介质及电子设备,解决了相关技术需要借助可信中心服务器以进行样板聚类的问题

Benefits of technology

[0017] According to another aspect of this disclosure, an electronic device is provided, including a processor and a memory, wherein the memory stores instructions executable by the processor to implement any of the methods described in the embodiments of this disclosure.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116028832B_ABST
    Figure CN116028832B_ABST
Patent Text Reader

Abstract

The method comprises the following steps: obtaining local sample distance information of each sample based on feature information of each sample; processing the local sample distance information based on a preset protocol to obtain full feature dimension distance information of each sample; wherein the preset protocol comprises at least one of SPDZ, ABY, ABY3 or NPDZ; obtaining clustering information of each sample based on the full feature dimension distance information; and performing clustering processing on each sample in the local based on the clustering information of each sample. By using the preset protocol, the local server can complete the full feature dimension distance information calculation of each sample based on the local sample distance information, without the aid of the center server for calculation, thereby solving the problem that it is difficult to find a trusted center server in the related art, and realizing the clustering processing and unsupervised learning of the samples in the multiple local servers in the federated learning system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This disclosure relates to the field of computer technology, specifically to the field of federated learning and other technical fields, and in particular to a sample clustering processing method, apparatus, storage medium and electronic device. Background Technology

[0002] Federated learning is an emerging foundational technology for artificial intelligence. It was first proposed by Google in 2016 and was originally intended to solve the problem of Android mobile phone users updating models locally. Its design goal is to carry out efficient machine learning among multiple participants or multiple computing nodes while ensuring information security during big data exchange, protecting terminal data and personal data privacy, and ensuring legality and compliance.

[0003] Federated learning platforms typically consist of data holder nodes and a central server node. The amount of local data or features held by each data holder may not be sufficient to support successful model training, thus requiring support from other data holders. The central server in a federated learning platform functions similarly to a central server in distributed machine learning. Taking classification tasks as an example, the central server collects gradients from each data holder, performs aggregation operations within the server, and returns new gradients. In a collaborative modeling process within federated learning, training on local data by each data holder occurs only locally to protect data privacy. The gradients generated during iterations, after being anonymized, are used as interactive information to replace the local data and are uploaded to a trusted third-party server, awaiting the server's return of aggregated parameters to update the model.

[0004] Currently, research on federated learning algorithms mainly focuses on supervised learning, with relatively little research on unsupervised learning. Existing unsupervised federated K-Means algorithms require a central server. However, in real-world environments, it is difficult to find a reliable central server. Summary of the Invention

[0005] This disclosure provides a sample clustering processing method, apparatus, storage medium, and electronic device, which solves the problem that related technologies require the use of a trusted central server for sample clustering.

[0006] According to one aspect of this disclosure, a sample clustering processing method is provided, comprising:

[0007] Based on the feature information of each local sample, obtain the local sample distance information of each sample;

[0008] The local sample distance information is processed based on a preset protocol to obtain the full feature dimension distance information of each sample; wherein the preset protocol includes at least one of the following: SPDZ, ABY, ABY3 or NPDZ;

[0009] Based on the distance information of all feature dimensions, the clustering information of each sample is obtained;

[0010] Based on the clustering information of each sample, the local samples are clustered.

[0011] According to another aspect of this disclosure, a sample clustering processing apparatus is provided, comprising:

[0012] The first acquisition module is used to acquire the local sample distance information of each sample based on the feature information of each sample in the local area.

[0013] The second acquisition module is used to process the local sample distance information based on a preset protocol to obtain the full feature dimension distance information of each sample; wherein, the preset protocol includes at least one of the following: SPDZ, ABY, ABY3 or NPDZ;

[0014] The third acquisition module is used to acquire the clustering information of each sample based on the distance information of the full feature dimension;

[0015] The clustering module is used to cluster the local samples based on the clustering information of each sample.

[0016] According to another aspect of this disclosure, a computer-readable storage medium is provided, wherein computer instructions are stored, which are executed by a computer to implement any of the methods described in the embodiments of this disclosure.

[0017] According to another aspect of this disclosure, an electronic device is provided, including a processor and a memory, wherein the memory stores instructions executable by the processor to implement any of the methods described in the embodiments of this disclosure.

[0018] The sample clustering processing method provided in this disclosure, by using a preset protocol (SPDZ, ABY, ABY3 or NPDZ), enables local servers to calculate the distance information of each sample across all feature dimensions based on local sample distance information, without relying on a central server for calculation. This solves the problem of finding a trustworthy central server in related technologies, and enables clustering processing and unsupervised learning of samples located on multiple local servers in a federated learning system. Attached Figure Description

[0019] Figure 1 This is a sample clustering processing method according to an embodiment of the present disclosure;

[0020] Figure 2This is a sample clustering processing apparatus according to an embodiment of the present disclosure;

[0021] Figure 3 This is another sample clustering processing apparatus according to embodiments of the present disclosure;

[0022] Figure 4 This is yet another sample clustering processing apparatus according to embodiments of the present disclosure;

[0023] Figure 5 This is yet another sample clustering processing apparatus according to embodiments of the present disclosure;

[0024] Figure 6 This is another sample clustering processing apparatus according to an embodiment of the present disclosure. Detailed Implementation

[0025] The exemplary embodiments of this disclosure are described below with reference to the accompanying drawings, including various details of the embodiments to aid understanding, and should be considered merely exemplary. Therefore, those skilled in the art will recognize that various changes and modifications can be made to the embodiments described herein without departing from the scope and spirit of this disclosure. Similarly, for clarity and brevity, descriptions of well-known functions and structures are omitted in the following description.

[0026] Obviously, the described embodiments are only some, not all, of the embodiments disclosed herein. All other embodiments obtained by those skilled in the art based on the embodiments of this disclosure without inventive effort are within the scope of protection of this disclosure.

[0027] It should be noted that the terminal devices involved in the embodiments of this disclosure may include, but are not limited to, smart devices such as mobile phones, personal digital assistants (PDAs), wireless handheld devices, and tablet computers; the display devices may include, but are not limited to, personal computers, televisions, and other devices with display functions.

[0028] Furthermore, the term "and / or" in this article is merely a description of the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, or B existing alone. Additionally, the character " / " in this article generally indicates that the preceding and following related objects have an "or" relationship.

[0029] Based on the problems mentioned in related technologies and to overcome their shortcomings, this disclosure provides a sample clustering processing scheme that can be applied to federated learning in unsupervised learning.

[0030] Figure 1This is a sample clustering processing method according to an embodiment of the present disclosure, which can be specifically applied to a local server in a federated learning system, such as... Figure 1 As shown, the specific steps may include the following:

[0031] S102, Based on the feature information of each local sample, obtain the local sample distance information of each sample;

[0032] S104, Process the local sample distance information based on a preset protocol to obtain the full feature dimension distance information of each sample; wherein, the preset protocol includes at least one of the following: SPDZ, ABY, ABY3 or NPDZ;

[0033] S106, Based on the distance information of the full feature dimension, obtain the clustering information of each sample;

[0034] S108, based on the clustering information of each sample, perform clustering processing on each of the local samples.

[0035] The architecture of the federated learning system in this embodiment includes multiple local servers participating in federated learning. In the application scenario of this embodiment, each local server is required to have completed sample alignment before performing the sample clustering processing. After sample alignment, there is an overlap between the samples participating in federated learning across all local servers. Specifically, each local server participating in federated learning includes samples with the same sample ID, but the features of samples with the same sample ID differ across different local servers. For example, for a given sample ID, the first local server includes features A, B, and C; the second local server includes features D, E, and F; the third local server includes features G, H, and I, and so on.

[0036] SPDZ is a secure multi-party computation protocol that predates federated learning. Its name is derived from the initials of the four inventors' surnames. The fundamental method of SPDZ is secret sharing. In deployment, participants in a federated learning system can directly participate as SPDZ nodes, or two, three, or more SPDZ secure computation nodes can be used, with each party secretly sharing data to the nodes for further computation. Based on the aforementioned distribution characteristics of samples in a federated learning system, each individual local server stores only partial features of the samples. In distributed federated learning, when implementing unsupervised learning, the SPDZ protocol allows local servers to calculate the full feature dimension distance information of each sample based on local sample distance information, without relying on a central server. This solves the problem of finding a trustworthy central server in related technologies, enabling clustering and unsupervised learning of samples located on multiple local servers within the federated learning system. Besides SPDZ, the ABY, ABY3, and NPDZ secure multi-party computation protocols can also be used in this application embodiment to calculate the full feature dimension distance information of each sample based on local sample distance information.

[0037] In an optional implementation, the local sample distance information of each sample can be obtained based on the feature information of each local sample, which can be achieved in the following way:

[0038] When calculating local sample distance information, the local server can identify the spatial distance between samples along the feature dimension. For example, on the i-th local server, the Euclidean distance calculation formula (1) can be used to calculate the distance between sample X1 and sample X2 in the N-dimensional feature space:

[0039]

[0040] Where x 1i Let x represent the i-th feature of sample x1. 2i Let N represent the i-th feature of sample x2, where N can be the feature dimension of any local server.

[0041] The local sample distance information of each local server may include the distance information between any two samples on that local server. Specifically, the distance information between any two samples may be d calculated by the above formula, or some variation of d calculated by the above formula, such as the square or other mathematical variations.

[0042] In an optional implementation, the local sample distance information is processed based on the SPDZ protocol to obtain the full feature dimension distance information of each sample. This can be achieved in the following way:

[0043] First, each local server can use the above formula (1) to calculate the Euclidean distance between all local samples, for example, it can be expressed as: Where n is the number of samples, k i For local server P i The number of features of the samples.

[0044] Secondly, the local sample distance information is processed according to the addition operator of the SPDZ protocol to obtain the full feature dimension distance information d of each sample. n*m , where m is the sum of the number of features of the sample on all local servers.

[0045] It should be noted that, in addition to the SPDZ protocol, the three secure multi-party computation protocols ABY, ABY3, and NPDZ can also be used in the embodiments of this application to complete the calculation of the full feature dimension distance information of each sample based on the local sample distance information.

[0046] In an optional implementation, the clustering information of each sample is obtained based on the full feature dimension distance information, including: processing the full feature dimension distance information of each sample based on the MapReduce model to obtain the local density of each sample; and processing the local density of the sample based on the MapReduce model to obtain the following distance of each sample.

[0047] The MapReduce model is a programming paradigm for parallel computation on large-scale datasets. The concepts of "Map" and "Reduce," along with their core ideas, are borrowed from functional programming languages ​​and features from vector programming languages. It greatly simplifies the process for programmers without prior knowledge of distributed parallel programming, allowing them to run their programs on distributed systems. Current software implementations specify a Map function to map a set of key-value pairs into a new set of key-value pairs, and concurrent Reduce functions to ensure that all mapped key-value pairs share the same key group. Parallelizing the computation process using the MapReduce framework makes it suitable for large-scale datasets, further improving the efficiency of clustering in federated learning.

[0048] In an optional implementation, the step of processing the full feature dimension distance information of each sample based on the MapReduce model to obtain the local density of each sample includes: obtaining the full feature dimension distance information of each sample in the Map task; setting a globally unique distance threshold based on the distance information in the Reduce task; obtaining the full feature dimension distance information of each sample in the Map task; and calculating the local density of each sample based on the full feature dimension distance information of each sample and the distance threshold in the Reduce task.

[0049] The clustering algorithm based on density peaks is officially called the clustering by fast search and find of density peaks (DPC). This embodiment can be implemented based on this DPC algorithm.

[0050] The distance threshold can be set in the following way: by setting the distance threshold d. c It can control which sample's neighboring samples are at least as close as or equal to a distance threshold d. c The number of neighbor samples accounts for 1-2% of the total number of neighbor samples. This allows for more accurate control over the clustering process for each sample. In this embodiment, the distance threshold d for each sample... c The selection process can be implemented iteratively. For example, for any sample, first set d... c The value is 0, at which point d c =0, less than d c The sample size is 0. Then set d... c The maximum distance d with neighboring samples max At this time, due to d c For d max less than or equal to d max The sample size is 100%. Then set d. c For 0 and d max The average value is then used to detect neighbor samples with a distance less than d. c Is the quantity between 1-2%? If it is greater than 2%, then continue setting d. c 0 and the current d c The average value; continue testing. If it is less than 1%, continue setting d. c For the current d c and d max The average value is calculated, and the detection continues; this process is repeated until a reasonable value of d is obtained. c This allows a sample to have all its neighboring samples whose distance to that sample is less than or equal to a distance threshold d. cThe number of neighbor samples should be 1-2% of the total number of neighbor samples. The above is the distance threshold d for obtaining each sample provided in this embodiment. c One implementation method is to use other methods to set the distance threshold d in practical applications. c Anything that meets the setting requirements is acceptable; no restrictions are imposed here.

[0051] Specifically, to increase the diversity of local density values ​​for samples and reduce the impact of large statistical errors on small datasets, this embodiment improves the method for calculating the local density of nodes in the DPC algorithm by introducing a power-law kernel function and a normalization method. The improved local density calculation method is shown in formula (2). Since the local density of each sample calculated by formula (2) is independent and cannot be reasonably compared with the local density of other samples, this embodiment also uses formula (3) to normalize the local density obtained by formula (2) so that the local densities of all samples are comparable.

[0052] The local density of each sample can be obtained according to the following formulas (2) and (3).

[0053]

[0054]

[0055] Where d(i,j) represents the distance information between sample i and sample j across all feature dimensions, ρ' i ρ represents the local density of each sample calculated based on formula (2); min This represents the local density ρ' of each sample calculated based on formula (2). i The minimum value of ρ max This represents the local density ρ' of each sample calculated based on formula (2). i The maximum value, ρ i This represents the normalized local density of sample i.

[0056] Furthermore, by using the MapReduce model to perform parallel computation of local density, the efficiency of local density computation in federated learning is further improved.

[0057] In an optional implementation, the step of processing the local density of the samples based on the MapReduce model to obtain the following distance of each sample includes: obtaining the local density of each sample in a Map task; obtaining the maximum value of the local density in a Reduce task and adding the local density to a density list; sorting the local densities in the density list to obtain a sorted local density list; and determining the following neighbors of each sample and the following distance of each sample relative to the following neighbors in a Map task based on the sorted local densities.

[0058] For any given sample, after determining the corresponding cutoff distance, it can be determined that among all its neighboring samples, only 1-2% have a distance less than the distance threshold. Then, further, among this 1-2% of neighboring samples, a sample with a local density greater than the sample's local density is selected as an ideal target sample that the sample can follow. The distance between this sample and the target sample can then be considered the following distance for this sample.

[0059] Furthermore, by using the MapReduce model for parallel computation based on distance, the computational efficiency of distance following in federated learning is further improved.

[0060] In an optional implementation, the clustering process of the local samples based on the clustering information of each sample includes: calculating a local density threshold based on the local density; calculating a following distance threshold based on the following distance; determining the cluster center of each sample in the Map task based on the local density threshold and the following distance threshold; and completing the clustering of each sample in the Reduce task based on the cluster center.

[0061] The selection of cluster centers in the DPC algorithm requires manual specification based on the decision graph. This method is not well applied to complex datasets, so a strategy for automatically selecting cluster centers based on the data is needed. Based on this, in this disclosure, the local density threshold and the following distance threshold can be calculated based on the local density and following distance of each sample. For example, the local density threshold and the following distance threshold can be calculated using the following formulas (4) and (5).

[0062]

[0063]

[0064] Where, ρ c For the local density threshold, δ c The following distance threshold is λ, β are adjustable coefficients, and n is the number of samples.

[0065] Due to the local density ρ of the cluster centersi and following distance δ i Generally, the set of cluster centers C is relatively large, so we can define it as: C = {ρ i |ρ i ≥ρ c ∧δ i ≥δ c , i = 0, 1, 2, ..., n}, where i is the i-th sample and n is the number of samples.

[0066] For example, based on this principle, in practical implementation, at least one sample identifier with a local density greater than a local density threshold and a following distance greater than a following distance threshold can be obtained from the identifiers of each sample and used as a cluster center. Then, the identifiers of other samples are assigned to the cluster center with a local density greater than their own and the closest distance, resulting in a set of sample clusters. In this way, reasonable and accurate cluster centers can be obtained; then, clustering based on the cluster centers can effectively improve the accuracy and precision of sample clustering and effectively ensure the stability of sample clustering.

[0067] Furthermore, clustering based on samples using the MapReduce model can further improve the efficiency of federated learning sample clustering.

[0068] Figure 2 This is a sample clustering processing apparatus according to an embodiment of the present disclosure, such as... Figure 2 As shown, the device includes: a first acquisition module 202, used to acquire local sample distance information of each sample based on the feature information of each sample in the local environment; a second acquisition module 204, used to process the local sample distance information based on a preset protocol to acquire full feature dimension distance information of each sample; wherein the preset protocol includes at least one of the following: SPDZ, ABY, ABY3 or NPDZ; a third acquisition module 206, used to acquire clustering information of each sample based on the full feature dimension distance information; and a clustering module 208, used to perform clustering processing on each sample in the local environment based on the clustering information of each sample.

[0069] The architecture of the federated learning system in this embodiment includes multiple local servers participating in federated learning. In the application scenario of this embodiment, each local server is required to have completed sample alignment before performing the sample clustering processing. After sample alignment, there is an overlap between the samples participating in federated learning across all local servers. Specifically, each local server participating in federated learning includes samples with the same sample ID, but the features of samples with the same sample ID differ across different local servers. For example, for a given sample ID, the first local server includes features A, B, and C; the second local server includes features D, E, and F; the third local server includes features G, H, and I, and so on.

[0070] SPDZ is a secure multi-party computation protocol that predates federated learning. Its name is derived from the initials of the four inventors' surnames. The fundamental method of SPDZ is secret sharing. In deployment, participants in a federated learning system can directly participate as SPDZ nodes, or two, three, or more SPDZ secure computation nodes can be used, with each party secretly sharing data to the nodes for further computation. Based on the aforementioned distribution characteristics of samples in a federated learning system, each individual local server stores only partial features of the samples. In distributed federated learning, when implementing unsupervised learning, the SPDZ protocol allows local servers to calculate the full feature dimension distance information of each sample based on local sample distance information, without relying on a central server. This solves the problem of finding a trustworthy central server in related technologies, enabling clustering and unsupervised learning of samples located on multiple local servers within the federated learning system. Besides SPDZ, the ABY, ABY3, and NPDZ secure multi-party computation protocols can also be used in this application embodiment to calculate the full feature dimension distance information of each sample based on local sample distance information.

[0071] Figure 3 This is another sample clustering processing apparatus according to embodiments of the present disclosure, such as... Figure 3 As shown, in an optional implementation, the third acquisition module 206 includes: a first acquisition submodule 2062, used to process the full feature dimension distance information of each sample based on the MapReduce model to obtain the local density of each sample; and a second acquisition submodule 2064, used to process the local density of the sample based on the MapReduce model to obtain the following distance of each sample.

[0072] The MapReduce model is a programming paradigm for parallel computation on large-scale datasets. The concepts of "Map" and "Reduce," along with their core ideas, are borrowed from functional programming languages ​​and features from vector programming languages. It greatly simplifies the process for programmers without prior knowledge of distributed parallel programming, allowing them to run their programs on distributed systems. Current software implementations specify a Map function to map a set of key-value pairs into a new set of key-value pairs, and concurrent Reduce functions to ensure that all mapped key-value pairs share the same key group. Parallelizing the computation process using the MapReduce framework makes it suitable for large-scale datasets, further improving the efficiency of clustering in federated learning.

[0073] Figure 4 This is yet another sample clustering processing apparatus according to embodiments of the present disclosure, such as... Figure 4 As shown, in an optional implementation, the first acquisition submodule 2062 includes: a first acquisition subunit 20622, used to acquire distance information of all feature dimensions of each sample in a Map task; a setting subunit 20624, used to set a globally unique distance threshold based on the distance information in a Reduce task; and a calculation subunit 20626, used to calculate the local density of each sample based on the distance information of all feature dimensions of each sample and the distance threshold in a Reduce task. Parallel calculation of local density using the MapReduce model further improves the efficiency of local density calculation in federated learning.

[0074] Figure 5 This is another sample clustering processing apparatus according to embodiments of the present disclosure, such as... Figure 5 As shown, in an optional implementation, the second acquisition submodule 2064 includes: a second acquisition subunit 20642, used to acquire the local density of each sample in a Map task; an adding subunit 20644, used to acquire the maximum value of the local density in a Reduce task and add the local density to a density list; a sorting subunit 20646, used to sort the local densities in the density list to obtain a sorted local density list; and a determining subunit 20648, used to determine the following neighbors of each sample and the following distance of each sample relative to its following neighbors in a Map task based on the sorted local densities. Parallel computation based on distance is performed using the MapReduce model, further improving the computational efficiency of the following distance in federated learning.

[0075] Figure 6 This is another sample clustering processing apparatus according to embodiments of the present disclosure, such as... Figure 6As shown, in an optional implementation, the clustering module 208 includes: a first calculation submodule 2082, used to calculate a local density threshold based on the local density; a second calculation submodule 2084, used to calculate a following distance threshold based on the following distance; a determination submodule 2086, used to determine the cluster center of each sample in the Map task based on the local density threshold and the following distance threshold; and a clustering submodule 2088, used to complete the clustering of each sample based on the cluster centers in the Reduce task. Using the MapReduce model for sample clustering processing can further improve the efficiency of federated learning sample clustering.

[0076] This invention also provides an electronic device comprising a processor and a memory. The electronic device may have one or more processors, and the memory, as a computer-readable storage medium, can be used to store computer-executable programs. The processor executes various functional applications and data processing of the electronic device by running software programs and instructions stored in the memory, thereby implementing the methods in any of the above embodiments.

[0077] This application also provides a storage medium containing computer-executable instructions that, when executed by a computer processor, implement the methods in any of the above embodiments.

[0078] Optionally, the processor implements a sample clustering processing method by executing instructions, the method including:

[0079] S1, Based on the feature information of each local sample, obtain the local sample distance information of each sample;

[0080] S2, a preset protocol processes the local sample distance information to obtain the full feature dimension distance information of each sample; wherein, the preset protocol includes at least one of the following: SPDZ, ABY, ABY3 or NPDZ;

[0081] S3, Based on the distance information of the full feature dimension, obtain the clustering information of each sample;

[0082] S4, based on the clustering information of each sample, perform clustering processing on each of the local samples.

[0083] The above are merely exemplary embodiments of this application and are not intended to limit the scope of protection of this application.

[0084] Generally, the various embodiments of this application can be implemented in hardware or dedicated circuitry, software, logic, or any combination thereof. For example, some aspects can be implemented in hardware, while others can be implemented in firmware or software that can be executed by a controller, microprocessor, or other computing device, although this application is not limited thereto.

[0085] Embodiments of this application can be implemented by executing computer program instructions through the data processor of a mobile device, for example, in a processor entity, or through hardware, or through a combination of software and hardware. The computer program instructions can be assembly instructions, instruction set architecture (ISA) instructions, machine instructions, machine-dependent instructions, microcode, firmware instructions, status setting data, or source code or object code written in any combination of one or more programming languages.

[0086] Any block diagram of logical flow in the accompanying drawings of this application may represent program steps, or may represent interconnected logic circuits, modules, and functions, or may represent a combination of program steps and logic circuits, modules, and functions. The computer program may be stored in memory. The memory may be of any type suitable to the local technical environment and may be implemented using any suitable data storage technology, such as, but not limited to, read-only memory (ROM), random access memory (RAM), optical storage devices and systems (Digital Multifunction Discs, DVDs, or CDs), etc. Computer-readable media may include non-transitory storage media. The data processor may be of any type suitable to the local technical environment, such as, but not limited to, general-purpose computers, special-purpose computers, microprocessors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), programmable logic devices (FGPAs), and processors based on multi-core processor architectures.

[0087] A detailed description of exemplary embodiments of this application has been provided above through exemplary and non-limiting examples. However, various modifications and adjustments to the above embodiments will be apparent to those skilled in the art when considered in conjunction with the accompanying drawings and claims, without departing from the scope of the invention. Therefore, the proper scope of the invention will be determined by the claims.

Claims

1. A sample clustering processing method, applied to a local server in a federated learning system, wherein the method includes: Based on the feature information of each sample on each local server, the local sample distance information of each sample is obtained; wherein, when calculating the local sample distance information, the local server identifies the spatial distance between each sample in the feature dimension and calculates it using the Euclidean distance calculation formula; the local sample distance information of each local server includes the distance information between any two samples on that local server. The local sample distance information is processed based on a preset protocol to obtain the full feature dimension distance information of each sample; wherein, the preset protocol includes at least one of the following: SPDZ, ABY, ABY3 or NPDZ; wherein, each local server uses the Euclidean distance calculation formula to calculate the Euclidean distance between all local samples locally; the local sample distance information is processed according to the addition operator of the preset protocol to obtain the full feature dimension distance information of each sample; Based on the distance information of all feature dimensions, the clustering information of each sample is obtained; Based on the clustering information of each sample, the local samples are clustered. By using a preset protocol, local servers can calculate the distance information of each sample across all feature dimensions based on the distance information of local samples, without relying on a central server for calculation. This solves the problem of finding a trustworthy central server and enables clustering and unsupervised learning of samples from multiple local servers in the federated learning system. Wherein, obtaining the clustering information of each sample based on the distance information of the full feature dimension includes: The MapReduce model is used to process the distance information of all features of each sample to obtain the local density of each sample. The local density of the samples is processed based on the MapReduce model to obtain the following distance of each sample; The step of processing the full feature dimension distance information of each sample based on the MapReduce model to obtain the local density of each sample includes: In the Map task, obtain the distance information of each sample across all feature dimensions; In the Reduce task, a distance threshold is set according to the distance information, and the local density of each sample is calculated based on the distance information of the full feature dimensions of each sample and the distance threshold. The distance threshold setting includes controlling the number of neighbor samples whose distance to the sample is less than or equal to the distance threshold to account for 1-2% of the total number of neighbor samples, so as to more accurately control the clustering process of each sample.

2. The method according to claim 1, wherein, After calculating the local density of each sample based on the distance information of each sample across all feature dimensions and the truncation threshold of each sample, the method further includes: The local density of each sample is normalized.

3. The method according to any one of claims 1-2, wherein, The process of processing the local density of the samples based on the MapReduce model to obtain the following distance for each sample includes: Obtain the local density of each sample in the Map task; In the Reduce task, obtain the maximum value of the local density and add the local density to the density list; Sort the local densities in the density list; In the Map task, the following neighbors of each sample and the following distance of each sample relative to the following neighbors are determined based on the sorted local density.

4. The method according to claim 3, wherein, The clustering process based on the clustering information of each sample, performing clustering on the local samples, includes: Calculate the local density threshold based on the local density; Calculate the following distance threshold based on the stated following distance; In the Map task, the cluster center of each sample is determined based on the local density threshold and the following distance threshold; In the Reduce task, the clustering of each sample is completed based on the cluster centers.

5. A sample clustering processing apparatus, applied to a local server in a federated learning system, wherein the apparatus comprises: The first acquisition module is used to acquire local sample distance information of each sample based on the feature information of each sample on each local server; wherein, when calculating the local sample distance information, the local server identifies the spatial distance between each sample in the feature dimension and calculates it using the Euclidean distance calculation formula; the local sample distance information of each local server includes the distance information between any two samples on that local server. The second acquisition module is used to process the local sample distance information based on a preset protocol to obtain the full feature dimension distance information of each sample; wherein, the preset protocol includes at least one of the following: SPDZ, ABY, ABY3, or NPDZ; wherein, each local server uses the Euclidean distance calculation formula to calculate the Euclidean distance between all local samples locally; and processes the local sample distance information according to the addition operator of the preset protocol to obtain the full feature dimension distance information of each sample. The third acquisition module is used to acquire the clustering information of each sample based on the distance information of the full feature dimension; The clustering module is used to cluster the local samples based on the clustering information of each sample. By using a preset protocol, local servers can calculate the distance information of each sample across all feature dimensions based on the distance information of local samples, without relying on a central server for calculation. This solves the problem of finding a trustworthy central server and enables clustering and unsupervised learning of samples from multiple local servers in the federated learning system. The third acquisition module includes: The first acquisition submodule is used to process the distance information of the full feature dimension of each sample based on the MapReduce model to obtain the local density of each sample. The second acquisition submodule is used to process the local density of the samples based on the MapReduce model and obtain the following distance of each sample; The step of processing the full feature dimension distance information of each sample based on the MapReduce model to obtain the local density of each sample includes: In the Map task, obtain the distance information of each sample across all feature dimensions; In the Reduce task, a distance threshold is set according to the distance information, and the local density of each sample is calculated based on the distance information of the full feature dimensions of each sample and the distance threshold. The distance threshold setting includes controlling the number of neighbor samples whose distance to the sample is less than or equal to the distance threshold to account for 1-2% of the total number of neighbor samples, so as to more accurately control the clustering process of each sample.

6. A computer-readable storage medium storing computer instructions that are executed by a computer to implement the method as described in any one of claims 1-4.

7. An electronic device comprising a processor and a memory, wherein, The memory stores instructions that can be executed by the processor to implement the method as described in any one of claims 1-4.

Citation Information

Patent Citations

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

    CN112508203A