Search code examples
pythonscikit-learnk-means

How to manually set K-means cluster's centers?


I would like to not to predic centers, but to assign each object to an already defined center. How can I?


Solution

  • You might also want to take a look at the KMeans implementation in Scipy. The parameter minit accepts a matrix and

    interpret[s] the k parameter as a k by M (or length k array for one-dimensional data) array of initial centroids.