How can we select an appropriate value of k in k-means?

Choosing the right k value is a crucial part of k-means clustering. The elbow approach can be used to determine the proper k value. To accomplish so, we use the k-means method on a set of values ranging from 1 to 15. We compute an average score for each value of k. Inertia, or inter-cluster variance, is another name for this score.
This is determined as the sum of squares of all values in a cluster’s distances. We can witness a dramatic drop in the inertia value when k increases from a low value to a large value. The decline in inertia value gets fairly minor at a certain value of k in the range. For the k-means clustering process, this is the value of k that we must pick.