Home > . > bestByTestTrial.m

bestByTestTrial

PURPOSE ^

SYNOPSIS ^

function [best,names] = bestByTestTrial(CV,printp)

DESCRIPTION ^

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function [best,names] = bestByTestTrial(CV,printp)
0002 
0003 if nargin < 2
0004 printp = 1;
0005 end
0006 
0007 names = {CV.cvresultsNames{:} 'Val Frac Corr'};% 'Test RMSE'};
0008 
0009 best = [];
0010 %% Find mean of cv repetitions.
0011 nreps = CV.validate.repetitions;
0012 
0013 mat = CV.cvresults(:,1:end-nreps);
0014 z=CV.cvresults(:,end-nreps+1:end);
0015 mat = [mat mean(CV.cvresults(:,end-nreps+1:end),2)];
0016 
0017 for testtrial = unique(mat(:,1))'  %first column is test trials
0018 best1 = [];
0019   submat = mat(mat(:,1)==testtrial,:);
0020   [junk,index]=max(submat(:,end));
0021   for i = 1:size(mat,2)
0022     if printp
0023       if i==size(mat,2)
0024     fprintf(1,'%s %5.1f ',names{i},100*submat(index,i));
0025       else
0026     fprintf(1,'%s %g ',names{i},submat(index,i));
0027       end
0028     end
0029     best1 = [best1 submat(index,i)];
0030   end
0031   testres = CV.testResults{testtrial}{6};
0032   if printp, fprintf(1,'Test Frac Corr %5.1f',testres*100); end
0033 best1 = [best1 CV.testResults{testtrial}{6}];
0034 best = [best; best1];
0035   if printp, fprintf(1,'\n'); end;
0036 end
0037 
0038 fprintf(1,'Check below to see if best parameters agree\n');
0039 summarizeTestResults(CV);

Generated on Tue 07-Feb-2006 12:02:57 by m2html © 2003