パフォーマンスの測定

Rで学ぶ異常検知入門

Alastair Rushworth

Data Scientist

判定しきい値の使用

高いしきい値を選ぶ

high_score <- quantile(sat$score, probs = 0.99)
high_score
    99% 
0.6228078

スコアを二値化する

sat$binary_score <- as.numeric(score >= high_score)
Rで学ぶ異常検知入門

一致表(混同行列)

真のラベルと二値化スコアの比較

table(sat$label, sat$binary_score)
       0    1
  0 5729    3
  1   15   56

  • 71件中56件の異常を検出
Rで学ぶ異常検知入門

リコール

正しく特定した異常 $\div$ 異常の総数

  • 1 = リコール100%(すべての異常を検出)
table(sat$label, sat$binary_score)
       0    1
  0 5729    3
  1   15   56
recall <- 56 / (15 + 56)
recall
0.7887324
Rで学ぶ異常検知入門

適合率(Precision)

正しく特定した異常 $\mathbf{\div}$ 異常と判定した総数

  • 1 = 適合率100%(正常を誤って異常としない)
table(sat$label, sat$binary_score)
       0    1
  0 5729    3
  1   15   56
precision <- 56 / (56 + 3)
precision
0.9491525
Rで学ぶ異常検知入門

練習してみましょう!

Rで学ぶ異常検知入門

Preparing Video For Download...