utils.helper.kmeans

utils.helper.kmeans(data, range_cluster=(2, 10), kmeans_kwargs={'init': 'random', 'max_iter': 400, 'n_init': 50, 'random_state': 197})[source]

Performs K-means on the data.

The function perfoms K-means on the data (usually latent space of a model) for various number of clusters and returns a list containing average Silhouette width.

Parameters

kmeans_kwargsdict

For more details, please refer to scikit-learn documentation.

range_clustertuple

The range of the number of clusters.