K-MEANS Algorithm:
The K-means algorithm accepts K input, and then divides n data objects into k clusters to meet the cluster requirements: the object similarity in the same cluster is high; the similarity between objects in different clusters is small. Clustering similarity is calculated by using the mean value of objects in each cluster to obtain a "central object" (gravity center.
The K-means algorithm is described as follows: First, K objects are randomly selected as the initial cluster center from n data objects, then, based on their similarity (distance) with these Clustering Centers, they are allocated to the most similar (represented by the clustering Center) Clustering respectively; then calculate the clustering center of each new cluster (the mean of all objects in the cluster). repeat this process until the standard measure function starts to converge. Generally, the mean variance is used as the standard measure function. k clusters have the following characteristics: each cluster itself is as compact as possible, and each cluster is separated as much as possible.
The details are as follows:
Input: K, data [N];
(1) Select K initial centers, for example, C [0] = data [0],… C [k-1] = data [k-1];
(2) For data [0]... Data [N], respectively, with C [0]… C [n-1], if the difference with C [I] is the least, it is marked as I;
(3) For all data marked as I points, recalculate C [I] = {the sum of all data [J] marked as I}/The number of data marked as I;
(4) Repeat (2) (3) until all C [I] values change less than the given threshold.