k-means is a clustering ML algorithm. This is a nonsupervised ML algorithm. Its primary use is for clustering together closely related data and gaining an understanding of the structural properties of the data.
As the name suggests, this algorithm tries to form a k number of clusters around k-mean values. How many clusters are to be formed, that is, the value of k, is something a human being has to determine at the outset. This algorithm relies on the Euclidean distance to calculate the distance between two points. We can think of each observation as a point in n-dimensional space, where n is the number of features. The distance between two observations is the Euclidean distance between these in n-dimensional space.
To begin with, the algorithm picks up k random records from the dataset. These are the initial k-mean values. In the next step, for each record...