-
Notifications
You must be signed in to change notification settings - Fork 1
/
plot_figures.m
139 lines (106 loc) · 4.02 KB
/
plot_figures.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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
clear all
close all
%% UCR
T=readtable('results/HDC_MINIROCKET_results.xlsx','Sheet','UCR');
num_ds = 128;
% indices
idx_minirocket = 2;
idx_select_best_s_xval = 10;
% results
results_minirocket = T{1:num_ds,idx_minirocket};
best_hdc_minirocket_xval = T{1:num_ds,idx_select_best_s_xval};
num_scale = 7;
results_hdc_minirocket = [];
for scale = 1:num_scale
results_hdc_minirocket(:,end+1) = T{1:num_ds,scale+1};
end
optimal_hdc_minirocket = max(results_hdc_minirocket,[],2);
%% pairwise accuracy with auto and optimal selected s
figure()
X = results_minirocket;
x = linspace(0,1,50);
y = linspace(0,1,50);
scatter([X,X],[optimal_hdc_minirocket, best_hdc_minirocket_xval],100,'.')
hold on
grid on
plot (x,y,'--','color','#666')
xlabel('MiniROCKET')
ylabel('HDC-MiniROCKET')
legend({'optimal selection of s (oracle)','simple data-driven selection of s'},'Position',[0.55 0.23 0.15 0.06])
% title('Pairwise comparison of MiniROCKET and HDC-MiniROCKET')
text(0.05,0.95,"HDC-MiniROCKET is better")
text(0.5,0.05,"MiniROCKET is better")
xlim([0,1])
ylim([0 1])
set(gcf,'color','w')
set(gcf,'Position',[100 100 450 350])
saveas(gcf,'images/pairwise_ucr_auto_s','epsc')
%% barplot with relativ performance change
figure()
change_auto = (best_hdc_minirocket_xval - results_minirocket)./results_minirocket;
change_optimal = (optimal_hdc_minirocket - results_minirocket)./results_minirocket;
% find where is a change
idx = find((abs(change_auto)+abs(change_optimal))>0);
bar([change_optimal(idx)*100, change_auto(idx)*100])
% load dataset infos
xticks(1:size(idx,1));
xlabels = T.UCR_idx(idx);
xticklabels(xlabels);
xtickangle(90);
legend({'optimal selection of s (oracle)','simple data-driven selection of s'})
set(gcf,'color','w')
set(gcf,'Position',[100 100 1500 350])
grid on
% title('Relative change in accuracy with optimal and simple data-driven selection of s for HDC-MiniROCKET')
xlabel('UCR Dataset index')
ylabel('relative Accuracy change [%]')
saveas(gcf,'images/ucr_results_auto_s','epsc')
%% plot acc over different s
figure()
delta = results_hdc_minirocket-results_hdc_minirocket(:,1);
z = 0.12;
colorMap = customcolormap([0 z 1], [0 0 1; 1 1 1; 1 0 0]);
h = heatmap(delta,'Colormap',colorMap,'GridVisible','off')
x_labels = 1:num_ds;
idx = mod(x_labels,10)>0; % index of datetime values to show as x tick
h.YDisplayLabels(idx) = {''};
h.XDisplayLabels = {'0','1','2','3','4','5','6'}
xlabel('parameter s')
ylabel('dataset ID')
set(gcf,'color','w')
set(gcf,'Position',[100 100 700 400])
saveas(gcf,'images/ucr_diff_surf','epsc')
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% eval time effort
T_time_hdc=readtable('results/HDC_MINIROCKET_time_results.xlsx','Sheet','UCR');
T_time_orig=readtable('results/MINIROCKET_time_results.xlsx','Sheet','UCR');
preproc_train_minirocket = T_time_orig{1:128,"train_time_preproc"};
learning_minirocket = T_time_orig{1:128,"train_time"};
preproc_test_minirocket = T_time_orig{1:128,"test_time_preproc"};
inference_minirocket = T_time_orig{1:128,"test_time"};
preproc_train__hdc_minirocket = T_time_hdc{1:128,"train_time_preproc"};
learning_hdc_minirocket = T_time_hdc{1:128,"train_time"};
preproc_test_hdc_minirocket = T_time_hdc{1:128,"test_time_preproc"};
inference_hdc_minirocket = T_time_hdc{1:128,"test_time"};
complete_inference_minirocket = inference_minirocket + preproc_test_minirocket;
complete_inference_hdc_minirocket = inference_hdc_minirocket + preproc_test_hdc_minirocket;
figure()
x = linspace(0,100,5000);
y = linspace(0,100,5000);
scatter(complete_inference_minirocket,complete_inference_hdc_minirocket,100,'.')
grid on
hold on
plot (x,y,'--','color','#666')
set(gca,'xscale','log')
set(gca,'yscale','log')
axis equal
xlim([-inf 10^1.5])
ylim([-inf 10^1.5])
xlabel('MiniROCKET inference time [s]')
ylabel('HDC-MiniROCKET inference time [s]')
% title('Inference Time of MiniROCKET and HDC-MiniROCKET per dataset')
text(0.025,15,"HDC-MiniROCKET is slower")
text(1,0.05,"MiniROCKET is slower")
set(gcf,'color','w')
set(gcf,'Position',[100 100 400 400])
saveas(gcf,'images/pairwise_time_ucr','epsc')