Introduction to Anomaly Detection in R
Alastair Rushworth
Data Scientist
Global versus local anomalies
Obtain LOF for furniture data
library(dbscan)
furniture_lof <- lof(scale(furniture), k = 5)
View the scores
furniture_lof[1:10]
[1] 1.0649669 1.1071205 0.9980290 1.0392385 0.9725305
[6] 1.1933199 1.3210459 1.1409659 1.0613144 1.0805445
LOF is a ratio of densities
Large LOF values indicate more isolated points
furniture$score_lof <- furniture_lof
plot(Width ~ Height, data = furniture, cex = score_lof, pch = 20)
Introduction to Anomaly Detection in R