R 异常检测入门
Alastair Rushworth
Data Scientist
全局 与 局部 异常

获取家具数据的 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 异常检测入门