Skip to content

Instantly share code, notes, and snippets.

@isaacarroyov
Last active November 20, 2020 04:50
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save isaacarroyov/70d6fbdf00a66fa0e926b88acdfa6f59 to your computer and use it in GitHub Desktop.
Save isaacarroyov/70d6fbdf00a66fa0e926b88acdfa6f59 to your computer and use it in GitHub Desktop.
application of elbow method
from sklearn.cluster import KMeans
#create a list for the wcss parameter
wcss = []
#test with 14 clusters
for i in range(1, 15):
kmeans = KMeans(n_clusters = i, init = 'k-means++', random_state = 11)
kmeans.fit(df_standardized)
wcss.append(kmeans.inertia_)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment