Unsupervised clustering method, device, electronic device and medium
By screening and eliminating noisy data and iteratively adjusting the clustering center, the K-means algorithm solves the problems of clustering result accuracy and noise processing, and improves the stability and accuracy of data clustering.
Patent Information
- Application Number
- CN202111189639.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-10-13
- Publication Date
- 2024-10-15
- Estimated Expiration
- 2041-10-13
AI Technical Summary
The K-means algorithm is easily affected by the initial clustering center during the data clustering process, and cannot effectively remove noisy data, resulting in inaccurate clustering results.
By obtaining the data set to be clustered and converting it into a data point set, the first cluster center is selected to calculate the Euclidean distance, abnormal noise points are filtered out, noise data points that do not meet the preset rules are eliminated, the second cluster center is randomly set, and the process is re- Divide the data into categories and continue iterating until the cluster center meets the preset conditions.
It improves the accuracy of data clustering, reduces the influence of the initial clustering center, avoids the interference of noisy data on the clustering results, and achieves more stable clustering results.
Smart Images

Figure CN113869455B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the field of artificial intelligence technology, and in particular to an unsupervised clustering method, device, electronic device and computer-readable storage medium. Background Art
[0002] The K-means algorithm is a commonly used clustering algorithm based on Euclidean distance. The distance between targets is calculated through Euclidean distance. The closer the distance, the greater the similarity. Finally, targets with similarity greater than a certain threshold are clustered together to achieve data clustering.
[0003] However, the K-means algorithm is very susceptible to the influence of the initial cluster center points in practical applications. For the same data, the clustering results are very different due to the different initial cluster center points set. In addition, the K-means algorithm cannot eliminate the noise data in the data, and the noise data will also interfere with the clustering results, making the clustering results inaccurate. Summary of the invention
[0004] The present invention provides an unsupervised clustering method, device, electronic device and computer-readable storage medium, the main purpose of which is to improve the accuracy of data clustering.
[0005] To achieve the above object, the present invention provides an unsupervised clustering method, comprising:
[0006] Acquire a data set to be clustered, and convert the data set to be clustered into a data point set;
[0007] Selecting a first cluster center from the data point set, calculating the Euclidean distance from each data point in the data point set to the first cluster center, and obtaining an abnormal noise point set from the data point set according to the Euclidean distance;
[0008] The noise data points that do not meet the preset data rules are removed from the abnormal noise point set to obtain a denoised data point set;
[0009] At least two second cluster centers are randomly set for the denoised data point set, and each denoised data point in the denoised data point set is reclassified by using the second cluster centers to obtain a plurality of clustered data subsets;
[0010] The cluster centers of the denoised data point set are recalculated according to the multiple cluster data subsets, and the respective denoised data points in the denoised data point set are reclassified into data classes according to the recalculated cluster centers to obtain multiple new cluster data subsets. The operation of recalculating the cluster centers according to the multiple cluster data subsets is performed again until the cluster centers of the denoised data point set meet preset conditions to obtain the final cluster data.
[0011] Optionally, acquiring an abnormal noise point set from the data point set according to the Euclidean distance includes:
[0012] Obtaining an outlier search radius of each of the data points, where the outlier search radius of each of the data points is the product of the Euclidean distance from each of the data points to the first cluster center and a preset ratio;
[0013] Determine whether there are other data points within the outlier search radius of each of the data points;
[0014] If there are other data points within the abnormal point search radius of the first data point among the data points, it is determined that the first data point is not an abnormal noise point;
[0015] If there are no other data points within the abnormal point search radius of the second data point among the data points, then the second data point is determined to be an abnormal noise point;
[0016] All the second data points are aggregated to obtain the abnormal noise point set.
[0017] Optionally, the using the second cluster center to reclassify each denoised data point in the denoised data point set into a data class to obtain a plurality of clustered data subsets, including:
[0018] respectively calculating the Euclidean distance between each denoised data point in the denoised data point set and a plurality of the second cluster centers;
[0019] Each of the denoised data points is divided into a second cluster center corresponding to the minimum Euclidean distance, to obtain a plurality of cluster data subsets.
[0020] Optionally, recalculating the cluster center of the denoised data point set according to the plurality of clustered data subsets comprises:
[0021] Obtaining the horizontal coordinates and vertical coordinates of all data points in the plurality of clustered data subsets;
[0022] The average values of the horizontal coordinates and the vertical coordinates of all the data points in the plurality of cluster data subsets are calculated to obtain the cluster center.
[0023] Optionally, converting the data set to be clustered into a data point set includes:
[0024] Obtaining the data type of the data to be clustered in the data set to be clustered;
[0025] The data to be clustered in the data set to be clustered is mapped to a plane coordinate system according to the data type to obtain the data point set.
[0026] Optionally, the randomly setting at least two second cluster centers for the denoised data point set includes:
[0027] Constructing a sum of squared errors formula based on the denoised data point set;
[0028] Constructing an error sum image in a plane rectangular coordinate system according to the square error sum formula;
[0029] The inflection point of the error and the image is obtained, the horizontal coordinate corresponding to the inflection point is used as the number of the second cluster centers, and a plurality of points are randomly set as the second cluster centers according to the number of the second cluster centers.
[0030] Optionally, the square error sum formula is:
[0031]
[0032] Where SSE is the sum of square errors of all the denoised data points, C i represents the i-th cluster center in the denoised data point set, and P is C i Sample points in m i C i The mean of all sample points in , where the sample points are the denoised data points being used to calculate the sum of squared errors, and k is a positive integer.
[0033] In order to solve the above problems, the present invention also provides an unsupervised clustering device, which comprises:
[0034] A data conversion module, used to obtain a data set to be clustered, and convert the data set to be clustered into a data point set;
[0035] A noise point acquisition module, used for selecting a first cluster center from the data point set, calculating the Euclidean distance from each data point in the data point set to the first cluster center, and acquiring an abnormal noise point set from the data point set according to the Euclidean distance;
[0036] A data elimination module is used to eliminate the noise data points that do not meet the preset data rules in the abnormal noise point set to obtain a denoised data point set;
[0037] A data clustering module, used to randomly set at least two second cluster centers for the denoised data point set, and use the second cluster centers to reclassify the denoised data points in the denoised data point set into data classes to obtain a plurality of clustered data subsets;
[0038] A data re-clustering module is used to recalculate the cluster center of the denoised data point set based on the multiple clustered data subsets, and then re-divide the denoised data points in the denoised data point set into data classes based on the recalculated cluster centers to obtain multiple new clustered data subsets, and again perform the operation of recalculating the cluster center based on the multiple clustered data subsets until the cluster center of the denoised data point set meets the preset conditions to obtain the final clustered data.
[0039] In order to solve the above problem, the present invention further provides an electronic device, the electronic device comprising:
[0040] at least one processor; and,
[0041] a memory communicatively connected to the at least one processor; wherein,
[0042] The memory stores a computer program executable by the at least one processor, and the computer program is executed by the at least one processor to enable the at least one processor to perform the unsupervised clustering method as described above.
[0043] In order to solve the above problems, the present invention also provides a computer-readable storage medium, including a data storage area and a program storage area, the data storage area stores created data, and the program storage area stores a computer program; wherein, when the computer program is executed by a processor, the unsupervised clustering method as described above is implemented.
[0044] In an embodiment of the present invention, the acquired clustering data set is converted into a data point set, a first cluster center is set in the data point set, abnormal noise points are found, and the abnormal noise points are eliminated in combination with preset data rules to obtain a denoised data set, thereby avoiding interference of noise data on the clustering results. Then, a second cluster center is reset, and the data class is re-divided using the second cluster center to obtain cluster data, and the cluster data is continuously iterated to obtain the final cluster data when the cluster center meets the preset conditions. In the process of continuous iteration, the cluster center is recalculated based on the denoised data set to reduce the influence of the initial cluster center. Therefore, the embodiment of the present invention can achieve the purpose of improving the data clustering effect. BRIEF DESCRIPTION OF THE DRAWINGS
[0045] Figure 1 A schematic diagram of a flow chart of an unsupervised clustering method provided by an embodiment of the present invention;
[0046] Figure 2 A detailed flow chart of a step in an unsupervised clustering method is provided for one embodiment of the present invention;
[0047] Figure 3 An example diagram of errors and images provided by an embodiment of the present invention;
[0048] Figure 4 A schematic diagram of a module of an unsupervised clustering device provided by an embodiment of the present invention;
[0049] Figure 5 A schematic diagram of the internal structure of an electronic device for implementing an unsupervised clustering method provided by an embodiment of the present invention;
[0050] The realization of the purpose, functional features and advantages of the present invention will be further explained in conjunction with embodiments and with reference to the accompanying drawings. DETAILED DESCRIPTION
[0051] It should be understood that the specific embodiments described herein are only used to explain the present invention, and are not used to limit the present invention.
[0052] The embodiment of the present application provides an unsupervised clustering method. The execution subject of the unsupervised clustering method includes but is not limited to at least one of the electronic devices such as the server, the terminal, etc. that can be configured to execute the method provided by the embodiment of the present application. Among them, the server can be an independent server, or it can be a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content distribution networks (Content Delivery Network, CDN), and big data and artificial intelligence platforms. In other words, the unsupervised clustering method can be executed by software or hardware installed on a terminal device or a server device, and the software can be a blockchain platform. The server includes but is not limited to: a single server, a server cluster, a cloud server or a cloud server cluster, etc.
[0053] Reference Figure 1 FIG. 1 is a flow chart of an unsupervised clustering method provided by an embodiment of the present invention. In this embodiment, the unsupervised clustering method includes:
[0054] S1. Obtain a data set to be clustered, and convert the data set to be clustered into a data point set.
[0055] In an embodiment of the present invention, the data set to be clustered is a data set that needs to be clustered. By clustering the data to be clustered, the data connection between the data to be clustered can be found, and the data to be clustered can be divided into a preset number of multiple data classes, wherein the data in each data class are data whose similarity is greater than a preset threshold.
[0056] For example, the data set to be clustered contains text words. By clustering these text words, text words with similar semantics are divided into one category, and finally clusters of multiple text words are obtained.
[0057] Specifically, the data point set is a set of data points converted from the data to be clustered, and the data points are coordinate points of the data to be clustered in the plane coordinate system after the data is converted. By converting the data to be clustered into data points, the data can be displayed vividly, and the connection between the data can be intuitively shown, which is convenient for clustering calculation.
[0058] In the embodiment of the present invention, the step of converting the to-be-clustered data set into a data point set includes:
[0059] Obtaining the data type of the data to be clustered in the data set to be clustered;
[0060] The data to be clustered in the data set to be clustered is mapped to a plane coordinate system according to the data type to obtain the data point set.
[0061] In an embodiment of the present invention, the data type is the data category to which the data to be clustered belongs, such as a text data category, an image data category, etc. The plane coordinate system is used to represent the position of a data point set in a plane to facilitate subsequent data clustering.
[0062] In an embodiment of the present invention, if the data to be clustered is text data, the text data will be vectorized to obtain the vectorized text, and the vectorized text will be mapped to a plane coordinate system, wherein the text data can be vectorized by a bag of words model in a word2vec vectorization algorithm.
[0063] In another optional embodiment, if the data to be clustered is two-dimensional point cloud data, the two-dimensional point cloud data can be directly mapped to a plane coordinate system to obtain a data point set.
[0064] S2. Select a first cluster center from the data point set, calculate the Euclidean distance from each data point in the data point set to the first cluster center, and obtain an abnormal noise point set from the data point set according to the Euclidean distance.
[0065] In the embodiment of the present invention, the first cluster center is a randomly set center point, and there is only one of them. The abnormal noise point can be determined by calculating the Euclidean distance between the first cluster center and each data point in the data point set.
[0066] In the embodiment of the present invention, the abnormal noise point is a data point without clustering value. Specifically, the coordinate distance of the abnormal noise point to the coordinate distance of the nearest data point is greater than a preset threshold.
[0067] In the embodiment of the present invention, since the data points in the data point set are all data points in a two-dimensional coordinate system, the Euclidean distance between the first cluster center and each data point in the data point set is calculated using the following Euclidean distance formula.
[0068] Furthermore, the Euclidean distance calculation formula is:
[0069]
[0070] Wherein, the d(C i ,E) is the data point C i The Euclidean distance to the first cluster center E, c x and e x are data points C i and the x-axis coordinate of the first cluster center E, c y and e y are data points C i And the y-axis coordinate of the first cluster center E.
[0071] See also Figure 2 , Figure 2 A detailed flowchart of a step in an unsupervised clustering method is provided for one embodiment of the present invention.
[0072] In the embodiment of the present invention, the step of obtaining an abnormal noise point set from the data point set according to the Euclidean distance includes:
[0073] S201, obtaining an outlier search radius of each of the data points, where the outlier search radius of each of the data points is the product of the Euclidean distance from each of the data points to the first cluster center and a preset ratio;
[0074] S202, determining whether there are other data points within the outlier search radius of each of the data points;
[0075] S203: if there are other data points within the abnormal point search radius of the first data point among the data points, determining that the first data point is not an abnormal noise point;
[0076] S204: if there are no other data points within the abnormal point search radius of the second data point among the data points, determine that the second data point is an abnormal noise point;
[0077] S205: Summarize all the second data points to obtain the abnormal noise point set.
[0078] In the embodiment of the present invention, interference from meaningless data can be avoided by screening out the abnormal noise points.
[0079] In an embodiment of the present invention, an outlier search radius is constructed by multiplying the Euclidean distance from each data point to the first cluster center by a preset ratio, and a different outlier search radius can be determined for each data point according to different situations, that is, the farther the data point is from the first cluster center, the larger the search range determined, and the closer the data point is to the first cluster center, the smaller the search range determined.
[0080] In other embodiments of the present invention, a preset fixed distance may be used as an outlier search radius to search around the data point.
[0081] S3. Remove the noise data points that do not meet the preset data rules from the abnormal noise point set to obtain denoised data set points.
[0082] In the embodiment of the present invention, the data rule is used to determine whether data points in the noise data set need to be removed.
[0083] In the embodiment of the present invention, the data to be clustered corresponding to the abnormal noise points can be acquired through the abnormal noise point set to obtain a noise data set.
[0084] In an embodiment of the present invention, the data rule may vary according to the business scenario of the data to be clustered. For example, in the business scenario where a fund agent holds funds on behalf of a financial investment client, the data rule is that only one set of data can be provided for each financial investment client. If a financial investment client is scanned by five or more agents within a month, only one set of data obtained by scanning the code will be retained, and all the rest will be deleted.
[0085] In the embodiment of the present invention, the denoised data point set is a data point set after removing the noise data points that do not meet the preset data rules, that is, all the data points in the denoised data point set are data points used for subsequent data clustering.
[0086] Furthermore, if the data that does not meet the rules is directly searched from the data set to be clustered according to the preset rules, the amount of calculation is large and occupies computing resources, so preliminary screening is performed by setting the first cluster center.
[0087] S4. Randomly set at least two second cluster centers for the denoised data point set, and use the second cluster centers to reclassify the denoised data points in the denoised data point set into data classes to obtain multiple clustered data subsets.
[0088] In the embodiment of the present invention, there are at least two second cluster centers, and the number of the second cluster centers can be obtained by using the silhouette coefficient method.
[0089] Furthermore, the step of randomly setting at least two second cluster centers for the denoised data point set comprises:
[0090] Constructing a sum of squared errors formula based on the denoised data point set;
[0091] Constructing an error sum image in a plane rectangular coordinate system according to the square error sum formula;
[0092] The inflection point of the error and the image is obtained, the horizontal coordinate corresponding to the inflection point is used as the number of the second cluster centers, and a plurality of points are randomly set as the second cluster centers according to the number of the second cluster centers.
[0093] Specifically, the square error sum formula is:
[0094]
[0095] Among them, SSE is the sum of square errors of all denoised data points, indicating the quality of clustering effect, C i represents the i-th cluster center in the denoised data point set, and P is C i Sample points in m i C i The mean of all sample points in , k is a positive integer.
[0096] Specifically, the sample points are the denoised data points being used to calculate the sum of squared errors.
[0097] See also Figure 3 , Figure 3 Figure 2 is an example of an error and image.
[0098] exist Figure 3 In the figure, the horizontal axis is the K value, where the K value is a positive integer that gradually increases from 1, and the vertical axis is the error sum.
[0099] In the embodiment of the present invention, the second cluster center is used to re-divide the denoised data points in the denoised data point set into data classes to obtain multiple clustered data subsets, including:
[0100] respectively calculating the Euclidean distance between each denoised data point in the denoised data point set and a plurality of the second cluster centers;
[0101] Each of the denoised data points is divided into a second cluster center corresponding to the minimum Euclidean distance, to obtain a plurality of cluster data subsets.
[0102] For example, there are five data points a, b, c, d, and e, and there are two second cluster centers A and B. The Euclidean distances from the five data points a, b, c, d, and e to the two cluster centers will be calculated. If the Euclidean distance from the data point a to the second cluster center A is less than the distance from the data point a to the second cluster center B, then the data point a will be divided into the second cluster center A. Repeat the above operation for the remaining data points b, c, d, and e. Two cluster data subsets can be obtained, namely, the cluster data subset with the second cluster center A as the cluster center and the cluster data subset with the second cluster center B as the cluster.
[0103] In the embodiment of the present invention, the divided data class is a set of data points of one category, which is represented in a coordinate system as a set of all data points whose distance is less than a preset threshold.
[0104] S5. Recalculate the cluster centers of the denoised data point set according to the multiple cluster data subsets, and then re-divide the denoised data points in the denoised data point set into data classes according to the recalculated cluster centers to obtain multiple new cluster data subsets, and perform the operation of recalculating the cluster centers according to the multiple cluster data subsets again until the cluster centers of the denoised data point set meet the preset conditions to obtain the final cluster data.
[0105] In the embodiment of the present invention, the preset condition may be that the cluster center of the denoised data point set no longer changes, that is, after the operation of continuously calculating the cluster center, a stable state is finally reached.
[0106] In the embodiment of the present invention, re-determining the cluster center can further adjust the cluster data so that the cluster center is combined with the characteristics of the data points in the data cluster.
[0107] In other embodiments of the present invention, other termination conditions may be set, for example, the Euclidean distance between the center point of the cluster center and the original center point of the last change is less than a preset threshold.
[0108] In the embodiment of the present invention, the recalculating the cluster center of the denoised data point set according to the plurality of clustered data subsets includes:
[0109] Obtaining the horizontal coordinates and vertical coordinates of all data points in the plurality of clustered data subsets;
[0110] The average values of the horizontal coordinates and the vertical coordinates of all the data points in the plurality of cluster data subsets are calculated to obtain the cluster center.
[0111] In an embodiment of the present invention, the acquired clustering data set is converted into a data point set, a first cluster center is set in the data point set, abnormal noise points are found, and the abnormal noise points are eliminated in combination with preset data rules to obtain a denoised data set, thereby avoiding interference of noise data on the clustering results. Then, a second cluster center is reset, and the data class is re-divided using the second cluster center to obtain cluster data, and the cluster data is continuously iterated to obtain the final cluster data when the cluster center meets the preset conditions. In the process of continuous iteration, the cluster center is recalculated based on the denoised data set to reduce the influence of the initial cluster center. Therefore, the embodiment of the present invention can achieve the purpose of improving the data clustering effect.
[0112] like Figure 4 , which is a schematic diagram of a module of the unsupervised clustering device of the present invention.
[0113] The unsupervised clustering device 100 of the present invention can be installed in an electronic device. According to the functions to be implemented, the unsupervised clustering device can include a data conversion module 101, a noise point acquisition module 102, a data removal module 103, a data clustering module 104 and a data re-clustering module 105. The module of the present invention can also be called a unit, which refers to a series of computer program segments that can be executed by an electronic device processor and can complete fixed functions, which are stored in the memory of the electronic device.
[0114] In this embodiment, the functions of each module / unit are as follows:
[0115] The data conversion module 101 is used to obtain a data set to be clustered and convert the data set to be clustered into a data point set;
[0116] A noise point acquisition module 102 is used to select a first cluster center from the data point set, calculate the Euclidean distance from each data point in the data point set to the first cluster center, and acquire an abnormal noise point set from the data point set according to the Euclidean distance;
[0117] A data elimination module 103 is used to eliminate the noise data points that do not meet the preset data rules in the abnormal noise point set to obtain a denoised data point set;
[0118] A data clustering module 104 is used to randomly set at least two second cluster centers for the denoised data point set, and use the second cluster centers to reclassify each denoised data point in the denoised data point set into a data class to obtain a plurality of clustered data subsets;
[0119] The data re-clustering module 105 is used to recalculate the cluster center of the denoised data point set based on the multiple clustered data subsets, and then re-divide the denoised data points in the denoised data point set into data classes based on the recalculated cluster centers to obtain multiple new clustered data subsets, and again perform the operation of recalculating the cluster center based on the multiple clustered data subsets until the cluster center of the denoised data point set meets the preset conditions to obtain the final clustered data.
[0120] In detail, each module described in the unsupervised clustering device 100 in the embodiment of the present invention is used in the same manner as described above. Figure 1 to Figure 2 The unsupervised clustering method described in the previous section is similar to the technical means and can produce the same technical effects, so I will not go into details here.
[0121] like Figure 5 FIG. 1 is a schematic diagram of the structure of an electronic device for implementing the unsupervised clustering method of the present invention.
[0122] The electronic device may include a processor 10 , a memory 11 , a communication bus 12 , and a communication interface 13 , and may also include a computer program stored in the memory 11 and executable on the processor 10 , such as an unsupervised clustering program.
[0123] In some embodiments, the processor 10 may be composed of an integrated circuit, for example, a single packaged integrated circuit, or a plurality of packaged integrated circuits with the same or different functions, including one or more central processing units (CPUs), microprocessors, digital processing chips, graphics processors, and combinations of various control chips. The processor 10 is the control core (ControlUnit) of the electronic device, and uses various interfaces and lines to connect various components of the entire electronic device, and executes or executes programs or modules stored in the memory 11 (for example, executing unsupervised clustering programs, etc.), and calls data stored in the memory 11 to execute various functions of the electronic device and process data.
[0124] The memory 11 includes at least one type of readable storage medium, and the readable storage medium includes a flash memory, a mobile hard disk, a multimedia card, a card-type memory (for example, an SD or DX memory, etc.), a magnetic memory, a disk, an optical disk, etc. In some embodiments, the memory 11 may be an internal storage unit of an electronic device, such as a mobile hard disk of the electronic device. In other embodiments, the memory 11 may also be an external storage device of an electronic device, such as a plug-in mobile hard disk, a smart memory card (Smart Media Card, SMC), a secure digital (Secure Digital, SD) card, a flash card (Flash Card), etc. equipped on the electronic device. Further, the memory 11 may also include both an internal storage unit of the electronic device and an external storage device. The memory 11 can be used not only to store application software and various types of data installed in the electronic device, such as the code of an unsupervised clustering program, but also to temporarily store data that has been output or is to be output.
[0125] The communication bus 12 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. The bus is configured to realize connection and communication between the memory 11 and at least one processor 10, etc.
[0126] The communication interface 13 is used for communication between the above-mentioned electronic device and other devices, including a network interface and a user interface. Optionally, the network interface may include a wired interface and / or a wireless interface (such as a WI-FI interface, a Bluetooth interface, etc.), which is generally used to establish a communication connection between the electronic device and other electronic devices. The user interface may be a display (Display), an input unit (such as a keyboard (Keyboard)), and optionally, the user interface may also be a standard wired interface, a wireless interface. Optionally, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, and an OLED (Organic Light-Emitting Diode, organic light-emitting diode) touch device, etc. Among them, the display may also be appropriately referred to as a display screen or a display unit, which is used to display information processed in the electronic device and to display a visual user interface.
[0127] Figure 5 Only an electronic device with components is shown, and those skilled in the art will understand that Figure 5The structure shown does not constitute a limitation on the electronic device, and may include fewer or more components than shown in the figure, or combine certain components, or arrange the components differently.
[0128] For example, although not shown, the electronic device may also include a power source (such as a battery) for supplying power to each component. Preferably, the power source may be logically connected to the at least one processor 10 through a power management device, so that the power management device can realize functions such as charging management, discharging management, and power consumption management. The power source may also include one or more DC or AC power sources, recharging devices, power failure detection circuits, power converters or inverters, power status indicators, and other arbitrary components. The electronic device may also include a variety of sensors, Bluetooth modules, Wi-Fi modules, etc., which will not be repeated here.
[0129] It should be understood that the embodiment is for illustration only and the scope of the patent application is not limited to this structure.
[0130] The unsupervised clustering program stored in the memory 11 in the electronic device is a combination of multiple computer programs. When running in the processor 10, it can achieve:
[0131] Acquire a data set to be clustered, and convert the data set to be clustered into a data point set;
[0132] Selecting a first cluster center from the data point set, calculating the Euclidean distance from each data point in the data point set to the first cluster center, and obtaining an abnormal noise point set from the data point set according to the Euclidean distance;
[0133] The noise data points that do not meet the preset data rules are removed from the abnormal noise point set to obtain a denoised data point set;
[0134] At least two second cluster centers are randomly set for the denoised data point set, and each denoised data point in the denoised data point set is reclassified by using the second cluster centers to obtain a plurality of clustered data subsets;
[0135] The cluster centers of the denoised data point set are recalculated according to the multiple cluster data subsets, and the respective denoised data points in the denoised data point set are reclassified into data classes according to the recalculated cluster centers to obtain multiple new cluster data subsets. The operation of recalculating the cluster centers according to the multiple cluster data subsets is performed again until the cluster centers of the denoised data point set meet preset conditions to obtain the final cluster data.
[0136] Specifically, the specific implementation method of the processor 10 for the above computer program can refer to Figure 1 The description of the relevant steps in the corresponding embodiments will not be repeated here.
[0137] Furthermore, if the module / unit integrated in the electronic device is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a non-volatile computer-readable storage medium. The computer-readable storage medium can be volatile or non-volatile. For example, the computer-readable medium can include: any entity or device capable of carrying the computer program code, a recording medium, a USB flash drive, a mobile hard disk, a magnetic disk, an optical disk, a computer memory, and a read-only memory (ROM).
[0138] The present invention further provides 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 of an electronic device, the computer program can implement:
[0139] Acquire a data set to be clustered, and convert the data set to be clustered into a data point set;
[0140] Selecting a first cluster center from the data point set, calculating the Euclidean distance from each data point in the data point set to the first cluster center, and obtaining an abnormal noise point set from the data point set according to the Euclidean distance;
[0141] The noise data points that do not meet the preset data rules are removed from the abnormal noise point set to obtain a denoised data point set;
[0142] At least two second cluster centers are randomly set for the denoised data point set, and each denoised data point in the denoised data point set is reclassified by using the second cluster centers to obtain a plurality of clustered data subsets;
[0143] The cluster centers of the denoised data point set are recalculated according to the multiple cluster data subsets, and the respective denoised data points in the denoised data point set are reclassified into data classes according to the recalculated cluster centers to obtain multiple new cluster data subsets. The operation of recalculating the cluster centers according to the multiple cluster data subsets is performed again until the cluster centers of the denoised data point set meet preset conditions to obtain the final cluster data.
[0144] In the several embodiments provided by the present invention, it should be understood that the disclosed devices, apparatuses and methods can be implemented in other ways. For example, the device embodiments described above are only illustrative, for example, the division of the modules is only a logical function division, and there may be other division methods in actual implementation.
[0145] The modules described as separate components may or may not be physically separated, and the components shown as modules may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0146] In addition, each functional module in each embodiment of the present invention may be integrated into one processing unit, each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of hardware plus software functional modules.
[0147] It is obvious to those skilled in the art that the present invention is not limited to the details of the above exemplary embodiments, and that the present invention can be implemented in other specific forms without departing from the spirit or essential characteristics of the present invention.
[0148] Therefore, no matter from which point of view, the embodiments should be regarded as illustrative and non-restrictive, and the scope of the present invention is limited by the appended claims rather than the above description, so it is intended that all changes falling within the meaning and scope of the equivalent elements of the claims are included in the present invention. Any attached figure mark in the claims should not be regarded as limiting the claims involved.
[0149] The blockchain referred to in this invention is a new application mode of computer technologies such as distributed data storage, peer-to-peer transmission, consensus mechanism, encryption algorithm, etc. Blockchain is essentially a decentralized database, a string of data blocks generated by cryptographic methods. Each data block contains a batch of network transaction information, which is used to verify the validity of its information (anti-counterfeiting) and generate the next block. Blockchain can include the underlying blockchain platform, platform product service layer, and application service layer.
[0150] The embodiments of the present application can acquire and process relevant data based on artificial intelligence technology. Among them, artificial intelligence (AI) is the theory, method, technology and application system that uses digital computers or machines controlled by digital computers to simulate, extend and expand human intelligence, perceive the environment, acquire knowledge and use knowledge to obtain the best results.
[0151] In addition, it is clear that the word "comprising" does not exclude other units or steps, and the singular does not exclude the plural. Multiple units or devices stated in the system claim can also be implemented by one unit or device through software or hardware. The second and other words are used to indicate names, but not to indicate any particular order.
[0152] Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention rather than to limit it. Although the present invention has been described in detail with reference to the preferred embodiments, those skilled in the art should understand that the technical solution of the present invention can be modified or replaced by equivalents without departing from the spirit and scope of the technical solution of the present invention.
Claims
1. An unsupervised clustering method, characterized in that: The method comprises: Acquire a data set to be clustered, acquire a data type of the data to be clustered in the data set to be clustered, and map the data to be clustered in the data set to be clustered to a plane coordinate system according to the data type to obtain the data point set, wherein the data type is a data category to which the data to be clustered belongs, including text data or image data; Selecting a first cluster center from the data point set, calculating the Euclidean distance from each data point in the data point set to the first cluster center, and obtaining an abnormal noise point set from the data point set according to the Euclidean distance, wherein there is only one first cluster center; The noise data points that do not meet the preset data rules are removed from the abnormal noise point set to obtain a denoised data point set; At least two second cluster centers are randomly set for the denoised data point set, and each denoised data point in the denoised data point set is reclassified by using the second cluster centers to obtain a plurality of clustered data subsets; Recalculating the cluster centers of the denoised data point set according to the plurality of clustered data subsets, and then reclassifying the denoised data points in the denoised data point set into data classes according to the recalculated cluster centers to obtain a plurality of new clustered data subsets, and performing the operation of recalculating the cluster centers according to the plurality of clustered data subsets again, and obtaining the final clustered data when the cluster centers of the denoised data point set no longer change; Wherein, obtaining the abnormal noise point set from the data point set according to the Euclidean distance includes: obtaining the abnormal point search radius of each of the data points, wherein the abnormal point search radius of each of the data points is the product of the Euclidean distance from each of the data points to the first cluster center and a preset ratio; judging whether there are other data points within the abnormal point search radius of each of the data points; if there are other data points within the abnormal point search radius of the first data point among the data points, determining that the first data point is not an abnormal noise point; if there are no other data points within the abnormal point search radius of the second data point among the data points, determining that the second data point is an abnormal noise point; and summarizing all the second data points to obtain the abnormal noise point set; The recalculating the cluster center of the denoised data point set based on the multiple cluster data subsets includes: obtaining the horizontal coordinates and vertical coordinates of all the data points in the multiple cluster data subsets; calculating the average values of the horizontal coordinates and vertical coordinates of all the data points in the multiple cluster data subsets to obtain the cluster center.
2. The unsupervised clustering method according to claim 1, characterized in that: The method of reclassifying each denoised data point in the denoised data point set into a data class by using the second cluster center to obtain a plurality of clustered data subsets includes: respectively calculating the Euclidean distance between each denoised data point in the denoised data point set and a plurality of the second cluster centers; Each of the denoised data points is divided into a second cluster center corresponding to the minimum Euclidean distance, to obtain a plurality of cluster data subsets.
3. The unsupervised clustering method according to any one of claims 1 to 2, characterized in that: The step of randomly setting at least two second cluster centers for the denoised data point set comprises: Constructing a sum of squared errors formula based on the denoised data point set; Constructing an error sum image in a plane rectangular coordinate system according to the square error sum formula; The inflection point of the error and the image is obtained, the horizontal coordinate corresponding to the inflection point is used as the number of the second cluster centers, and a plurality of points are randomly set as the second cluster centers according to the number of the second cluster centers.
4. The unsupervised clustering method according to claim 3, characterized in that: The square error sum formula is: Wherein, SSE is the sum of square errors of all the denoised data points, represents the i-th cluster center in the denoised data point set, and P is The sample points in for The mean of all sample points in , where the sample points are the denoised data points being used to calculate the sum of squared errors, and k is a positive integer.
5. An unsupervised clustering device, used to implement the unsupervised clustering method according to any one of claims 1 to 4, characterized in that: The device comprises: A data conversion module, used to obtain a data set to be clustered, obtain a data type of the data to be clustered in the data set to be clustered, and map the data to be clustered in the data set to be clustered to a plane coordinate system according to the data type to obtain the data point set, wherein the data type is a data category to which the data to be clustered belongs, including text data or image data; A noise point acquisition module, used for selecting a first cluster center from the data point set, calculating the Euclidean distance from each data point in the data point set to the first cluster center, and acquiring an abnormal noise point set from the data point set according to the Euclidean distance, wherein there is one and only one first cluster center; A data elimination module is used to eliminate the noise data points that do not meet the preset data rules in the abnormal noise point set to obtain a denoised data point set; A data clustering module, used to randomly set at least two second cluster centers for the denoised data point set, and use the second cluster centers to reclassify the denoised data points in the denoised data point set into data classes to obtain a plurality of clustered data subsets; A data re-clustering module is used to recalculate the cluster centers of the denoised data point set based on the multiple clustered data subsets, and then re-divide the denoised data points in the denoised data point set into data classes based on the recalculated cluster centers to obtain multiple new clustered data subsets, and again perform the operation of recalculating the cluster centers based on the multiple clustered data subsets. When the cluster centers of the denoised data point set no longer change, the final clustered data is obtained.
6. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores a computer program executable by the at least one processor, wherein the computer program is executed by the at least one processor so as to enable the at least one processor to perform the unsupervised clustering method according to any one of claims 1 to 4.
7. A computer-readable storage medium, comprising a data storage area and a program storage area, wherein the data storage area stores created data and the program storage area stores a computer program; wherein: When the computer program is executed by a processor, the unsupervised clustering method according to any one of claims 1 to 4 is implemented.
