-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbaseline.m
46 lines (39 loc) · 1.14 KB
/
baseline.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
function [precision, recall, duration] = baseline(noise_percentage, seed)
rng(seed);
util = Utility();
solver = Solver();
solver = solver.initialize();
num_day = 120;
event_flag = util.get_event_flag(num_day);
clear_signal = util.get_clear_signal(event_flag);
noise_signal = util.get_noisy_signal(clear_signal, noise_percentage);
temporal_signal = solver.apply_temporal_condition(noise_signal);
combined_signal = noise_signal + max(noise_signal) / max(temporal_signal) * temporal_signal;
tic;
solution = solver.baseline_solve(temporal_signal);
duration = toc;
[precision, recall] = solver.score(solution, event_flag);
% % debug
% fprintf('baseline_solve: %f %f\n', precision, recall);
% subplot(1, 3, 1);
% plot(clear_signal);
% for i = 1:length(solution)
% t = solution(i);
% xline(t-9);
% xline(t+9);
% end
% subplot(1, 3, 2);
% plot(noise_signal);
% for i = 1:length(solution)
% t = solution(i);
% xline(t-9);
% xline(t+9);
% end
% subplot(1, 3, 3);
% plot(temporal_signal);
% for i = 1:length(solution)
% t = solution(i);
% xline(t-9);
% xline(t+9);
% end
end