-
Notifications
You must be signed in to change notification settings - Fork 0
/
BestHDBSCANTuning.m
43 lines (35 loc) · 1.05 KB
/
BestHDBSCANTuning.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
function [minPts,minClusterSize,minThresholdSize] = BestHDBSCANTuning(x,y)
currentBestDBI = 1;
%epsilon = 0.1:0.1:1.5;
minPts = 3:1:6;
minClusterSize = 3:1:6;
tresholdSize = 0.7:0.1:1.0;
%list = zeros(length(epsilon),length(minPts));
for i=1:length(minPts)
for j=1:length(minClusterSize)
for k=1:length(tresholdSize)
[idx,C] = HDBSCANClustering2(x, y, minPts(i), minClusterSize(j),tresholdSize(k));
data = [y;x]';
DB = DBIndex(data,idx,C);
if DB == 0
DB = 1;
end
%list(i,j) = DB; %For plotting
if DB < currentBestDBI
currentBestDBI = DB;
currentBestMinPts = minPts(i);
currentBestMinClusterSize = minClusterSize(j);
currentBestThresholdSize = tresholdSize(k);
end
end
end
end
% surf(list)
% xlabel('minpts')
% ylabel('eps')
% zlabel('DBI')
%Output
minPts = currentBestMinPts;
minClusterSize = currentBestMinClusterSize;
minThresholdSize = currentBestThresholdSize;
end