May 2019
Intermediate to advanced
664 pages
15h 41m
English
As we did with hierarchical clustering, we can also use NbClust() to determine the optimum number of clusters for k-means. All you need to do is specify kmeans as the method in the function. Let's also loosen up the maximum number of clusters to 15. I've abbreviated the following output to just the conclusion:
> numKMeans <- NbClust::NbClust(wine_df, min.nc = 2, max.nc = 15, method = "kmeans") ***** Conclusion ***** * According to the majority rule, the best number of clusters is 3
Once again, three clusters appears to be the optimum solution.
In R, we can use the kmeans() function to do this analysis. In addition to the input data, we have to specify the number of clusters we are solving for and a value for random assignments, ...