Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

do_knno

kNN for outlier detection


Description

Ramaswamy et al. proposed the k-nearest neighbors outlier detection method (kNNo). Each point's anomaly score is the distance to its kth nearest neighbor in the data set. Then, all points are ranked based on this distance. The higher an example's score is, the more anomalous it is.

Usage

do_knno(data, k, top_n)

Arguments

data

Data observations.

k

Number of neighbors of a point that we are interested in.

top_n

Total number of outliers we are interested in.

Value

Vector of outliers.

Author(s)

Guillermo Vinue

References

Ramaswamy, S., Rastogi, R. and Shim, K. Efficient Algorithms for Mining Outliers from Large Data Sets. SIGMOD'00 Proceedings of the 2000 ACM SIGMOD international conference on Management of data, 2000, 427-438.

Examples

data(mtcars)
data <- as.matrix(mtcars)
outl <- do_knno(data, 3, 2)
outl
data[outl,]

adamethods

Archetypoid Algorithms and Anomaly Detection

v1.2.1
GPL (>= 2)
Authors
Guillermo Vinue, Irene Epifanio
Initial release
2020-08-04

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.