K-Means Clustering
· ☕ 4 min read
In this post, I’d like to discuss about one of basic unsupervised machine learning algorithms, K-means clustering.
Basic idea of kmeans clustering is to find positions which minimize the variance of each cluster. Mathematical description is
here math
Kmeans clustering algorithm steps: Generate K initial centroids at random positions 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.