微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Tensorflow计算正确率、精确率、召回率

二分类模型的评价指标

https://www.cnblogs.com/xiaoniu-666/p/10511694.html

参考tf的方法

    predictions = tf.argmax(predict, 1)
    actuals = tf.argmax(real, 1)
    ones_like_actuals = tf.ones_like(actuals)
    zeros_like_actuals = tf.zeros_like(actuals)
    ones_like_predictions = tf.ones_like(predictions)
    zeros_like_predictions = tf.zeros_like(predictions)
        Lable:      1   1   0   0
        predi:      1   0   0   1
                    Tp  Fp  Tn  Fn
    tp: = and       1
    tn = ont(or)            1

    lab-pred:       0   1   0   -1

    lab-pred>=0.6:  0   1   0   0
    fp = and(lable, lab-pred):
                    0   1   0   1

    lab-pred<=-1.0: 0   0   0   1
    not-lable:      0   0   1   1
    fn = and(not-lable, lab-pred<-1.0)
可能用到的方法
tf.less_equal
tf.less
tf.greater_equal
tf.greater
count_nonzero

参考:

https://blog.csdn.net/sinat_35821976/article/details/81334181

https://tensorflow.google.cn/api_docs/python/tf/math/count_nonzero

 

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐