kmeans elbow method

__Find k for kmeans__ using the __elbow method__?

The KMeans algorithm can cluster observed data. But how many clusters (k) are there?

The elbow method finds the __optimal value for k (#clusters)__.

**Related course:** Data Science and Machine Learning with Python – Hands On!

The technique to determine __K, the number of clusters__, is called __the elbow method__.

With a bit of fantasy, you can see an elbow in the chart below.

We’ll plot:

- values for K on the horizontal axis
- the distortion on the Y axis (the values calculated with the cost function).

This results in:

When K increases, the centroids are closer to the clusters centroids.

The improvements will decline, at some point rapidly, creating the elbow shape.

That point is the optimal value for K. In the image above, K=3.

The example code below creates finds the optimal value for k.

# clustering dataset |

Cookie policy | Privacy policy | ©

- Machine Learning
- Machine Learning Tasks
- Training and test data
- bag of words
- bag of words euclidian distance
- Decision tree
- Decision tree visual example
- kmeans clustering algorithm
- kmeans clustering centroid
- kmeans elbow method
- kmeans text clustering
- Neural Network
- Neural Network Example
- Linear Regression
- logistic regression spam filter
- Translate
- Speech Recognition
- Text to speech
- Machine Learning Classifier
- Deep Learning
- Extract text from image
- Naive Bayes classifier