Introduzione all'Anomaly Detection in R
Alastair Rushworth
Data Scientist
Scegli un valore alto
high_score <- quantile(sat$score, probs = 0.99)
high_score
99%
0.6228078
Binarizza score
sat$binary_score <- as.numeric(score >= high_score)
Confronto tra etichetta reale e score binarizzato
table(sat$label, sat$binary_score)
0 1
0 5729 3
1 15 56
Anomalie identificate correttamente $\div$ Totale anomalie
table(sat$label, sat$binary_score)
0 1
0 5729 3
1 15 56
recall <- 56 / (15 + 56)
recall
0.7887324
Anomalie identificate correttamente $\mathbf{\div}$ Totale segnate come anomale
table(sat$label, sat$binary_score)
0 1
0 5729 3
1 15 56
precision <- 56 / (56 + 3)
precision
0.9491525
Introduzione all'Anomaly Detection in R