k-means clustering is a data mining/machine learning algorithm used to cluster observations into groups of related observations without any prior knowledge of those relationships.The k-means algorithm is one of the simplest clustering techniques and it is commonly used in medical imaging, biometrics and related fields. The algorithm arbitrarily selects k points as the initial cluster centers (âmeansâ). 2  Each point in the dataset is assigned to the closed cluster, based upon the Euclidean distance between each point and each cluster center. 3  Each cluster center is recomputed as the average of the points in that cluster.