Learn R Programming

dbscan (version 0.9-0)

kNNdistplot: Plot the k-Nearest Neighbor Distance

Description

This plot can be used to help find a suitable value for the eps neighborhood for DBSCAN. Look for the knee in the plot.

Usage

kNNdistplot(x, k = 4)

Arguments

Examples

Run this code
data(iris)
iris <- as.matrix(iris[,1:4])

kNNdistplot(iris, k=4)
## the knee is around a distance of .5

cl <- dbscan(iris, eps = .4, minPts = 4)
pairs(iris, col = cl+1L)
## Note: black are noise points

Run the code above in your browser using DataLab