NLP-准确率、精确率、召回率和F1值
记录准确率(Accuracy)、精确率(Precision)、召回率(Recall)和F1值(F-Measure)计算公式,和如何使⽤TensorFlow实现⼀、计算公式True Positive(TP):将正类预测为正类数True Negative(TN):将负类预测为负类数Fal Positive(FP):将负类预测为正类数
Fal Negative(FN):将正类预测为负类数
1.准确率:
2.精确率:
珍惜生命的名言警句3.召回率:
4.F1值
⼆、TensorFlow 实现
市场部Accuracy
with tf.name_scope("accuracy"):
脸上痣图片
correct_predictions = tf.equal(lf.predictions,lf.input_y) lf.accuracy = tf.reduce_mean(tf.cast(correct_predictions, "float"), name="accuracy")
TN;TP;FN;FP
Accuracy =T P +T N +FP +FN
蜻蜓的蜓组词T P +T N
Precision =T P +FP
T P
Recall =T P +FN
T P
F 1==Pre +Rec 2∗Pre ∗Rec 2∗T P +FP +FN
2∗T P
with tf.name_scope("tn"):
买涨
tn = ue_negatives(labels=lf.input_y, predictions=lf.predictions) lf.tn = tf.reduce_sum(tf.cast(tn, "float"), name="tn")
with tf.name_scope("tp"):
酒酿鸡蛋的做法tp = ue_positives(labels=lf.input_y, predictions=lf.predictions) lf.tp = tf.reduce_sum(tf.cast(tn, "float"), name="tp")
with tf.name_scope("fp"):
fp = tf.metrics.fal_positives(labels=lf.input_y, predictions=lf.predictions) lf.fp = tf.reduce_sum(tf.cast(fp, "float"), name="fp")
with tf.name_scope("fn"):
fn = tf.metrics.fal_negatives(labels=lf.input_y, predictions=lf.predictions) lf.fn = tf.reduce_sum(tf.cast(fn, "float"), name="fn")
Recall;Precision;F1
with tf.name_scope("recall"):
with tf.name_scope("precision"):
lf.precision = lf.tp / (lf.tp + lf.fp)
with tf.name_scope("F1"):
怎样分享手机热点微信头像图片花lf.F1 = (2 * lf.precision * lf.recall) / (lf.precision + lf.recall)