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

Viewed 958

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.

1 Answers

In the broader context of machine learning, a loss function (sometimes called a cost function) is a function that indicates how "bad" a particular answer is. Minimizing the loss function then corresponds to finding the "best" answer to the problem.

(It may be weird to think about "losing the least amount," in which case thinking of it as a cost function might be easier. The goal is to then find the lowest-cost solution to the problem.)

Related