kmedoids.py 文件源码

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

项目:ECoG-ClusterFlow 作者: sugeerth 项目源码 文件源码
def computeKmeans(self,Number_of_clusters,data, iterations = 100):
        partition = dict()
        nb_clusters = Number_of_clusters # this is the number of cluster the dataset is supposed to be partitioned into
        distances = nx.to_numpy_matrix(data)

        clusterid, error, nfound = KMeans(distances, nclusters= nb_clusters, npass=300)

        uniq_ids = list(set(clusterid))
        new_ids = [ uniq_ids.index(val) for val in clusterid]

        for i,value in enumerate(new_ids):
            partition[i] = value
        return partition
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号