annotate collect_all_mirex_results.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 data = collect_all_mirex_results(base_directory, dsets, algos)
jordan@1 2 % function data = collect_all_mirex_results(base_directory, dsets, algos)
jordan@1 3 % GET ALL THE DATA!
jordan@1 4 % This function collects the evaluation results for all algorithms from all years of MIREX.
jordan@1 5 % It puts it all in a single structure.
jordan@1 6 %
jordan@1 7 % BASE_DIRECTORY should be the "mirex_path" specified in "get_mirex_estimates.rb",
jordan@1 8 % or whatever directory contains all the downloaded MIREX data. For example:
jordan@2 9 % "/Users/me/Desktop/MIREX_data"
jordan@1 10 %
jordan@1 11 % DSETS should contain the names of the datasets. The default value is all of them:
jordan@1 12 % {'mrx09','mrx10_1','mrx10_2','sal'}
jordan@1 13 % Keep the DSETS in a consistent order across your work, because the index of the dataset
jordan@1 14 % is important for some of the other functions.
jordan@1 15 %
jordan@1 16 % ALGOS should contain the name of all the algorithms. The default value is all of them:
jordan@1 17 % {'KSP1','KSP2','KSP3','MHRAF1','OYZS1','SBV1','SMGA1','SMGA2','SP1'}
jordan@1 18 % As with the DSETS, keep these names consistent across all work.
jordan@1 19 %
jordan@1 20 % The output DATA structure contains the following fields:
jordan@1 21 %
jordan@1 22 % DATA(k).ALGO(j).RESULTS is a matrix giving the results for the kth dataset and
jordan@1 23 % the jth algorithm.
jordan@1 24
jordan@1 25 if nargin<2,
jordan@1 26 dsets = {'mrx09','mrx10_1','mrx10_2','sal'};
jordan@1 27 end
jordan@1 28 if nargin<3,
jordan@1 29 algos = {'KSP1','KSP2','KSP3','MHRAF1','OYZS1','SBV1','SMGA1','SMGA2','SP1'};
jordan@1 30 end
jordan@1 31
jordan@1 32 % Create output structure DATA.
jordan@1 33 % DATA(k).ALGO(j).RESULTS will contain the results attained by algorithm J for all songs in dataset K.
jordan@1 34 data = {};
jordan@1 35
jordan@1 36 % For every dataset (DSET), look at every algorithm (ALGO), and load the CSV file containing all the results.
jordan@1 37 for k=1:length(dsets),
jordan@1 38 dset = dsets{k};
jordan@1 39 for j=1:length(algos),
jordan@1 40 algo = algos{j};
jordan@1 41 % Build the name of the CSV file:
jordan@1 42 csv_file = fullfile(base_directory,dset,algo,'per_track_results.csv');
jordan@1 43 fid = fopen(csv_file);
jordan@1 44 % Read it, assuming the first line is a header:
jordan@1 45 data_tmp = textscan(fid,'%n%s%n%n%n%n%n%n%n%n%n%n%n%n%n%n','Delimiter',',','HeaderLines',1);
jordan@1 46 fclose(fid);
jordan@1 47 data(k).algo(j).names = data_tmp{2};
jordan@1 48 data(k).algo(j).results = zeros(size(data_tmp{1},1),length(data_tmp)-2);
jordan@1 49 % The first two columns contain a dummy variable and the name of the song, respectively. Ignore these.
jordan@1 50 for i=3:length(data_tmp)
jordan@1 51 data(k).algo(j).results(:,i-2) = data_tmp{i};
jordan@1 52 end
jordan@1 53 end
jordan@4 54 end
jordan@4 55 fprintf('Oh by the way, I just collected all the results spreadsheets into a data structure. That was fast.\n\n')