I have the following code to estimate the eps
for DBSCAN. If the code is fine then I have obtained the knn distance plot
. The code is :
ns = 4
nbrs = NearestNeighbors(n_neighbors=ns).fit(data)
distances, indices = nbrs.kneighbors(data)
distanceDec = sorted(distances[:,ns-1], reverse=True)
plt.plot(indices[:,0], distanceDec)
Where data
is the array of pixel locations (rows and columns). I have obtained a plot but I am not getting how do I determine the eps
. According to DBSCAN
paper,
the threshold point is the first point in the first valley of the sorted k-dist graph
I dont know how do I implement it in the code. Moreover, is ns = 4
is my minPts
or is there any way to estimate minPts
from eps
?