annotate match_mirex_to_public_data_macro.m @ 6:e2337cd691b1 tip

Finishing writing the matlab code to replicate all observations made in the article. Added the article to the repository. Renamed the two main scripts ("1-get_mirex_estimates.rb" and "2-generate_smith2013_ismir.m") to not have dashes (since this was annoying within Matlab) Added new Michael Jackson figure.
author Jordan Smith <jordan.smith@eecs.qmul.ac.uk>
date Wed, 05 Mar 2014 01:02:26 +0000
parents 92b5a46bc67b
children
rev   line source
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@4 7
jordan@4 8 fprintf('FYI: there are %i songs in this dataset that have not yet been matched.\n',length(unmatched_mirdata))
jordan@1 9 if ~isempty(unmatched_mirdata) & ~isempty(unmatched_pubdata),
jordan@1 10
jordan@1 11 for i=row(unmatched_mirdata),
jordan@1 12 dothese = find(max(pwf)<.99 & pwf(i,:)==0);
jordan@1 13 for j=dothese,
jordan@1 14 if (abs(miranns(rel_mir(i)).tim(end)-pubanns(rel_pub(j)).tim(end)) < length_thresh),
jordan@1 15 res = boundary_grader(miranns(rel_mir(i)).tim, pubanns(rel_pub(j)).tim, 1, 3);
jordan@1 16 pwf(i,j) = res(1);
jordan@1 17 end
jordan@1 18 end
jordan@4 19 % toc
jordan@1 20 end
jordan@1 21 end
jordan@1 22
jordan@1 23 % After running that, we can update our matches.
jordan@1 24 % 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 25 % (If we just picked the best one, it obviously might be a non-match.)
jordan@1 26 % We will also choose the best-matching MIREX song for each public annotation in the same manner. This means that the best
jordan@1 27 % match from mir2pub and from pub2mir could be different! This is expected, since any song by the Beatles will show up
jordan@1 28 % only once in MIREX, but could show up several times in the public data.
jordan@1 29
jordan@1 30 % Recall:
jordan@1 31 % rel_mir lists the indices (in miranns) of the mir songs we are looking at.
jordan@1 32 % rel_pub lists the indices (in pubanns) of the pub songs we are looking at.
jordan@1 33 % We want to find, for each miranns index, which pubanns index matches it.
jordan@1 34
jordan@1 35 % Pick best public match for each MIREX annotation:
jordan@1 36 for i=1:length(rel_mir),
jordan@1 37 miranns_id = rel_mir(i);
jordan@1 38 [value rel_pub_id] = max(pwf(i,:));
jordan@1 39 if value>=quality_thresh,
jordan@1 40 pubanns_id = rel_pub(rel_pub_id);
jordan@1 41 mir2pub(miranns_id) = pubanns_id;
jordan@1 42 pub2mir(pubanns_id) = miranns_id;
jordan@1 43 end
jordan@1 44 end
jordan@1 45
jordan@1 46 % Pick best MIREX match for each public annotation:
jordan@1 47 for i=1:length(rel_pub),
jordan@1 48 pubanns_id = rel_pub(i);
jordan@1 49 [value rel_mir_id] = max(pwf(:,i));
jordan@1 50 if value>=quality_thresh,
jordan@1 51 miranns_id = rel_mir(rel_mir_id);
jordan@1 52 pub2mir(pubanns_id) = miranns_id;
jordan@1 53 mir2pub(miranns_id) = pubanns_id;
jordan@1 54 end
jordan@1 55 end