Gap_stats.py 文件源码

python
阅读 50 收藏 0 点赞 0 评论 0

项目:PySCUBA 作者: GGiecold 项目源码 文件源码
def KMEANS(data, k):

    if data.shape[0] < 20000:
        centroids, cluster_IDs, _ = k_means(data, k, init = 'k-means++', precompute_distances = 'auto', n_init = 20, max_iter = 200)
    else:
        mbkm = MiniBatchKMeans(k, 'k-means++', max_iter = 100, batch_size = data.shape[0] / k, n_init = 20)
        mbkm.fit(data)

        centroids = mbkm.cluster_centers_
        cluster_IDs = mbkm.labels_

    return centroids, cluster_IDs
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号