evaluate.py 文件源码

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

项目:Learning-sentence-representation-with-guidance-of-human-attention 作者: wangshaonan 项目源码 文件源码
def acc(preds,scores):
    golds = []
    for n,i in enumerate(scores):
        p = -1
        i=i.strip().lower()
        if i == "contradiction":
            p = 0
        elif i == "neutral":
            p = 1
        elif i == "entailment":
            p = 2
        else:
            raise ValueError('Something wrong with data...')
        golds.append(p)
    #print confusion_matrix(golds,preds)
    return accuracy_score(golds,preds)
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号