Top Page | Upper Page | Contents | About This Site | JAPANESE

LOF

LOF (Local Outlier Factor) calculates the density of the data space. And if the data is in the thin part, LOF decides that it is the outlier.

Strength of LOF

LOF use the same idea of k-NN , because it calculate the density between neighbors. So LOF could be used for coplicated distribution.

Weakness of LOF

If there are not many data of normal states or there are many data of outliers, LOF cannot decide correctly.

The best way to use LOF is that the data that we want to decice outlier or not is one.

By R

library(Rlof)
setwd("C:/Rtest")
Data <- read.table("Data.csv", header=T, sep=",")
LOF <- lof(Data,5) # Using 5 neighbors
LOF2 <- cbind(Data,LOF)
write.csv(LOF2, file = "LOF.csv") # Output as csv file



NEXT Minimum distance method