Far
Far

Reputation: 5

how can I pass some nodes as init in sklearn.kmeans(n_clusters,init,....) in python

how can I pass 2 nodes as centroids to sklearn.kmeans(n_clusters,init,....) instead of random or kmeans++? algorithms['kmeans'] = KMeans(n_clusters=k_clusters,init='random', n_init=200)

Upvotes: -1

Views: 200

Answers (1)

sotmot
sotmot

Reputation: 1313

sklearn also allows users to input centroids of shape (n_clusters, n_features).

The documentation: https://scikit-learn.org/stable/modules/generated/sklearn.cluster.KMeans.html

For less than n_clusters, you could use random initialization and pass it.

Upvotes: 0

Related Questions