C++ Implementation of clustering by DBSCAN
-
Keep project files in one folder.
-
compile using command
make
.
To compile without using the makefile, type the following command.
g++ -std=c++11 clustering.cpp -o clustering.exe
(Note that -std=c++11 option is must be given in g++.)
- Run using following command.
./clustering.exe [intput.txt] [n] [eps] [minPts]
Given a set D of objects, we identify all core objects w.r.t. the given parameters, ε (Eps) and MinPts.
- Arbitrary select an object o in D
- If o is a core point, a cluster is formed
Collect all objects density-reachable from o, w.r.t. Eps and MinPts (DBSCAN iteratively collects directly density-reachable objects)
- Merge of a few density-reachable clusters may occur
- If o is a border object, no objects are density-reachable from o and DBSCAN visits the next object of the database
If o is not density-reachable from any core point, p is considered to be noise and not added to any cluster
- Continue the process until all of the objects have been processed
pseudo code
for each o in D do
if o is not yet classified then
if o is a core-object then
collet all objects density-reachable from o and assign them to a new cluster.
else
assign o to NOISE
- Note that I use c++11, not c++. therefore -std=c++11 option is must be given in g++.
input1: 98.91%
input2: 94.60%
input3: 99.97%