christopherh@1: %GETRECALL get frame-based chord symbol recall christopherh@1: % christopherh@1: %[recall, nondictionary] = getrecall(estimates, annotations,cardinality) christopherh@1: % christopherh@1: % params.comparison = 'ov'; christopherh@1: % params.cardinality = 3; christopherh@1: % params.inversion = 0; christopherh@1: % params.dictionary = {'X:maj', 'X:min'}; christopherh@1: christopherh@1: function [recall, nondictionary] = getrecall3(estimates_labfile, annotations_labfile,params) christopherh@1: christopherh@1: christopherh@1: [at1, at2, as] = merge_repeats(annotations_labfile); christopherh@1: christopherh@1: [et1, et2, es] = merge_repeats(estimates_labfile); christopherh@1: christopherh@1: christopherh@1: %indeces for E and A christopherh@1: i = 1; christopherh@1: j = 1; christopherh@1: christopherh@1: ilength = length(et1); christopherh@1: jlength = length(at1); christopherh@1: christopherh@1: % find length in Nt of annotated sequence christopherh@1: %alength = length(annotations); christopherh@1: christopherh@1: % find length in Nt of estimated sequence christopherh@1: %elength = length(estimates); christopherh@1: christopherh@1: % use lesser value for evaluation christopherh@1: %ilength = min(alength,elength); christopherh@1: christopherh@1: Nc = 0; % number of successfully matched Nt christopherh@1: christopherh@1: Nt = 0; % total number of evaluated Nt christopherh@1: christopherh@1: Ne = 0; christopherh@1: christopherh@1: seg_start= 0; christopherh@1: seg_end = 0; christopherh@1: christopherh@1: Tc = 0; christopherh@1: Ti = 0; christopherh@1: Tt = 0; christopherh@1: christopherh@1: while i <= ilength & j <= jlength christopherh@1: christopherh@1: segstart = max(at1(j), et1(i)); christopherh@1: segend = min(at2(j), et2(i)); christopherh@1: christopherh@1: [match, success, errormessage] = comparechords2(char(es{i}),char(as{j}), params.comparison, params.cardinality, params.inversion); christopherh@1: christopherh@1: includeE = indictionary(char(es{i}), params.dictionary, params.comparison, params.cardinality); christopherh@1: includeA = indictionary(char(as{j}), params.dictionary, params.comparison, params.cardinality); christopherh@1: christopherh@1: seglength = segend-segstart; christopherh@1: christopherh@1: Tc = Tc + (match * includeE * seglength); christopherh@1: christopherh@1: Ti = Ti + (includeA * seglength); christopherh@1: christopherh@1: Tt = Tt + seglength; christopherh@1: christopherh@1: if at2(j) > segend christopherh@1: i = i+1; christopherh@1: elseif et2(i) > segend christopherh@1: j= j+1; christopherh@1: else christopherh@1: i = i+1; christopherh@1: j = j+1; christopherh@1: end christopherh@1: christopherh@1: end christopherh@1: christopherh@1: % recall is number of correct matches out of total evaluated Nt christopherh@1: recall = Tc/Ti; christopherh@1: christopherh@1: % percentage of annotations that were non-dictionary chords so ignored christopherh@1: nondictionary = 1-(Ti/Tt);