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