k- means clustering
k n samples assigned to different classes or clusters, each sample from its center to a minimum belongs.
Each sample can only belong to a class, all k- means clustering is hard clustering .
model
- k < n
Tactics
- Distance: Euclidean distance
- Loss function: distance from the center of the sample belongs based on the total retention
- NP-hard problem
algorithm
The objective function minimization
- Initialization, randomly selected samples do center
- Clustering the samples, the sample is calculated from the cluster center, each sample to its nearest center is assigned a class
- The new class of computing centers. Calculate the mean of the sample clustering results, as a new class center
- If the iteration converge or meet the conditions to stop the output. Otherwise, let returns 2
Source: github.com/iOSDevLog/s...
Reproduced in: https: //juejin.im/post/5cfe7baef265da1b6a348a19