confusion matrix, accuracy, precision, recall, f1 score - yarak001/machine_learning_common GitHub Wiki

confusion matrix, accuracy, precision, recall, f1-score

  • confusion matrix
    • confusion martriximage
  • fbeta score
    • fbeta score
  • example
    • example
      • example
      • Cat
        • TP:10, FN:15, FP:13, TN:43
        • precision: TP / TP + FP = 10 / 10 + 13 = 0.43
        • recall: TP / TP + FN = 10 / 10 + 15 = 0.4
        • f1-score: 2*(precision * recall) / (precision + recall) = 0.414
      • Doc
        • TP:20, FN:10, FP:12, TN:38
        • precision: TP / TP + FP = 20 / 20 + 12 = 0.606
        • recall: TP / TP + FN = 20 / 20 + 10 = 0.666
        • f1-score: 2*(precision * recall) / (precision + recall) = 0.634
      • Fish
        • TP:13, FN:12, FP:13, TN:43
        • precision: TP / TP + FP = 13 / 13 + 13 = 0.5
        • recall: TP / TP + FN = 13 / 13 + 12 = 0.52
        • f1-score: 2*(precision * recall) / (precision + recall) = 0.509
      • macro average f1-score
        • ํ‰๊ท ๋“ค์˜ ํ‰๊ท  ๊ฐœ๋…
        • ์ „์ฒด ์„ฑ๋Šฅ์„ ํ‰๊ฐ€ํ•˜๊ธฐ ์œ„ํ•ด ๋ชจ๋“  class์— ๋™์ผํ•œ ๊ฐ€์ค‘์น˜ ๋ถ€์—ฌ
        • Sample์— ๋Œ€ํ•ด ๋™์ผํ•œ weight๋ฅผ ์ฃผ๋Š” ๊ฒƒ์ด ์•„๋‹Œ, Class ๋ณ„๋กœ ๋˜‘๊ฐ™์€ weight์„ ๋ถ€์—ฌํ•จ
        • sum(๊ฐ class์˜ f1-score) / class์ˆ˜ = 0.519
      • micro average f1-score
        • ์ „์ฒด์˜ ๊ฐ’๋“ค ํ‰๊ท  ๊ฐœ๋…
        • ๊ฐ sample์— ๋™์ผํ•œ ๊ฐ€์ค‘์น˜๋ฅผ ์ ์šฉํ•  ๋•Œ ์œ ์šฉ
        • ๊ฐ class์˜ TP, FN, FP์˜ ํ•ฉ์‚ฐ ๊ฐ’์— ๋Œ€ํ•œ precision, recall, f1-score ๊ฒŒ์‚ฐ
        • precision = TPs / TPs + FPs = (10+20+13) / (10+20+13) + (13+12+13) = 0.53
        • recall = TPs / TPs + FNs = (10+20+13) / (10+20+13) + (15+10+12) = 0.537
        • fi-score = 0.533
      • weighted macro-average
        • ์‹ค์ œ instance์˜ ์ˆ˜์— ๋”ฐ๋ผ ๊ฐ class์˜ ์ ์ˆ˜์— ๊ฐ€์ค‘์น˜๋ฅผ ๋ถ€์—ฌํ•˜๋Š” ๊ณ„์‚ฐ ๋ฐฉ์‹
        • class ๋ถˆ๊ท ํ˜•์„ ๋‹ค๋ฃฐ ๋•Œ ์œ ์šฉ

์ฐธ๊ณ