Solved – What does minimising the loss function mean in k-means clustering

clusteringk-meansloss-functions

I am learning about the k-means clustering algorithm, and I have read that the algorithm is "Trying to minimise a loss function in which the goal of clustering is not met".

I understand the basic concept of the algorithm, which initialises arbitrary centroids/means in the first iteration and then assigns data points to these clusters. The centroids are then updated after the points are all assigned, and points are re-assigned again. The algorithm continues to iterate until the clusters do not change anymore. The algorithm tries to minimise the within-cluster sum of squares (WCSS) value which is a measure of the variance within the clusters.

However, I am having trouble understanding what is meant by a loss function in the context of this algorithm. Any insights are appreciated.

Best Answer

Given $n$ points $\{x_i\}_1^n$ and a known number of clusters $k$, I think a possible loss function would be something like: $$L(c_1,...,c_k) = \sum_{i=1}^n \min_j || x_i - c_j ||^2 .$$ This would be the loss function for the k-means problem but it doesn't mean the the k-means algorithm is explicitly trying to decreases this loss (like a gradient descent would).