The goal of the k-means algorithm is to partition the data into k groups based on feature similarities. K is a predefined property of a k-means clustering model. Each of the k clusters are specified by a centroid (center of a cluster) and each data sample belongs to the cluster with the nearest centroid. During training, the algorithm iteratively updates the k centroids based on the data provided. Specifically, it involves the following steps:
- Specifying k: The algorithm needs to know how many clusters to generate as an end result.
- Initializing centroids: The algorithm starts with randomly selecting k samples from the dataset as centroids.
- Assigning clusters: Now that we have k centroids, samples that share ...