processing_tools.py 文件源码

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

项目:TF-phrasecut-public 作者: chenxi116 项目源码 文件源码
def compute_accuracy(scores, labels):
    is_pos = (labels != 0)
    is_neg = np.logical_not(is_pos)
    num_pos = np.sum(is_pos)
    num_neg = np.sum(is_neg)
    num_all = num_pos + num_neg

    is_correct = np.logical_xor(scores < 0, is_pos)
    accuracy_all = np.sum(is_correct) / num_all
    accuracy_pos = np.sum(is_correct[is_pos]) / (num_pos + 1)
    accuracy_neg = np.sum(is_correct[is_neg]) / num_neg
    return accuracy_all, accuracy_pos, accuracy_neg
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号