Get the App
SLTechnology News&Howtos  ›  Internet Technology  › 

How to understand the principle of K-means clustering

Shulou Source: shulou.com Published: 2022-06-01 18:31:34 10月27日 Update

How to understand the principle of K-means clustering, in view of this problem, this article introduces the corresponding analysis and solution in detail, hoping to help more partners who want to solve this problem to find a more simple and feasible method.

How to use K-means clustering correctly

Unsupervised learning refers to the machine learning problem of learning models from unlabeled data. Unlabeled data is the data obtained naturally, the model indicates that the essence of data category, transformation or probability unsupervised learning is to learn the statistical law or potential structure of the data, including clustering, dimensionality reduction and probability estimation.

KMeans algorithm is a typical distance-based clustering algorithm, which uses distance as the evaluation index of similarity, that is, the closer the distance between two objects, the greater the similarity. The algorithm believes that clusters are composed of objects close to each other, so the ultimate goal is to get compact and independent clusters.

The selection of K initial clustering centers has a great impact on the clustering results, because in the first step of the algorithm, any k objects are randomly selected as the initial clustering centers, which initially represent a cluster. In each iteration, the algorithm assigns each remaining object in the data set to the nearest cluster according to its distance from the center of each cluster. After examining all the data objects, an iterative operation is completed, and the new clustering center is calculated. The algorithm process is as follows:

(1) K data documents are randomly selected from N data documents (samples) as centroids (clustering centers).

In this paper, K clustering centers are randomly generated in the range of sample space in the process of initialization of clustering centers.

(2) measure the distance from each data document to each centroid and classify it into the nearest centroid class.

(3) recalculate the centroids of each class that have been obtained.

(4) iteration (2) ~ (3) until the new centroid is equal to the original centroid or less than the specified threshold, the algorithm ends.

The following picture shows several GIF, which vividly illustrate the process of k-means clustering. Data points.

Starting at 4: 00 on the far left.

Starting at 4: 00 on the far right.

Start with the four highest points

Start with four bottom lines.

Start with four random points in a cluster

The answer to the question on how to understand the principle of K-means clustering is shared here. I hope the above content can be of some help to you. If you still have a lot of doubts to be solved, you can follow the industry information channel to learn more about it.

Tags: Data algorithm centroid object mean problem learning document process iteration principle similarity more sample probability model help supervision solution easy Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno Shulou Information MySQL Apple Huawei Linux