LoslegenKostenlos loslegen

Plot sum of squared errors

Now you will plot the sum of squared errors for each value of k and identify if there is an elbow. This will guide you towards the recommended number of clusters to use.

The sum of squared errors is loaded as a dictionary called sse from the previous exercise. matplotlib.pyplot was loaded as plt, and seaborn as sns.

You can explore the dictionary in the console.

Diese Übung ist Teil des Kurses

Customer Segmentation in Python

Kurs anzeigen

Anleitung zur Übung

  • Add the plot title "The Elbow Method".
  • Add the X-axis label "k".
  • Add the Y-axis label "SSE".
  • Plot SSE values for each k stored as keys in the dictionary.

Interaktive Übung

Vervollständige den Beispielcode, um diese Übung erfolgreich abzuschließen.

# Add the plot title "The Elbow Method"
plt.____('The Elbow Method')

# Add X-axis label "k"
plt.____('____')

# Add Y-axis label "SSE"
plt.____('____')

# Plot SSE values for each key in the dictionary
sns.____(x=list(sse.____()), y=list(sse.____()))
plt.show()
Code bearbeiten und ausführen