util_FSP.py 文件源码

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

项目:PyME 作者: vikramsunkara 项目源码 文件源码
def seperate_via_kmeans(state_space,p,K,tau=0.1):
    from scipy.cluster.vq import kmeans 
    #centres= np.floor(kmeans2(state_space,K)[0]) # these are the original lines

    # the following are being added as hacks

    #_all_cores_filled_ = False
    #while(_all_cores_filled_ == False):
        #centres, distributed = kmeans(state_space,K)
        #print("going into k means" + "we only have " + str(np.max(distributed)))
        #if np.max(distributed) == K-1:
            #_all_cores_filled_ = True

    # bhack to make just the K means work

    centres, stuff = kmeans(state_space,K)

    # hack ends here    

    #proportions = partition_algo_distances(state_space,centres,tau)
    proportions = partition_algo_distances_tight(state_space,centres,tau)
    sub_state_space, sub_prob = seperate_via_proportions(state_space,proportions, p)
    return sub_state_space, sub_prob, centres
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号