christopherh@1
|
1 %GETRECALL get frame-based chord symbol recall
|
christopherh@1
|
2 %
|
christopherh@1
|
3 %[recall, nondictionary] = getrecall(estimates, annotations,cardinality)
|
christopherh@1
|
4 %
|
christopherh@1
|
5 % params.comparison = 'ov';
|
christopherh@1
|
6 % params.cardinality = 3;
|
christopherh@1
|
7 % params.inversion = 0;
|
christopherh@1
|
8 % params.dictionary = {'X:maj', 'X:min'};
|
christopherh@1
|
9
|
christopherh@1
|
10 function [recall, nondictionary] = getrecall3(estimates_labfile, annotations_labfile,params)
|
christopherh@1
|
11
|
christopherh@1
|
12
|
christopherh@1
|
13 [at1, at2, as] = merge_repeats(annotations_labfile);
|
christopherh@1
|
14
|
christopherh@1
|
15 [et1, et2, es] = merge_repeats(estimates_labfile);
|
christopherh@1
|
16
|
christopherh@1
|
17
|
christopherh@1
|
18 %indeces for E and A
|
christopherh@1
|
19 i = 1;
|
christopherh@1
|
20 j = 1;
|
christopherh@1
|
21
|
christopherh@1
|
22 ilength = length(et1);
|
christopherh@1
|
23 jlength = length(at1);
|
christopherh@1
|
24
|
christopherh@1
|
25 % find length in Nt of annotated sequence
|
christopherh@1
|
26 %alength = length(annotations);
|
christopherh@1
|
27
|
christopherh@1
|
28 % find length in Nt of estimated sequence
|
christopherh@1
|
29 %elength = length(estimates);
|
christopherh@1
|
30
|
christopherh@1
|
31 % use lesser value for evaluation
|
christopherh@1
|
32 %ilength = min(alength,elength);
|
christopherh@1
|
33
|
christopherh@1
|
34 Nc = 0; % number of successfully matched Nt
|
christopherh@1
|
35
|
christopherh@1
|
36 Nt = 0; % total number of evaluated Nt
|
christopherh@1
|
37
|
christopherh@1
|
38 Ne = 0;
|
christopherh@1
|
39
|
christopherh@1
|
40 seg_start= 0;
|
christopherh@1
|
41 seg_end = 0;
|
christopherh@1
|
42
|
christopherh@1
|
43 Tc = 0;
|
christopherh@1
|
44 Ti = 0;
|
christopherh@1
|
45 Tt = 0;
|
christopherh@1
|
46
|
christopherh@1
|
47 while i <= ilength & j <= jlength
|
christopherh@1
|
48
|
christopherh@1
|
49 segstart = max(at1(j), et1(i));
|
christopherh@1
|
50 segend = min(at2(j), et2(i));
|
christopherh@1
|
51
|
christopherh@1
|
52 [match, success, errormessage] = comparechords2(char(es{i}),char(as{j}), params.comparison, params.cardinality, params.inversion);
|
christopherh@1
|
53
|
christopherh@1
|
54 includeE = indictionary(char(es{i}), params.dictionary, params.comparison, params.cardinality);
|
christopherh@1
|
55 includeA = indictionary(char(as{j}), params.dictionary, params.comparison, params.cardinality);
|
christopherh@1
|
56
|
christopherh@1
|
57 seglength = segend-segstart;
|
christopherh@1
|
58
|
christopherh@1
|
59 Tc = Tc + (match * includeE * seglength);
|
christopherh@1
|
60
|
christopherh@1
|
61 Ti = Ti + (includeA * seglength);
|
christopherh@1
|
62
|
christopherh@1
|
63 Tt = Tt + seglength;
|
christopherh@1
|
64
|
christopherh@1
|
65 if at2(j) > segend
|
christopherh@1
|
66 i = i+1;
|
christopherh@1
|
67 elseif et2(i) > segend
|
christopherh@1
|
68 j= j+1;
|
christopherh@1
|
69 else
|
christopherh@1
|
70 i = i+1;
|
christopherh@1
|
71 j = j+1;
|
christopherh@1
|
72 end
|
christopherh@1
|
73
|
christopherh@1
|
74 end
|
christopherh@1
|
75
|
christopherh@1
|
76 % recall is number of correct matches out of total evaluated Nt
|
christopherh@1
|
77 recall = Tc/Ti;
|
christopherh@1
|
78
|
christopherh@1
|
79 % percentage of annotations that were non-dictionary chords so ignored
|
christopherh@1
|
80 nondictionary = 1-(Ti/Tt);
|