Posts

Showing posts with the label dbscan

Scikit-learn: Less points plotted than initial data samples after clustering with DBSCAN

Scikit-learn: Less points plotted than initial data samples after clustering with DBSCAN I was using the DBSCAN implementation from the library scikit-learn, when I discovered that the number of points plotted was inferior to the number of initial samples. In particular, in the official demo of DBSCAN http://scikit-learn.org/stable/auto_examples/cluster/plot_dbscan.html, 750 samples are generated automatically. However, when I print how many points there are for each cluster and how many outliers, the result is: CLUSTER 1: 224, CLUSTER 2: 228, CLUSTER 3: 227, OUTLIERS : 18, --> TOTAL = 697. As you can see from the following code, I have just added few lines to the original code, to print for each cluster the number of points and the number of outliers. I am confused about this and I would like to know why this happens and where are the missing points. Thanks in advance for the answers! print(__doc__) import numpy as np from sklearn.cluster import DBSCAN from sklearn import metrics f...