If you want a normalized distance, such as the distance from the cosine, you can also normalize your vectors first, and then use the Euclidean metric. Note that for two normalized vectors u and v, the Euclidean distance is sqrt (2-2 * cos (u, v)) ( see Discussion )
You can do something like:
Xnorm = np.linalg.norm(X,axis = 1) Xnormed = np.divide(X,Xnorm.reshape(Xnorm.shape[0],1)) db = DBSCAN(eps=0.5, min_samples=2, metric='euclidean').fit(Xnormed)
Distances will be at [0.2], so make sure you adjust your parameters accordingly.
benbo source share