jordan@1
|
1 function [mir2pub pub2mir pwf] = match_mirex_to_public_data_macro(mir2pub, pub2mir, pwf, miranns, pubanns, rel_mir, rel_pub, length_thresh, quality_thresh)
|
jordan@1
|
2
|
jordan@1
|
3 tic
|
jordan@1
|
4 unmatched_mirdata = find(max(transpose(pwf))<.99);
|
jordan@1
|
5 unmatched_pubdata = find(max(pwf)<.99);
|
jordan@1
|
6 % This is how many more songs we have to match.
|
jordan@1
|
7 length(unmatched_mirdata)
|
jordan@1
|
8 if ~isempty(unmatched_mirdata) & ~isempty(unmatched_pubdata),
|
jordan@1
|
9
|
jordan@1
|
10 for i=row(unmatched_mirdata),
|
jordan@1
|
11 dothese = find(max(pwf)<.99 & pwf(i,:)==0);
|
jordan@1
|
12 for j=dothese,
|
jordan@1
|
13 if (abs(miranns(rel_mir(i)).tim(end)-pubanns(rel_pub(j)).tim(end)) < length_thresh),
|
jordan@1
|
14 res = boundary_grader(miranns(rel_mir(i)).tim, pubanns(rel_pub(j)).tim, 1, 3);
|
jordan@1
|
15 pwf(i,j) = res(1);
|
jordan@1
|
16 end
|
jordan@1
|
17 end
|
jordan@1
|
18 toc
|
jordan@1
|
19 end
|
jordan@1
|
20 end
|
jordan@1
|
21
|
jordan@1
|
22 % After running that, we can update our matches.
|
jordan@1
|
23 % We will choose, for each MIREX song, the best matching public annotation as long as it has a pwf value of at least 0.99.
|
jordan@1
|
24 % (If we just picked the best one, it obviously might be a non-match.)
|
jordan@1
|
25 % We will also choose the best-matching MIREX song for each public annotation in the same manner. This means that the best
|
jordan@1
|
26 % match from mir2pub and from pub2mir could be different! This is expected, since any song by the Beatles will show up
|
jordan@1
|
27 % only once in MIREX, but could show up several times in the public data.
|
jordan@1
|
28
|
jordan@1
|
29 % Recall:
|
jordan@1
|
30 % rel_mir lists the indices (in miranns) of the mir songs we are looking at.
|
jordan@1
|
31 % rel_pub lists the indices (in pubanns) of the pub songs we are looking at.
|
jordan@1
|
32 % We want to find, for each miranns index, which pubanns index matches it.
|
jordan@1
|
33
|
jordan@1
|
34 % Pick best public match for each MIREX annotation:
|
jordan@1
|
35 for i=1:length(rel_mir),
|
jordan@1
|
36 miranns_id = rel_mir(i);
|
jordan@1
|
37 [value rel_pub_id] = max(pwf(i,:));
|
jordan@1
|
38 if value>=quality_thresh,
|
jordan@1
|
39 pubanns_id = rel_pub(rel_pub_id);
|
jordan@1
|
40 mir2pub(miranns_id) = pubanns_id;
|
jordan@1
|
41 pub2mir(pubanns_id) = miranns_id;
|
jordan@1
|
42 end
|
jordan@1
|
43 end
|
jordan@1
|
44
|
jordan@1
|
45 % Pick best MIREX match for each public annotation:
|
jordan@1
|
46 for i=1:length(rel_pub),
|
jordan@1
|
47 pubanns_id = rel_pub(i);
|
jordan@1
|
48 [value rel_mir_id] = max(pwf(:,i));
|
jordan@1
|
49 if value>=quality_thresh,
|
jordan@1
|
50 miranns_id = rel_mir(rel_mir_id);
|
jordan@1
|
51 pub2mir(pubanns_id) = miranns_id;
|
jordan@1
|
52 mir2pub(miranns_id) = pubanns_id;
|
jordan@1
|
53 end
|
jordan@1
|
54 end |