简体   繁体   中英

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)

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM