Python implementation of 'DBSCAN' Algorithm using only Numpy and Matplotlib.
You should install numpy and matplotlib for clustering and visualization. If you want to load sample data (sample.mat), you also need to install scipy. Although it is ironic that there is a dbscan function in the scipy... :) I've reinvented the wheel
pip3 install numpy scipy matplotlib
dbscan = dbscan(x, eplison, minPts)
idx, noise = dbscan.run()
cluster, noise = dbscan.sort()
dbscan.plot()
Open the runDemo file. You can just click F5 in an IDE environment to see the sample data results.
-
sample data load
x = io.loadmat('./sample/sample.mat')['X']
-
Init parameters
dbscan = DBSCAN(x,1.5,4)
-
Run DBSCAN
idx,noise = dbscan.run()
-
Sorting
g_cluster,n_cluster = dbscan.sort()
-
Visualization
dbscan.plot()
Jongwon Kim : https://deep-eye.tistory.com/