-
Notifications
You must be signed in to change notification settings - Fork 39
/
Copy pathDMComp_TestToTrain.m
42 lines (37 loc) · 1.6 KB
/
DMComp_TestToTrain.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
function DM = DMComp_TestToTrain(X,Y,DistanceIndex,Parameter1, Parameter2)
addpath(genpath('lockstepmeasures/.'));
addpath(genpath('slidingmeasures/.'));
addpath(genpath('elasticmeasures/.'));
javaaddpath('./timeseries-1.0-SNAPSHOT.jar');
javaaddpath('./simcompare.jar');
obj = edu.uchicago.cs.tsdb.Distance;
[nrowsX, TSLength]=size(X);
[nrowsY, ~]=size(Y);
DM = zeros(nrowsX,nrowsY);
for i=1:nrowsX
disp(i);
tmpX = X(i,:);
for j=1:nrowsY
if DistanceIndex==1
DM(i,j) = ED(tmpX,Y(j,:));
elseif DistanceIndex==2
DM(i,j) = 1-max( NCCc(tmpX,Y(j,:)) );
elseif DistanceIndex==3
DM(i,j) = MSM_mex(tmpX,Y(j,:), Parameter1);
elseif DistanceIndex==4
DM(i,j) = dtw(tmpX,Y(j,:), Parameter1);
elseif DistanceIndex==5
DM(i,j) = edr(tmpX,Y(j,:), Parameter1);
elseif DistanceIndex==6
%DM(i,j) = LCSS(tmpX',Y(j,:)',Parameter1,Parameter2);
DM(i,j) = obj.LCSSDistance(tmpX,Y(j,:),Parameter1,Parameter2);
elseif DistanceIndex==7
DM(i,j) = TWED_mex(tmpX,1:TSLength,Y(j,:),1:TSLength,Parameter1,Parameter2);
elseif DistanceIndex==8
DM(i,j) = obj.SwaleDistance(tmpX,Y(j,:),0,1,Parameter1);
elseif DistanceIndex==9
DM(i,j) = obj.ERPDistance(tmpX,Y(j,:));
end
end
end
end