The steps of the k-means algorithm
The steps involved in the k-means clustering algorithm are as follows:
Step 1 | We choose the number of clusters, k . |
Step 2 | Among the data points, we randomly choose k points as cluster centers. |
Step 3 | Based on the selected distance measure, we iteratively compute the distance from each point in the problem space to each of the k cluster centers. Based on the size of the dataset, this may be a time-consuming step—for example, if there are 10,000 points in the cluster and k = 3, this means that 30,000 distances need to be calculated. |
Step 4 | We assign each data point in the problem space to the nearest cluster center. |
Step 5 | Now each data point in our problem space has an assigned cluster center. But we are not done, as the selection of the initial cluster centers was based on random selection. We need to verify that the current randomly selected cluster centers are actually the center of... |