vis_corex.py 文件源码

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

项目:bio_corex 作者: gregversteeg 项目源码 文件源码
def output_strong(tcs, alpha, mis, labels, prefix=''):
    f = safe_open(prefix + '/text_files/most_deterministic_groups.txt', 'w+')
    m, n = alpha.shape
    topk = 5
    ixy = np.clip(np.sum(alpha * mis, axis=1) - tcs, 0, np.inf)
    hys = np.array([entropy(labels[:, j]) for j in range(m)]).clip(1e-6)
    ntcs = [(np.sum(np.sort(alpha[j] * mis[j])[-topk:]) - ixy[j]) / ((topk - 1) * hys[j]) for j in range(m)]

    f.write('Group num., NTC\n')
    for j, ntc in sorted(enumerate(ntcs), key=lambda q: -q[1]):
        f.write('%d, %0.3f\n' % (j, ntc))
    f.close()
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号