User segmentation method and system under block chain privacy protection
By using localized differential privacy mechanism and KED-KMeans clustering algorithm on the blockchain, the privacy protection problem in data clustering is solved, and the clustering accuracy and applicability are improved.
Patent Information
- Application Number
- CN202411565372.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-05
- Publication Date
- 2025-02-11
AI Technical Summary
During the data clustering process, the existing technology is difficult to effectively protect user privacy, resulting in low clustering accuracy and poor results.
The user segmentation method under blockchain privacy protection is adopted, combined with the localized differential privacy mechanism and the data storage architecture of blockchain technology, and the KED-KMeans clustering algorithm is used for user segmentation. The algorithm finds the density peaks through kernel density estimation based on Gaussian kernel functions, and uses density distance scores to measure the similarity between the sample and the cluster center.
Effectively avoid the risk of privacy leakage, improve the effectiveness and applicability of clustering algorithms in complex data environments, and is significantly better than traditional clustering algorithms.
Smart Images

Figure CN119415985A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the field of user clustering, and specifically relates to a user segmentation method and system under blockchain privacy protection. Background Art
[0002] In today's digital age, with the rapid development of information technology and the explosive growth of data, data has become a new driving force for social progress and economic development. By collecting and analyzing large amounts of data, companies and institutions can better understand market trends, optimize product services, and improve customer satisfaction. As market competition intensifies, companies urgently need to develop more accurate market strategies through in-depth customer insights. Personalized services have become an important trend in digital products and services. The key to achieving personalized services lies in effective segmentation and analysis of users to understand their preferences and behavior patterns.
[0003] However, with the frequent leakage of personal sensitive information, the widespread use of data has also brought about serious privacy protection issues. The clustering process also faces the problem of low clustering accuracy and poor results. Therefore, how to protect user privacy while using data for accurate clustering has become an urgent problem to be solved. Summary of the invention
[0004] Purpose of the invention: In view of the shortcomings of the above-mentioned prior art, the purpose of the present invention is to provide a user segmentation method and system under blockchain privacy protection, integrating the localized differential privacy mechanism with the data storage architecture of blockchain technology, aiming to ensure the security of user data while effectively avoiding the risk of privacy leakage. On this basis, a clustering algorithm based on density distance metric is designed and implemented to improve the effectiveness and applicability of clustering algorithms in complex data environments.
[0005] Technical solution: To achieve the above-mentioned invention purpose, the present invention adopts the following technical solution: a user segmentation method under blockchain privacy protection, comprising the following steps:
[0006] Obtain user data and use the differential privacy algorithm to add noise to the user data;
[0007] The noisy user data is uploaded to the chain after consensus;
[0008] The on-chain data is obtained, and the KED-KMeans clustering algorithm is used to achieve user segmentation. The KED-KMeans clustering algorithm uses kernel density estimation based on Gaussian kernel function to find the density peak to initialize the cluster center, and uses the density distance score to measure the similarity between the sample and the cluster center. The density distance score is the weighted sum of the normalized distance and the density difference; the distance is the Euclidean distance, and the density difference is the kernel density difference estimated based on the Gaussian kernel function.
[0009] Furthermore, when the differential privacy algorithm is used to perform noise processing on user data, Laplace distribution is selected to perform noise processing on the data.
[0010] Furthermore, the kernel density estimation formula is: Where x is the evaluation point, s j is the sample point, h is the bandwidth, K(·) is the Gaussian kernel function, and n is the total number of samples.
[0011] Furthermore, the density distance score formula is:
[0012] FD(s,c)=D nor (s i ,c)*λ+F nor (s i ,c)*(1-λ)
[0013] Where λ∈(0,1) is the weight coefficient, D nor (s i ,c) and F nor (s i ,c) is the sample point s i Normalized distance and density difference from cluster center c.
[0014] Furthermore, in the density distance score, distance is used as the main factor affecting similarity, and density difference is used as the secondary factor affecting similarity.
[0015] Furthermore, the KED-KMeans clustering algorithm comprises the following steps:
[0016] (1) Perform multidimensional kernel density estimation on the user data set S and calculate each user sample point s i The kernel density value F(s i )
[0017] (2) Initialize the KDE-KMeans algorithm clustering center, including:
[0018] (2.1) Find the user sample point with the largest kernel density value as the first cluster center;
[0019] (2.2) For each user sample s in the user dataset i , calculate its distance D(s) to the nearest selected cluster center c i ,c);
[0020] (2.3) With probability Select a new cluster center c i ;
[0021] (2.4) Repeat steps (2.2) to (2.3) until all k centers are selected;
[0022] (3) Each user sample point is assigned to the center point with the smallest density distance score, forming k clusters;
[0023] (4) For each cluster, calculate the mean of all user sample points in the cluster and use this mean as the new cluster center c i , and calculate the kernel density value F(c i );
[0024] (5) Repeat steps (3) to (4) until the cluster center no longer changes or the preset number of iterations or accuracy requirements are reached.
[0025] User segmentation system under blockchain privacy protection, including:
[0026] The data privacy processing module is used to obtain user data and perform noise processing on the user data using a differential privacy algorithm;
[0027] The blockchain storage module is used to upload the noisy user data to the blockchain after consensus;
[0028] And a user segmentation module, which is used to obtain on-chain data and use the KED-KMeans clustering algorithm to achieve user segmentation. The KED-KMeans clustering algorithm uses kernel density estimation based on Gaussian kernel function to find the density peak to initialize the cluster center, and uses the density distance score to measure the similarity between the sample and the cluster center. The density distance score is the weighted sum of the normalized distance and the density difference; the distance is the Euclidean distance, and the density difference is the kernel density difference estimated based on the Gaussian kernel function.
[0029] A computer system includes a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor, wherein the computer program / instruction, when executed by the processor, implements the steps of the user segmentation method under blockchain privacy protection.
[0030] A computer-readable storage medium stores a computer program, which, when executed by a processor, implements the steps of the user segmentation method under blockchain privacy protection.
[0031] A computer program product includes a computer program / instruction, which, when executed by a processor, implements the steps of the user segmentation method under blockchain privacy protection.
[0032] Beneficial effects: Compared with the prior art, the present invention has the following advantages: the user segmentation method under blockchain privacy protection described in the present invention is significantly superior to the existing traditional algorithm in the evaluation of clustering accuracy by the proposed KDE-KMeans algorithm. Due to the diversity of user data under blockchain privacy protection, the density of each cluster is not balanced when forming data samples. The present invention is particularly advantageous when processing sample data with significant density differences between clusters, which fully demonstrates the effectiveness and applicability of the present invention in complex data environments. BRIEF DESCRIPTION OF THE DRAWINGS
[0033] Figure 1 It is a method flow chart of an embodiment of the present invention. DETAILED DESCRIPTION
[0034] The present invention is described in detail below in conjunction with the accompanying drawings and specific embodiments. The following embodiments are only used to illustrate the present invention and are not used to limit the protection scope of the present invention.
[0035] A user segmentation method under blockchain privacy protection disclosed in an embodiment of the present invention includes the following steps:
[0036] Step 1: Obtain and organize user data information, use differential privacy to add noise to user data, and upload the noised data to the chain after consensus. Establish a blockchain security storage mechanism based on differential privacy.
[0037] Step 2: Get the data on the chain and use the KED-KMeans clustering algorithm to achieve user segmentation. The KED-KMeans clustering algorithm uses kernel density estimation based on Gaussian kernel function to find the density peak to initialize the cluster center, and uses the density distance score to measure the similarity between the sample and the cluster center. The density distance score is the weighted sum of the normalized distance and the density difference; the distance is the Euclidean distance, and the density difference is the kernel density difference estimated based on the Gaussian kernel function.
[0038] In this embodiment, the blockchain security storage mechanism based on differential privacy described in step 1 above includes:
[0039] 1) Data collection and organization: Pre-process the data collected by the user’s device. The data needs to be collected and organized to ensure its accuracy and applicability for subsequent differential privacy and blockchain transactions.
[0040] 2) Data Noising: The processed user data is denoised using a differential privacy algorithm to ensure the privacy of the data during transmission and storage. The noisy data is encapsulated into blockchain transactions. Each transaction contains multiple encrypted data blocks and necessary metadata (such as timestamp, user ID, data description, etc.).
[0041] First, we need to decide which differential privacy model to use. The most commonly used model is ε-differential privacy, which provides a way to quantify the risk of information leakage.
[0042] ε-Differential Privacy Definition: An Algorithm ε-differential privacy is satisfied if for any two adjacent datasets D and D' that differ by only one element, and for all (algorithm All possible output ranges of ), have:
[0043]
[0044] Where ∈ is a positive real number called the privacy budget, and Pr represents the probability.
[0045] Sensitivity definition: For the query function Its sensitivity Δf is defined as:
[0046]
[0047] The maximization here is performed on all adjacent pairs of data sets D and D'.
[0048] Then, choose a suitable noise distribution to satisfy ε-differential privacy. Here we choose Laplace distribution. The probability density function of Laplace distribution is:
[0049]
[0050] where μ is the location parameter (usually set to 0) and b is the scale parameter. According to ε-differential privacy, b is set to Δf / ∈.
[0051] Finally, the noise and query results are calculated. For a given query f(D), Laplace noise Lap(0,Δf / ∈) is generated and added to the query result:
[0052]
[0053] After differential privacy noise addition, the processed data not only protects user privacy but also maintains the practicality of the data to a certain extent.
[0054] 3) Consensus on the chain: Once the transactions are verified and consensus is reached, they will be packaged into a new block and added to the end of the blockchain. This process ensures the immutability and traceability of the data and completes the storage process.
[0055] In this embodiment, the KED-KMeans clustering algorithm steps described in step 2 above are as follows:
[0056] 1) Kernel Density Estimation
[0057] Select kernel function: Gaussian kernel is the most commonly used kernel function, the formula is:
[0058]
[0059] Here u is the normalized distance, i.e. where x is the evaluation point, s j is the sample point.
[0060] Set bandwidth h: Bandwidth is a key parameter in kernel density estimation, which determines the width of the kernel function. The larger the bandwidth, the smoother the curve; the smaller the bandwidth, the sharper the curve.
[0061] Calculate the kernel density estimate: For each evaluation point, the kernel density estimate is given by the following formula:
[0062]
[0063] Where n is the total number of samples. Each sample point s j The contribution to the evaluation point x is weighted by the kernel function, and the influence of distance is adjusted by the bandwidth h.
[0064] Kernel density estimation allows us to evaluate the local density of each sample point in a dataset, which helps us gain insight into the distribution characteristics of the data. In particular, it allows us to identify potential clustering areas in the data, i.e. areas where sample points are unusually dense. In addition, kernel density estimation can help us find density peaks, which usually represent cluster centers in the dataset.
[0065] 2) KED-KMeans clustering algorithm
[0066] K-Means++ is an improved version of the K-Means clustering algorithm. Its core improvement lies in the selection method of the initial center point to increase the efficiency and accuracy of the algorithm. Traditional clustering algorithms usually use Euclidean distance to evaluate the similarity between samples and centers. Specifically, for two points x = (x1, x2, ..., x n ) and y=(y1,y2,…,y n ) Then the Euclidean distance formula between them is:
[0067]
[0068] We improve K-Means++ and use kernel density estimation to find the density peak to initialize the cluster center. The similarity between the sample and the center is evaluated by calculating the density distance score.
[0069] Definition: For sample point si , its Euclidean distance to the cluster center c is D(s i ,c), where the minimum distance is D min (s i ,c), the maximum distance is D max (s i ,c).
[0070] Definition: For sample point s i , and define the density difference between it and the cluster center c as:
[0071] F diff (s i ,c)=F(s i )-F(c)
[0072] Where F(s i ) and F(c) are the sample points s i and the kernel density of the cluster center c. And the minimum density difference is F diff_min (s i ,c), the maximum density difference is F diff_max (s i ,c).
[0073] Normalized distance and density difference:
[0074]
[0075] Definition: Density Distance Score:
[0076] FD(s,c)=D nor (s i ,c)*λ+F nor (s i ,c)*(1-λ)
[0077] Where λ is the weight coefficient, and its range is (0, 1).
[0078] In this algorithm, we use density distance score to measure the similarity between samples and cluster centers. This method not only considers the influence of distance as the main factor on similarity, but also adds the density difference between samples as a secondary evaluation basis to the evaluation rules, which can more comprehensively measure the similarity of samples. The specific steps of KDE-KMeans algorithm are as follows:
[0079] 1) Perform multidimensional kernel density estimation on the user data set S and calculate the kernel density value F(s) of each user sample point i ).
[0080] 2) Initialize the KDE-KMeans algorithm:
[0081] 2.1) Find the sample point with the largest density value as the first cluster center.
[0082] 2.2) For each user sample s in the dataset i , calculate its distance D(s) to the nearest selected center c i ,c).
[0083] 2.3) Select a new center c i , so that That is, the probability of selection is related to D(s i ,c i ) 2 Directly proportional.
[0084] 2.4) Repeat steps 2.2)-2.3) until all k centers are selected.
[0085] 3) Cluster assignment: Each user sample point is assigned to the center point with the smallest density distance score to form k clusters.
[0086] 4) Update the center point: For each cluster, calculate the mean of all user sample points in the cluster and use this mean as the new cluster center c i , and calculate the density value F(c i ).
[0087] 5) Iteration: Repeat steps 3) and 4) until the cluster center no longer changes, or the preset number of iterations or accuracy requirements are reached.
[0088] The advantages of the present invention over the prior art are explained below in conjunction with experiments.
[0089] Experimental Example 1
[0090] Dataset: The Breast Cancer Wisconsin (Original) dataset contains 699 samples, 16 of which contain missing values and are usually deleted, so the effective samples are 683. Each sample has 9 different features extracted from the cell nucleus image, and each feature is quantified to a level of 1 to 10. The output variable of this dataset is the class label, indicating whether the user's tumor is benign (value 2) or malignant (value 4). This dataset is particularly suitable for demonstrating and testing clustering algorithms.
[0091] like Figure 1 As shown, the specific implementation steps are as follows:
[0092] Step 1: Obtain and organize user data information, use differential privacy to add noise to user data, and upload the noised data to the chain after consensus. Establish a blockchain security storage mechanism based on differential privacy.
[0093] Step 2: Obtain the on-chain data and perform normalization, and set the KDE-KMeans algorithm weight coefficient to 0.9. To ensure the consistency and fairness of the experiment, we run each algorithm 30 times on each data set and count the evaluation index values each time. Use the KED-KMeans clustering algorithm to achieve user segmentation.
[0094] The present invention is compared with the existing distance-based clustering algorithms: K-Means, K-Means++, K-Medoids and MiniBatch K-Means algorithms under the same experimental setting. Table 1 shows the statistical mean (standard deviation) results of the five algorithms on the Breast Cancer Wisconsin (Original) dataset in 30 independent runs.
[0095] Table 1: Comparison of classification results of experimental example 1
[0096]
[0097] From the experimental results, the normalized mutual information and Rand index of the method of the present invention are significantly higher than those of other algorithms, which proves that the method of the present invention is significantly better than other algorithms in terms of clustering accuracy.
[0098] Experimental Example 2
[0099] Dataset: The Heart Disease dataset contains 303 samples with 13 attributes to determine whether an individual has heart disease. This dataset is often used for teaching and research in the field of pattern recognition and machine learning.
[0100] The operation steps are similar to those in Experiment 1, and the weight coefficient of the KDE-KMeans algorithm is set to 0.9. To ensure the consistency and fairness of the experiment, we run each algorithm 30 times on each data set and count the evaluation index values each time. The KED-KMeans clustering algorithm is used to achieve user segmentation. Table 2 shows the statistical mean (standard deviation) results of the five algorithms on the Heart Disease data set in 30 independent runs.
[0101] Table 2: Comparison of classification results of Experimental Example 2
[0102]
[0103] From the experimental results, the normalized mutual information and Rand index of the method of the present invention are significantly higher than those of other algorithms, which proves that the method of the present invention is significantly better than other algorithms in terms of clustering accuracy.
[0104] Based on the same inventive concept, an embodiment of the present invention discloses a user segmentation system under blockchain privacy protection, including: a data privacy processing module, used to obtain user data, and use a differential privacy algorithm to perform noise processing on the user data; a blockchain storage module, used to upload the noisy user data to the chain after consensus; and a user segmentation module, used to obtain on-chain data, and use a KED-KMeans clustering algorithm to achieve user segmentation, the KED-KMeans clustering algorithm uses a kernel density estimation based on a Gaussian kernel function to find a density peak to initialize a cluster center, and uses a density distance score to measure the similarity between a sample and a cluster center, the density distance score is a weighted sum of a normalized distance and a density difference; the distance is a Euclidean distance, and the density difference is a kernel density difference estimated based on a Gaussian kernel function.
[0105] Based on the same inventive concept, an embodiment of the present invention discloses a computer system, including a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor. When the computer program / instruction is executed by the processor, the steps of the user segmentation method under blockchain privacy protection are implemented.
[0106] Based on the same inventive concept, an embodiment of the present invention discloses a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the steps of the user segmentation method under blockchain privacy protection are implemented.
[0107] Based on the same inventive concept, an embodiment of the present invention discloses a computer program product, including a computer program / instruction, which, when executed by a processor, implements the steps of the user segmentation method under blockchain privacy protection.
Claims
1. The user segmentation method under blockchain privacy protection is characterized by: The following steps are involved: Obtain user data and use the differential privacy algorithm to add noise to the user data; The noisy user data is uploaded to the chain after consensus; The on-chain data is obtained, and the KED-KMeans clustering algorithm is used to achieve user segmentation. The KED-KMeans clustering algorithm uses kernel density estimation based on Gaussian kernel function to find the density peak to initialize the cluster center, and uses the density distance score to measure the similarity between the sample and the cluster center. The density distance score is the weighted sum of the normalized distance and the density difference; the distance is the Euclidean distance, and the density difference is the kernel density difference estimated based on the Gaussian kernel function.
2. The user segmentation method under blockchain privacy protection according to claim 1 is characterized in that: When the differential privacy algorithm is used to perform noise processing on user data, Laplace distribution is selected to perform noise processing on the data.
3. The user segmentation method under blockchain privacy protection according to claim 1 is characterized in that: The kernel density estimation formula is: Where x is the evaluation point, s j is the sample point, h is the bandwidth, K(·) is the Gaussian kernel function, and n is the total number of samples.
4. The user segmentation method under blockchain privacy protection according to claim 1 is characterized in that: The density distance score formula is: FD(s,c)=D nor (s i ,c)*λ+F nor (s i ,c)*(1-λ) Where λ∈(0,1) is the weight coefficient, D nor (s i ,c) and F nor (s i ,c) is the sample point s i Normalized distance and density difference from cluster center c.
5. The user segmentation method under blockchain privacy protection according to claim 1 is characterized in that: In the density distance score, distance is used as the main factor affecting similarity, and density difference is used as the secondary factor affecting similarity.
6. The user segmentation method under blockchain privacy protection according to claim 1 is characterized in that: The KED-KMeans clustering algorithm comprises the following steps: (1) Perform multidimensional kernel density estimation on the user data set S and calculate each user sample point s i The kernel density value F(s i ) (2) Initialize the KDE-KMeans algorithm clustering center, including: (2.1) Find the user sample point with the largest kernel density value as the first cluster center; (2.2) For each user sample s in the user dataset i , calculate its distance D(s) to the nearest selected cluster center c i ,c); (2.3) With probability Select a new cluster center c i ; (2.4) Repeat steps (2.2) to (2.3) until all k centers are selected; (3) Each user sample point is assigned to the center point with the smallest density distance score, forming k clusters; (4) For each cluster, calculate the mean of all user sample points in the cluster and use this mean as the new cluster center c i , and calculate the kernel density value F(c i ); (5) Repeat steps (3) to (4) until the cluster center no longer changes or the preset number of iterations or accuracy requirements are reached.
7. The user segmentation system under blockchain privacy protection is characterized by: include: The data privacy processing module is used to obtain user data and perform noise processing on the user data using a differential privacy algorithm; The blockchain storage module is used to upload the noisy user data to the blockchain after consensus; And a user segmentation module, which is used to obtain on-chain data and use the KED-KMeans clustering algorithm to achieve user segmentation. The KED-KMeans clustering algorithm uses kernel density estimation based on Gaussian kernel function to find the density peak to initialize the cluster center, and uses the density distance score to measure the similarity between the sample and the cluster center. The density distance score is the weighted sum of the normalized distance and the density difference; the distance is the Euclidean distance, and the density difference is the kernel density difference estimated based on the Gaussian kernel function.
8. A computer system comprising a memory, a processor, and a computer program / instruction stored in the memory and executable on the processor, characterized in that: When the computer program / instructions are executed by the processor, the steps of the user segmentation method under blockchain privacy protection are implemented according to any one of claims 1 to 6.
9. A computer-readable storage medium storing a computer program, characterized in that: When the computer program is executed by the processor, the steps of the user segmentation method under blockchain privacy protection are implemented according to any one of claims 1 to 6.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instructions are executed by the processor, the steps of the user segmentation method under blockchain privacy protection are implemented according to any one of claims 1 to 6.