Method for estimating number of initial categories in clustering algorithm
By calculating the average vector and variance of the data, estimating the initial number of categories of the clustering algorithm, solving the problem of difficulty in estimating the number of categories in data analysis, and achieving rapid clustering and resource conservation.
Patent Information
- Application Number
- CN202411116444.1
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-08-14
- Publication Date
- 2024-11-08
AI Technical Summary
In data analysis and data mining, it is difficult for the prior art to quickly and accurately estimate the number of data categories, resulting in clustering algorithms that require multiple runs and take up a lot of time and resources.
By calculating the average vector and average distance and variance of the data, estimate the number of categories of the data, and select the closest integer value as the initial number of categories of the clustering algorithm.
This method can quickly estimate the number of data categories, avoid guessing, shorten data clustering time, reduce resource usage, and improve data analysis and mining efficiency.
Smart Images

Figure CN118916722A_ABST
Abstract
Description
Technical Field
[0001] The invention belongs to the field of data analysis and data mining, and in particular relates to a method for estimating the number of initial categories in a clustering algorithm. Background Art
[0002] In data analysis and data mining, clustering algorithms are needed to cluster or classify data in order to further analyze the implicit rules in the data.
[0003] When using a clustering algorithm, it is usually necessary to input the number of data categories into the algorithm. However, the exact number of data categories cannot be known without fully understanding the characteristics of the data. Therefore, it is usually necessary to randomly estimate the number of data categories. After clustering using the clustering algorithm, the number of data categories is estimated again based on the clustering effect, and the clustering algorithm is used again for clustering. This process is repeated many times, and the clustering algorithm needs to be run multiple times. This takes up a lot of time and resources.
[0004] If the number of data categories can be quickly estimated based on the statistical properties of the data to be clustered, and the clustering algorithm is run near the estimated number of categories, the time for data clustering can be shortened and the resources used can be reduced. At present, there is no better method for estimating the number of data categories, and the present invention is produced to meet this practical demand. Summary of the invention
[0005] 1. Technical issues to be resolved
[0006] The technical problem to be solved by the present invention is how to provide a method for estimating the number of initial categories in a clustering algorithm, so as to solve the problem of better estimating the number of data categories.
[0007] (II) Technical solution
[0008] In order to solve the above technical problem, the present invention proposes a method for estimating the number of initial categories in a clustering algorithm, the method comprising the following steps:
[0009] S1. Calculate the average vector
[0010] Calculate m n-dimensional vectors X i =(x i1 ,x i2 ,…,x in )’s average vector a=(a1,a2,…,a n ), i=1,2,…,m;
[0011] S2. Calculate the average distance and variance
[0012] Calculate m vectors X i The distance d to the mean vector a i , calculate these m distances di The mean μ and variance σ of
[0013] S3. Estimation of the number of categories of data
[0014] According to n, μ and σ, estimate the number of categories k, and select the integer value closest to k as the number of categories for the clustering algorithm.
[0015] (III) Beneficial effects
[0016] The present invention proposes a method for estimating the initial number of categories in a clustering algorithm. The present invention estimates the initial number of categories of the clustering algorithm through the attributes of the data to be clustered, thereby avoiding guessing the number of categories of the data and accelerating the clustering of the data. It can play an important role in the fields of data analysis and data mining. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] Figure 1 The present invention is a flowchart of a method for estimating the number of initial categories in a clustering algorithm. DETAILED DESCRIPTION
[0018] In order to make the purpose, content and advantages of the present invention more clear, the specific implementation methods of the present invention are further described in detail below in conjunction with the drawings and examples.
[0019] The present invention relates to a method for estimating the number of initial categories in a clustering algorithm, and more specifically, to a method for estimating the number of initial categories in a clustering algorithm by using data attributes in data analysis and data mining, so as to accelerate the data analysis and mining process.
[0020] The present invention discloses a method for estimating the number of initial categories in a clustering algorithm, comprising the following steps: (1) calculating an average vector. Calculating the average vector a of m n-dimensional vectors. (2) calculating an average distance and a variance. Calculating the distance d from the m vectors to the average vector a. i (3) Estimate the number of clustering categories. Based on n, μ and σ, estimate the number of categories k.
[0021] The present invention estimates the initial number of categories of the clustering algorithm through the attributes of the data to be clustered, avoids guessing the number of categories of the data, accelerates the clustering of the data, and can play an important role in the fields of data analysis and data mining.
[0022] The purpose of the present invention is to provide a method for estimating the number of initial categories in a clustering algorithm, thereby shortening the time of data clustering and reducing the resources used. The method comprises the following steps:
[0023] S1. Calculate the average vector
[0024] Calculate m n-dimensional vectors X i =(xi1 ,x i2 ,…,x in ), i=1,2,…,m, the average vector a=(a1,a2,…,a n ).
[0025] S2. Calculate the average distance and variance
[0026] Calculate m vectors X i The distance d to the mean vector a i , calculate these m distances d i The mean μ and variance σ of
[0027] S3. Estimation of the number of categories of data
[0028] According to n, μ and σ, estimate the number of categories k, and select the integer value closest to k as the number of categories for the clustering algorithm.
[0029] Embodiment 1:
[0030] The specific implementation methods of the present invention are described below with reference to the accompanying drawings, but are not intended to limit the specific implementation methods.
[0031] As attached Figure 1 As shown, the specific implementation process of the present invention is as follows:
[0032] (1) Calculate the average vector. Calculate m n-dimensional vectors X i =(x i1 ,x i2 ,…,x in ), i=1,2,…,m’s average vector a=(a1,a2,…,a n ).
[0033] In specific implementation, the following calculation method is used
[0034] (2) Calculate the average distance and variance. Calculate m vectors X i The distance d to the mean vector a i , calculate these m distances d i The mean μ and variance σ of .
[0035] In specific implementation, the following calculation method is used:
[0036]
[0037] (3) Estimate the number of data categories. Based on n, μ, and σ, estimate the number of categories k and select an integer value near k as the number of categories for the clustering algorithm.
[0038] When it comes to specific implementation, Take the integer closest to k as the number of categories for the clustering algorithm. In this way, the larger the average distance of the data and the smaller the variance, the more dispersed the data is and the more categories it needs to be divided into.
[0039] Among them, X i It is the input data of the clustering algorithm, and the input data is unified into n-dimensional data.
[0040] Wherein, after S3, the following step further includes: converting the n-dimensional vector X i The number of categories of the clustering algorithm obtained by S3 is input into the clustering algorithm, and clustering is performed using the clustering algorithm.
[0041] Among them, according to the clustering effect, the method is used again to estimate the number of categories, and the clustering algorithm is used again for clustering.
[0042] Embodiment 2:
[0043] A method for estimating the number of initial categories in a clustering algorithm, the method comprising the following steps:
[0044] (1) Calculate the mean vector.
[0045] (2) Calculate the average distance and variance.
[0046] (3) Estimate the number of data categories.
[0047] Furthermore, in step (3) of the method:
[0048] calculate n is the dimension of the data, μ is the average distance of each vector to the average vector, and σ is the variance of the distance of each vector to the average vector. The number of categories of the clustering algorithm is the integer closest to k.
[0049] Technical effect: The present invention estimates the initial number of categories of the clustering algorithm through the attributes of the data to be clustered, avoids guessing the number of categories of the data, accelerates the clustering of the data, and can play an important role in the fields of data analysis and data mining.
[0050] The above is only a preferred embodiment of the present invention. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the technical principles of the present invention. These improvements and modifications should also be regarded as the scope of protection of the present invention.
Claims
1. A method for estimating the number of initial categories in a clustering algorithm, characterized in that: The method comprises the following steps: S1. Calculate the average vector Calculate m n-dimensional vectors X i =(x i1 ,x i2 ,…,x in )’s average vector a=(a1,a2,…,a n ), i=1,2,…,m; S2. Calculate the average distance and variance Calculate m vectors X i The distance d to the mean vector a i , calculate these m distances d i The mean μ and variance σ of S3. Estimation of the number of categories of data According to n, μ and σ, estimate the number of categories k, and select the integer value closest to k as the number of categories for the clustering algorithm.
2. The method for estimating the number of initial categories in a clustering algorithm according to claim 1, characterized in that: In S1, the average vector is calculated as follows:
3. The method for estimating the number of initial categories in a clustering algorithm according to claim 2, characterized in that: In S2, 4. The method for estimating the number of initial categories in a clustering algorithm according to claim 3, characterized in that: In S2, 5. The method for estimating the number of initial categories in a clustering algorithm according to claim 4, characterized in that: In S2, 6. The method for estimating the number of initial categories in a clustering algorithm according to claim 5, characterized in that: In S3, Take the integer closest to k as the number of categories for the clustering algorithm.
7. The method for estimating the number of initial categories in a clustering algorithm according to claim 6, characterized in that: X i It is the input data of the clustering algorithm, and the input data is unified into n-dimensional data.
8. The method for estimating the number of initial categories in a clustering algorithm according to claim 6, characterized in that: The step S3 also includes: converting the n-dimensional vector X i The number of categories of the clustering algorithm obtained by S3 is input into the clustering algorithm, and clustering is performed using the clustering algorithm.
9. The method for estimating the number of initial categories in a clustering algorithm according to claim 8, characterized in that: According to the clustering effect, this method is used again to estimate the number of categories, and the clustering algorithm is used again for clustering.
10. The method for estimating the number of initial categories in a clustering algorithm according to claim 6, characterized in that: The larger the average distance of the data and the smaller the variance, the more dispersed the data is and the more categories it needs to be divided into.
