k-means clustering elbow method

PHOTO EMBED

Wed Aug 25 2021 16:24:09 GMT+0000 (Coordinated Universal Time)

Saved by @ofatunde #r

# function to compute total within-cluster sum of squares. 
fviz_nbclust(contest.scaled, kmeans, method = "wss", k.max = 50,verbose=TRUE,print.summary=TRUE) + 
  theme_minimal() +
  ylab("Total Within Sum of Squares")+
  xlab("Number of clusters (k)")+
  ggtitle("Determining optimal number of clusters using the Elbow Method")+theme(plot.title=element_text(hjust=0.5))
content_copyCOPY

Select optimal number of clusters for a matrix of scaled values

https://towardsdatascience.com/10-tips-for-choosing-the-optimal-number-of-clusters-277e93d72d92