I want to use kmeans ++ in my own clustering method.
There is kmeans ++ in the initialization method of sklearn.cluster.KMeans
, so I want to call this somehow.
from sklearn.cluster.k_means_ import _k_init
from sklearn.utils.extmath import row_norms
import numpy as np
# x:data, k:Number of clusters
c = _k_init(x, k, row_norms(x, squared=True), np.random.RandomState())
Recommended Posts