How to select the second point where derivative is greater than 1 in r? [closed]
-
31-10-2019 - |
Question
I'm looking for the exact value of epsilon to run the DBSCAN
clustering algorithm.
Here's the KNN
distance plot.
This chart has two flex points. I need the second flex point. I'm using the following code:
# evaluate kNN distance
dist <- dbscan::kNNdist(iris, 4)
# order result
dist <- dist[order(dist)]
# scale
dist <- dist / max(dist)
# derivative
ddist <- diff(dist) / ( 1 / length(dist))
# get first point where derivative is higher than 1
knee <- dist[length(ddist)- length(ddist[ddist > 1])]
How can improve my code to get second point where derivative is higher than 1?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with datascience.stackexchange