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

 

转载于:https://www.cnblogs.com/xiaoniu-666/p/10523554.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值