R ile Anomali Tespitine Giriş
Alastair Rushworth
Data Scientist
Tek bir sütunun sınıfı
class(sat$V1)
"numeric"
Tüm sütunların sınıfı
sapply(X = sat, FUN = class)
label V1 V2 V3 V4 V5 V6 high_low
"numeric" "numeric" "numeric" "numeric" "numeric" "numeric" "numeric" "character"
Kategorik özellikleri factor olarak kodlayın
sat$high_low <- as.factor(sat$high_low)class(sat$high_low)
"factor"
Isolation forest’ı eğitin
sat_for <- iForest(sat[, -1], nt = 100)
Gower mesafesi, kategorik ve sayısal özelliklere sahip noktalar arasındaki uzaklığı ölçer
library(cluster)
sat_dist <- daisy(sat[, -1], metric = "gower")
sat_dist ögesini lof’a verin
sat_lof <- lof(sat_dist, k = 10)
sat_distmat <- as.matrix(sat_dist)
range(sat_distmat)
0.0000000 0.8680774
R ile Anomali Tespitine Giriş