jordan@1: function data = collect_all_mirex_results(base_directory, dsets, algos) jordan@1: % function data = collect_all_mirex_results(base_directory, dsets, algos) jordan@1: % GET ALL THE DATA! jordan@1: % This function collects the evaluation results for all algorithms from all years of MIREX. jordan@1: % It puts it all in a single structure. jordan@1: % jordan@1: % BASE_DIRECTORY should be the "mirex_path" specified in "get_mirex_estimates.rb", jordan@1: % or whatever directory contains all the downloaded MIREX data. For example: jordan@2: % "/Users/me/Desktop/MIREX_data" jordan@1: % jordan@1: % DSETS should contain the names of the datasets. The default value is all of them: jordan@1: % {'mrx09','mrx10_1','mrx10_2','sal'} jordan@1: % Keep the DSETS in a consistent order across your work, because the index of the dataset jordan@1: % is important for some of the other functions. jordan@1: % jordan@1: % ALGOS should contain the name of all the algorithms. The default value is all of them: jordan@1: % {'KSP1','KSP2','KSP3','MHRAF1','OYZS1','SBV1','SMGA1','SMGA2','SP1'} jordan@1: % As with the DSETS, keep these names consistent across all work. jordan@1: % jordan@1: % The output DATA structure contains the following fields: jordan@1: % jordan@1: % DATA(k).ALGO(j).RESULTS is a matrix giving the results for the kth dataset and jordan@1: % the jth algorithm. jordan@1: jordan@1: if nargin<2, jordan@1: dsets = {'mrx09','mrx10_1','mrx10_2','sal'}; jordan@1: end jordan@1: if nargin<3, jordan@1: algos = {'KSP1','KSP2','KSP3','MHRAF1','OYZS1','SBV1','SMGA1','SMGA2','SP1'}; jordan@1: end jordan@1: jordan@1: % Create output structure DATA. jordan@1: % DATA(k).ALGO(j).RESULTS will contain the results attained by algorithm J for all songs in dataset K. jordan@1: data = {}; jordan@1: jordan@1: % For every dataset (DSET), look at every algorithm (ALGO), and load the CSV file containing all the results. jordan@1: for k=1:length(dsets), jordan@1: dset = dsets{k}; jordan@1: for j=1:length(algos), jordan@1: algo = algos{j}; jordan@1: % Build the name of the CSV file: jordan@1: csv_file = fullfile(base_directory,dset,algo,'per_track_results.csv'); jordan@1: fid = fopen(csv_file); jordan@1: % Read it, assuming the first line is a header: jordan@1: 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: fclose(fid); jordan@1: data(k).algo(j).names = data_tmp{2}; jordan@1: data(k).algo(j).results = zeros(size(data_tmp{1},1),length(data_tmp)-2); jordan@1: % The first two columns contain a dummy variable and the name of the song, respectively. Ignore these. jordan@1: for i=3:length(data_tmp) jordan@1: data(k).algo(j).results(:,i-2) = data_tmp{i}; jordan@1: end jordan@1: end jordan@4: end jordan@4: fprintf('Oh by the way, I just collected all the results spreadsheets into a data structure. That was fast.\n\n')