-
Notifications
You must be signed in to change notification settings - Fork 0
/
runMetricsComparison_xcorr.m
75 lines (56 loc) · 2.09 KB
/
runMetricsComparison_xcorr.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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
% /* --------------------------------------------------------------------------------------
% * File: runMetricsComparison.m
% * Date: 01/06/2015
% * Author: David Pastor Escuredo, [email protected]
% * Version: 0.2
% * License: BSD
% * --------------------------------------------------------------------------------------
% Copyright (c) 2013-2017, David Pastor Escuredo
% with Biomedical Image Technology, UPM (BIT-UPM)
% with BioEmergences, CNRS
% with LifeD lab
% All rights reserved.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%% SPATIO-TEMPORAL CLUSTERS %%%%%%%%%%%%%%%%%%%%%%%
addpath('colormaps')
cs=1;
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%% Calculate distance to LBPs of the reference %%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%D=zeros(size(clus,2), size(clus,2));
%Df=zeros(size(clus,2), size(clus,2));
D=zeros(size(clus,2), 5);
Df=zeros(size(clus,2), 5);
lag=5
%WE COMPARE AT LEAST 3 TIME STEPS
%We skip t=1 as the lagrangian is all 1
for j=1:size(clus,1)
clustj=clus(j,:);
for b=1:size(lbpRef,1)
x=xcorr(clustj,lbpRef(b,:),lag,'coeff');
%c=xcov(clustj,lbpRef(b,:),0,'coeff')
%cc=pdist2(clustj,lbpRef(b,:),'correlation')
%xx=corrcoef(clustj,lbpRef(b,:))
%r=corr(clustj',lbpRef(b,:)')
%max(c)
%max(x)
%pause
dclustj(b)=1-max(x);
end
dclust(j)=min(dclustj);
end
dref=prctile(dclust,25);
dref2=prctile(dclust,75);
drefmin=min(dclust);
drefmax=max(dclust);
drefm=mean(dclust);
s_yl=[0.02 0.1 0.1 0.1 0.1]
h=figure
boxplot(dclust,'colors',[0.4 0.4 0.4])
ylim([0 s_yl(c)])
set(gca,'XTick',[])
set(gca,'XTickLabel',[],'FontSize',18)
set(gca,'YTick',[0 s_yl(c)])
set(gca,'YTickLabel',[0 s_yl(c)],'FontSize',18)
saveas(h,[StatsPath dataset tagfolder filesep 'boxplot_score' '-' tagDesc '_' num2str(lag) '.png'],'png')
%dlmwrite([desc 'score' '-' tagDesc '_v2.csv'],D)