K-Means Clustering
· ☕ 6 min read
In this post, I’d like to discuss about one of basic unsupervised machine learning algorithms, k-means clustering.
Basic idea of k-means clustering is to find positions which minimize the variance of each cluster. In real world, the algorithm is widely used such as documen clustering, recommendation engines, image segmentation and customer segmentation.
K-means clustering algorithm steps: Generate K initial centroids by selecting randomly from the data set Assign each data point with a cluster-label by finding the centroid which is the closest to the data Calculate new centroids by finding the first moment of each cluster over total number of data within the cluster Repeat 2 and 3 until centroids converge Implementation In order to run this python code, we first need to import python libraries.