準確率,精準率和召回率(Accuracy、precision & Recall)

最重要分清四個變量:
https://en.wikipedia.org/wiki/Sensitivity_and_specificity

  1. True positive (TP): e.g., Sick people correctly identified as sick
  2. False positive (FP): e.g., Healthy people incorrectly identified as sick
  3. True negative (TN): e.g., Healthy people correctly identified as healthy
  4. False negative (FN): e.g., Sick people incorrectly identified as healthy

In general, Positive = identified and negative = rejected. Therefore:

  1. True positive = correctly identified
  2. False positive = incorrectly identified
  3. True negative = correctly rejected
  4. False negative = incorrectly rejected

所以:
condition positive (P):the number of real positive cases in the data
condition negative (N):the number of real negative cases in the data

P = TP + FN, F = TN + FP


準確率 Accuracy = (TP + TN) / (P + N) = (TP + TN) / (TP + FN + TN + FP)

精確率Precision = TP / (TP + FP)

召回率Recall = TP / P = TP / (TP + FN)

F1-Score = 2 * (Precision * Recall) / (Precision + Recall) = 2 * TP / (2 * TP + FP +FN)


示例說明:
1000個病人,現被確診400個病人,600個健康人。
這400個病人實際上有300個病人(TP)和100給誤判的健康人(FP);
而這判定爲健康的600人中,有500個是健康人(TN),100個病人(FN)。
即: TP = 300, FP = 100, TN = 500, FN = 100.

注:實際上的患者爲500人(P = TP + FN),500個健康人(F = TN + FP

所以:
準確率Accuray = (TP + TN) / (TP + FN + TN + FP) = 800 / 1000 = 80%
精確率Precision = TP / (TP + FP) = 300 / (300 + 100)= 75%
召回率Recall = TP / (TP + FN) = 300 / (300 + 100) = 75%
F1-score = 2 * (Precision * Recall) / (Precision + Recall) = 75%

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章