问题
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