Introduction à la détection d'anomalies en R
Alastair Rushworth
Data Scientist
Choisir une valeur élevée
high_score <- quantile(sat$score, probs = 0.99)
high_score
99%
0.6228078
Binariser le score
sat$binary_score <- as.numeric(score >= high_score)
Comparer l'étiquette réelle et le score binaire
table(sat$label, sat$binary_score)
0 1
0 5729 3
1 15 56
Anomalies correctement trouvées $\div$ Total des anomalies
table(sat$label, sat$binary_score)
0 1
0 5729 3
1 15 56
recall <- 56 / (15 + 56)
recall
0.7887324
Anomalies correctement trouvées $\mathbf{\div}$ Total marqué comme anormal
table(sat$label, sat$binary_score)
0 1
0 5729 3
1 15 56
precision <- 56 / (56 + 3)
precision
0.9491525
Introduction à la détection d'anomalies en R