def fit(data, use_scikit_learn=False):
logger.info("Starting to cluster")
# Cluster
n_clusters = 8
oversampling_factor = 2
if use_scikit_learn:
km = sk.KMeans(n_clusters=n_clusters, random_state=0)
else:
km = KMeans(n_clusters=n_clusters,
oversampling_factor=oversampling_factor,
random_state=0)
t0 = tic()
logger.info("Starting n_clusters=%2d, oversampling_factor=%2d",
n_clusters, oversampling_factor)
km.fit(data)
t1 = tic()
logger.info("Finished in %.2f", t1 - t0)
评论列表
文章目录