How many Clusters?How many Clusters?

You may be wondering: But hey, what is the exact number of clusters? We can use the so-called "elbow method".

The elbow method is a technique used to determine the optimal number of clusters in a k-means clustering algorithm. The method consists of plotting the explained variation as a function of the number of clusters and picking the elbow of the curve as the number of clusters to use. The "elbow" is the point of inflection on the curve where the explained variation begins to decrease at a slower rate. This point is considered the optimal number of clusters because adding more clusters will not significantly improve the explained variation.


  1. Evaluate the kmeans from 1 to 10;
  2. Plot the graph.

Everything was clear?

Section 1. Chapter 10

Start learning today and achieve
coding mastery

  • Master Python, SQL, JavaScript & more.
  • Learn with Step-by-Step Lessons.
  • Get Ready for Real-World Projects.
  • Earn a Certificate Upon Completion.