Sklearn MiniBatchKMeans gives confusing results for labels_ attribute

南笙酒味 提交于 2019-12-24 21:59:00

问题


I am using sklearn.cluster.MiniBatchKMeans for training an ML model. I need to get cluster ids of clusters and I tried with the below code. (Here model is the MiniBatchKmeans Clustering model)

print("Cluster IDs: ", np.unique(model.labels_))
print("Number of Clusters: ", model.n_clusters)

I got the following result.

Cluster IDs:  [0]
Number of Clusters:  2

According to this result, it shows that there is only 1 cluster-id for the given dataset and still there are 2 clusters. I found that all the new data(2nd training phase) I used to train the model using partial_fit function were assigned to one cluster. It seems like cluster centers are updated properly but, transform function gives confusing results for the distance vector. What is the reason for this?

来源:https://stackoverflow.com/questions/58056942/sklearn-minibatchkmeans-gives-confusing-results-for-labels-attribute

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!