title: Why cosine distance is much slower than using euclidean distance with DBSCAN algo in scikitlearn
body: <p>I am going to use two metrics (Euclidean distance and cosine similarity) for the DBSCAN algorithm from package <code>scikit-learn</code>.</p>
  
  <p>The thing is that using Euclidean distance is much faster than using cosine similarity.</p>
  
  <p>The code:</p>
  
  <pre><code>// using euclidean distance    
  DBSCAN(eps=0.02, min_samples=5, metric="euclidean").fit(data)
  
  // using cosine similarity
  DBSCAN(eps=0.02, min_samples=5, metric=cosine_distance).fit(data)
  </code></pre>
  
  <p>Does anyone know the cause of this difference in speed with cosine similarity?</p>