1. Learn
  2. /
  3. Courses
  4. /
  5. Cluster Analysis in Python

Exercise

Elbow method on uniform data

In the earlier exercise, you constructed an elbow plot on data with well-defined clusters. Let us now see how the elbow plot looks on a dataset with uniformly distributed points. You may want to display the data points in the IPython Shell before proceeding with the exercise.

The data is stored in a pandas DataFrame, uniform_data. x_scaled and y_scaled are the column names of the standardized X and Y coordinates of points.

Instructions 1/2

undefined XP
    1
    2
  • Create a list of distortions for each cluster in num_clusters.
  • Create a DataFrame elbow_plot with num_clusters and distortions.
  • With the .lineplot() method, plot elbow_plot with num_clusters in the x axis and distortions in the y axis.