i running script in matlab obtain random permutations test of matrix in order obtain cross-validation accuracy values. script follows:
%randperm labels = [zeros(40,1); ones(40,1)]; = 1:500 p = labels(randperm(length(labels))); end bestcv = 0; log2c = -10:10, log2g = -10:10, cmd = ['-s 0 -t 0 -v 20 -c ', num2str(2^log2c), ' -g ', num2str(2^log2g) ' -q ']; cv = svmtrain(labels, p, cmd); if (cv > bestcv), bestcv = cv; bestc = 2^log2c; bestg = 2^log2g; fprintf('%g %g %g (best c = %g, g = %g, rate = %g)\n', log2c, log2g, cv, bestc, bestg, bestcv); end end end cmd = ['-s 0 -t 0 -c ', num2str(bestc), ' -g ', num2str(bestg)]; i wondering how can save output (500 cross-validation accuracy values) text file, , if possible write code.
thanks in advance,
andrea c
you can save variable(s) containing cross-validation results using save , load them later using load. example, assuming have results in variable called accuracies:
save('cross-validation-results.txt',accuracies); and later
load('cross-validation-results.txt'); to reobtain variable accuracies.
to implement in code, save tuning parameters , associated accuracy arrays , save said arrays.
Comments
Post a Comment