1.分類問題
1.混淆矩陣
[
T
P
F
P
F
N
T
N
]
\begin{bmatrix} TP&FP\\\\ FN&TN\\\\ \end{bmatrix}
?????TPFN?FPTN??????
真正率:TPR=TP/(TP+FN)
假正率:FPR=FP/(FP+TN)
假負率:FNR=FN/(FN+TP)
真負率:TNR=TN/(TN+FP)
from sklearn.metrics import confusion_matrix
2.準確率
即正確預測的例子(正與負)除以總數
accuracy=(TP+TN)/(TP+FP+FN+TN)
from sklearn.metrics import accuracy_score
3.精確率
針對正樣本預測結果
precision=TP/(TP+FP)
4.召回率
在實際正樣本中預測,又稱查全率
recall=TP/(TP+FN)
5.F1-score
召回率與精確率的調和
F
1
=
2
P
r
e
c
i
s
i
o
n
R
e
c
a
l
l
P
r
e
c
i
s
i
o
n
+
R
e
c
a
l
l
F_1=\frac{2Precision Recall}{Precision+Recall}
F1?=Precision+Recall2PrecisionRecall?
6.ROC曲線
橫坐標為FPR,縱坐標為TPR
ROC曲線越接近左上角,預測效果越好,同時ROC較為光滑認為沒有過擬合現象
FPR,TPR,_=sklearn.metrics.roc_curve(y_test,y_pred)
7.AUC(area under curve)
ROC曲線下面的面積,越接近1.0,預測效果越好
8.PR曲線
橫坐標Precision,縱坐標Recall
基于情況選擇指標,交叉時選擇平衡點f1決定
Precision,recall,_=sklearn.metrics.precision_recall_curve(y_test,y_pred)
官網鏈接:https://scikit-learn.org/stable/modules/classes.html#module-sklearn.metrics

待補充,,,
轉載請註明出處,本文鏈接:https://www.uj5u.com/qita/260548.html
標籤:其他
上一篇:初識redis
