DBSCAN clustering
An implementation of DBSCAN clustering. Given a dataset, this can compute and return a clustering of that dataset.
:- use_module('path/to/.../src/methods/dbscan/dbscan.pl').
%% usage example
TrainData = [5.1,3.5,1.4, 4.9,3.0,1.4, 4.7,3.2,1.3, 4.6,3.1,1.5],
dbscan(1.0, 1, 0, ordered, kd, TrainData, 3, AssignList, CentroidsList, _).
Available Predicates
dbscan/10
This is a one predicate model where you configure the model with the input parameters and get returned the results in the same predicate.
%% predicate definition
dbscan(Epsilon, MinPoints, BatchMode, SelectionType, TreeType, DataList, DataRows, AssignList, CentroidsList, ZCols) :-
Epsilon > 0,
MinPoints > 0,
convert_list_to_float_array(DataList, DataRows, array(Xsize, Xrownum, X)),
dbscanI(Epsilon, MinPoints, BatchMode, SelectionType, TreeType, X, Xsize, Xrownum, Y, Ysize, Z, ZCols, ZRows),
convert_float_array_to_list(Y, Ysize, AssignList),
convert_float_array_to_2d_list(Z, ZCols, ZRows, CentroidsList).
%% foreign c++ predicate definition
foreign(dbscan, c, dbscanI( +float32, +integer, +integer,
+string, +string,
+pointer(float_array), +integer, +integer,
-pointer(float_array), -integer,
-pointer(float_array), -integer, -integer)).
Parameters
Name | Type | Description | Default |
---|---|---|---|
epsilon | +float | Radius of each range search | 1.0 |
minPoints | +integer | Minimum number of points for a cluster | 5 |
batchMode | +integer(bool) | If true, all points are searched in batch. | (1)true |
selectionType | +string | If using point selection policy, the type of selection to use ("ordered", "random") | ordered |
treeType | +string | The type of tree to use ("kd", "r", "r_star", "x", "hilbert_r", "r_plus", "r_plus_plus", "cover", "ball") | kd |
data | +matrix | Input dataset to cluster | - |
assignments | -vector | Output matrix for assignments of each point. | - |
centroids | -matrix | Matrix to save output centroids to. | - |
Connected Links/Resources
If you want a more detailed explanation, then go to the python documentation. There is most of the time a good explanation on how the methods work and what the parameters do.
added some of the links from the python documentation