R 中的異常偵測入門
Alastair Rushworth
Data Scientist
全域 vs 區域 異常

取得家具資料的 LOF
library(dbscan)
furniture_lof <- lof(scale(furniture), k = 5)
查看分數
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 是密度比值
LOF 越大,點越孤立
furniture$score_lof <- furniture_lofplot(Width ~ Height, data = furniture, cex = score_lof, pch = 20)

R 中的異常偵測入門