I am trying to write a function in R that automatically chooses the optimal parameters epsilon and MinPts in a DBSCAN analysis. I found that the k-nearest neighbour plot was very useful in order to select the optimal eps. However, I am trying to make the whole process automatic, and I was wondering if there was any method to locate the exact position of the knee so as to have the most representative eps possible.
I tried listing all the slopes at each point of a kNN dist plot and take the maximum value (since the knee represents the maximum point of curvature), but It wasn't very useful. Is it, indeed, possible to find the knee automatically or should one just look at the plot visually?
Thanks in advance.