ananke_simulate.py 文件源码

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

项目:ananke 作者: beiko-lab 项目源码 文件源码
def score_simulation(h5_file):
    print("Opening/creating database file")
    tsdatabase = TimeSeriesData(h5_file)
    nreps = int((tsdatabase.h5_table["timeseries/indptr"].shape[0]-1)/6)
    #Items belonging in the same cluster are next to one another
    true_labels = [0]*nreps+[1]*nreps+[2]*nreps+[3]*nreps+[4]*nreps+[5]*nreps
    #Order is: drop, rise, normal, noisy, conditionally rare, seasonal
    max_ami = 0
    for i in range(tsdatabase.h5_table["genes/clusters"].shape[1]):
        pred_labels = tsdatabase.get_cluster_labels(i)
        ami = metrics.adjusted_mutual_info_score(true_labels, pred_labels)
        if (ami > max_ami):
            max_ami = ami
    print("Maximum AMI of clusters is: %f" % (max_ami,))
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号