K-Means is a [[Clustering|clustering]] algorithm that generates a set of $K$ clusters (defined as an input to the algorithm) based on a set of [[Independent Variable|input dimensions]] in an [[Unsupervised Machine Learning|unsupervised]] fashion. The steps of the algorithm consist of: 1) Define $K$ centroids using an **initialization** method (can be at random). 2) **Assign** each input sample to the closest centroid. 3) **Update** the centroid using the mean of each dimensions of all the assigned points. 4) **Repeat** until convergence (the updates are no longer significant) or a max number of iterations is reached.