title: Clustering algorithms: HDBSCAN in R vs HDBSCAN in Python?
body: <p>For working with exploratory data, which would be best clustering method? Currently I use HDBSCAN. Problem is that the results I get from using HDBSCAN in R is different from results obtained via HDSCBAN in Python.</p>
  
  <p>R version:  <a href="https://rdrr.io/cran/largeVis/man/hdbscan.html" rel="nofollow noreferrer">https://rdrr.io/cran/largeVis/man/hdbscan.html</a></p>
  
  <p>Link to data file for R: <a href="https://www.dropbox.com/s/731hjrj0geibi3f/test.csv?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/731hjrj0geibi3f/test.csv?dl=0</a></p>
  
  <pre><code>test_r &lt;- data.frame("data")
  vis &lt;- largevis::largevis(test_r)
  cluster &lt;- largevis::hdbscan(vis)
  largevis::gplot(cluster,t(vis$coords), text = TRUE)
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/DZ9Ik.png" alt="OUTPUT of R"></p>
  
  <p>Python version: <a href="https://github.com/scikit-learn-contrib/hdbscan/tree/master/hdbscan" rel="nofollow noreferrer">https://github.com/scikit-learn-contrib/hdbscan/tree/master/hdbscan</a> </p>
  
  <p>Link to data file for Python : <a href="https://www.dropbox.com/s/640elbjr1xt8q3e/test_projection.txt?dl=0" rel="nofollow noreferrer">https://www.dropbox.com/s/640elbjr1xt8q3e/test_projection.txt?dl=0</a></p>
  
  <pre><code>%pylab
  import hdbscan
  import numpy as np
  import seaborn as sns
  import matplotlib.pyploy as plt
  import pandas as pd
  
  projection = np.loadtxt("data")
  projection = projection[1:1001,:]
  
  clusterer = hdbscan.HDBSCAN(min_cluster_size=20, gen_min_span_tree=True)
  clusterer.fit(projection)
  
  palette = sns.color_palette()
  cluster_colors = [sns.desaturate(palette[col], sat)
                if col &gt;= 0 else (0.5, 0.5, 0.5) for col, sat in
                zip(clusterer.labels_, clusterer.probabilities_)]
  
  fig = plt.scatter(panc_projection.T[0], panc_projection.T[1], c= cluster_colors)
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/78hDH.png" alt="OUTPUT of Python"></p>
  
  <p>What is the reason for difference between output of two versions and how to determine accuracy in terms of results? (i.e. number of clusters, cluster size and noise)</p>
  
  <p><a href="http://hdbscan.readthedocs.io/en/latest/basic_hdbscan.html" rel="nofollow noreferrer">http://hdbscan.readthedocs.io/en/latest/basic_hdbscan.html</a></p>