evaluation_common.py 文件源码

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

项目:LexNET 作者: vered1986 项目源码 文件源码
def eval_performance(y_true, y_pred):
    '''
    Evaluate the performance of a multiclass classification model.
    :param y_true: the gold-standard labels
    :param y_pred: the predictions
    :return: mean F1
    '''
    pre, rec, f1, support = metrics.precision_recall_fscore_support(y_true, y_pred, average='weighted')
    print '=== Performance ==='
    print 'Mean precision:  %.03f%%' % pre # (100*sum(pre * support)/sum(support))
    print 'Mean recall:     %.03f%%' % rec # (100*sum(rec * support)/sum(support))
    print 'Mean F1:         %.03f%%' % f1 # mean_f1
    return pre, rec, f1, support
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号