2nd, 3rd, Nth closest guesses
-
06-12-2019 - |
質問
I have used the KMeans algorithm to create an engine that can guess the cluster that a particular set of input data will fall into.
Can I use it to guess the 2nd closest cluster, 3rd closest, and so on?
Currently, I am using the sklearn.cluster.KMeans
library if that's any help - it doesn't seem like the API provides this functionality already.
解決
You could simply compute the distance to each cluster center provided in the cluster_centers_
attribute (once the KMeans
instance is fitted). The predict
method actually does that for the closest cluster center.
所属していません datascience.stackexchange