混淆矩阵(Confusion Matrix)
label pos | label neg | |
---|---|---|
pred pos | TP | FP |
pred neg | FN | TN |
- TP(真正例):预测+ 实际+
- FP(假正例):预测+ 实际-
- TN(真负例):预测- 实际-
- FN(假负例):预测- 实际+
Precision(精确率,P)
P
=
T
P
T
P
+
F
P
P= \frac {TP} {TP+FP}
P=TP+FPTP
TPR(真正例率,灵敏度,Sensitivity,召回率,Recall)
T
P
R
=
T
P
T
P
+
F
N
TPR= \frac {TP} {TP+FN}
TPR=TP+FNTP
F-Score是Precision和Recall的加权调和平均
F
=
(
a
2
+
1
)
∗
P
r
e
c
i
s
i
o
n
∗
R
e
c
a
l
l
a
2
(
P
r
e
c
i
s
i
o
n
+
R
e
c
a
l
l
)
F = \frac {(a^2+1) * Precision* Recall} {a^2 (Precision+Recall)}
F=a2(Precision+Recall)(a2+1)∗Precision∗Recall
当 a = 1 a=1 a=1时,F-Score即为F1
PR曲线,以recall为x轴,以precision为y轴
FPR(假正例率,)
F
P
R
=
F
P
F
P
+
T
N
FPR= \frac {FP} {FP+TN}
FPR=FP+TNFP
ROC曲线,以FPR为x轴,以TPR/recall为y轴
TNR(真负例率,特异度,Specificity)
T
N
R
=
T
N
F
P
+
T
N
TNR= \frac {TN} {FP+TN}
TNR=FP+TNTN
FPR + TNR = 1