Line 143 of your code dbscan.py DBScan radius definition is <= threshold, not < threshold. https://en.wikipedia.org/wiki/DBSCAN