-
Notifications
You must be signed in to change notification settings - Fork 36
/
RunClusteringKShape.m
43 lines (27 loc) · 1.52 KB
/
RunClusteringKShape.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 RunClusteringKShape(DataSetStartIndex, DataSetEndIndex)
% first 2 values are '.' and '..' - UCR Archive 2018 version has 128 datasets
dir_struct = dir('/rigel/dsi/users/ikp2103/VLDBGRAIL/UCR2018/');
Datasets = {dir_struct(3:130).name};
% Sort Datasets
[Datasets, DSOrder] = sort(Datasets);
for i = 1:length(Datasets)
if (i>=DataSetStartIndex & i<=DataSetEndIndex)
disp(['Dataset being processed: ', char(Datasets(i))]);
DS = LoadUCRdataset(char(Datasets(i)));
Results = zeros(length(Datasets),2);
for rep = 1 : 10
rep
rng(rep);
tic;
[mem cent] = kShape(DS.Data, length(DS.ClassNames));
ClusteringTime = toc;
RI = RandIndex(mem, DS.DataClassLabels);
ResultsTmp = [RI,ClusteringTime];
%
Results(i,:) = Results(i,:) + ResultsTmp;
end
Results(i,:) = Results(i,:) ./ 10;
dlmwrite( strcat( '/rigel/dsi/users/ikp2103/VLDBGRAIL/RunClusteringKShape/','RunClusteringKShape_Dataset_', num2str(i)), Results, 'delimiter', '\t');
end
end
end