From 6337040b39ae84adf394bcb11e1637c72ebc1840 Mon Sep 17 00:00:00 2001 From: hanssusilo Date: Thu, 3 Mar 2016 17:49:17 -0500 Subject: [PATCH 1/7] added svm with subgradients including demo --- gurls/defopt.m | 3 + gurls/demo/demo_svmsubgradient.m | 95 +++++++++++++++++++++++++++ gurls/gurls_defopt.m | 3 + gurls/optimizers/rls_svmsubgradient.m | 64 ++++++++++++++++++ 4 files changed, 165 insertions(+) create mode 100644 gurls/demo/demo_svmsubgradient.m create mode 100644 gurls/optimizers/rls_svmsubgradient.m diff --git a/gurls/defopt.m b/gurls/defopt.m index 816eb6d..d8b8138 100644 --- a/gurls/defopt.m +++ b/gurls/defopt.m @@ -67,6 +67,9 @@ opt.epochs = 4; opt.subsize = 50; opt.calibfile = 'foo'; + + %% Subgradient + opt.Niter= 100; %% Random features options opt.randfeats = struct(); diff --git a/gurls/demo/demo_svmsubgradient.m b/gurls/demo/demo_svmsubgradient.m new file mode 100644 index 0000000..af3f77f --- /dev/null +++ b/gurls/demo/demo_svmsubgradient.m @@ -0,0 +1,95 @@ +clear all; +close all; + +% dataset = 'breastcancer'; +dataset = 'yeast'; +if strcmp(dataset,'breastcancer') + load(fullfile(gurls_root, 'demo/data/breastcancer_data.mat')); + ytr = ytr*2-1; yte = yte*2-1; % Need to change output to {-1,1} +elseif strcmp(dataset,'yeast') + load(fullfile(gurls_root, 'demo/data/yeast_data.mat')); +end + +% filestr = {'linsvmsub','rbfsvmsub'}; +filestr = {'linsvmsub','rbfsvmsub','rbfho','rbfloo'}; +n = 5; + +res_root = fullfile(gurls_root, 'demo/demodata'); % location where res files are stored + +for r = 1:n + strind = strmatch('linsvmsub',filestr); + if ~isempty(strind) + % Gaussian kernel, SVM Subgradient, Hold Out cross validation to select lambda and the Kernel width sigma + name = [filestr{strind} '_' num2str(r)]; + opt = defopt(name); + opt.seq = {'split:ho', 'kernel:linear', 'paramsel:hodual', 'rls:svmsubgradient', 'pred:dual', 'perf:macroavg', 'perf:precrec'}; + opt.process{1} = [2,2,2,2,0,0,0]; + opt.process{2} = [3,3,3,3,2,2,2]; + opt.epochs = 100; + gurls(Xtr, ytr, opt, 1); + op = gurls(Xte, yte, opt, 2); + disp(op.perf.acc); + end + + strind = strmatch('rbfsvmsub',filestr); + if ~isempty(strind) + % Gaussian kernel, SVM Subgradient, Hold Out cross validation to select lambda and the Kernel width sigma + name = [filestr{strind} '_' num2str(r)]; + opt = defopt(name); + opt.seq = {'split:ho', 'paramsel:siglamho', 'kernel:rbf', 'rls:svmsubgradient', 'predkernel:traintest', 'pred:dual', 'perf:macroavg', 'perf:precrec'}; + opt.process{1} = [2,2,2,2,0,0,0,0]; + opt.process{2} = [3,3,3,3,2,2,2,2]; + opt.epochs = 100; + gurls(Xtr, ytr, opt, 1); + op = gurls(Xte, yte, opt, 2); + disp(op.perf.acc); + end + + strind = strmatch('rbfho',filestr); + if ~isempty(strind) + % Gaussian kernel, (dual formulation), Hold Out cross validation to select lambda and the Kernel width sigma + name = [filestr{strind} '_' num2str(r)]; + opt = defopt(name); + opt.seq = {'split:ho', 'paramsel:siglamho', 'kernel:rbf', 'rls:dual', 'predkernel:traintest', 'pred:dual', 'perf:macroavg', 'perf:precrec'}; + opt.process{1} = [2,2,2,2,0,0,0,0]; + opt.process{2} = [3,3,3,3,2,2,2,2]; + gurls(Xtr, ytr, opt, 1); + gurls(Xte, yte, opt, 2); + end + + strind = strmatch('rbfloo',filestr); + if ~isempty(strind) + % Gaussian kernel, (dual formulation), Leave One Out cross validation to select lambda and the Kernel width sigma + name = [filestr{strind} '_' num2str(r)]; + opt = defopt(name); + opt.seq = {'paramsel:siglam', 'kernel:rbf', 'rls:dual', 'predkernel:traintest', 'pred:dual', 'perf:macroavg', 'perf:precrec'}; + opt.process{1} = [2,2,2,0,0,0,0]; + opt.process{2} = [3,3,3,2,2,2,2]; + gurls(Xtr, ytr, opt, 1); + gurls(Xte, yte, opt, 2); + end +end + +%% Visualization: +% - filestr: cell with names of the experiments +% - nRuns: number of runs for each experiment +% - fields: which fields of opt to display (as many plots as the elements of fields will be generated). +% - plotopt: a structure containing various text labels for the plots. + +nRuns = n*ones(1,length(filestr)); +fields = {'perf.ap', 'perf.acc'}; +plotopt.titles = {'Model Comparison - Accuracy', 'Model Comparison - Precision'}; + +if strcmp(dataset,'breastcancer') + plotopt.class_names = {'Positive'}; +elseif strcmp(dataset,'yeast') + plotopt.class_names = {'CYT', 'NUC', 'MIT', 'ME3'}; +end + +% Generates "per-class" plots +summary_plot(filestr, fields, nRuns, plotopt, res_root) +% Generates "global" plots +summary_overall_plot(filestr, fields, nRuns, plotopt, res_root) +% Plots times taken by each step of the pipeline for performance reference. +plot_times(filestr, nRuns, res_root) + diff --git a/gurls/gurls_defopt.m b/gurls/gurls_defopt.m index 97c80d5..e0b13a9 100644 --- a/gurls/gurls_defopt.m +++ b/gurls/gurls_defopt.m @@ -62,6 +62,9 @@ opt.newprop( 'epochs', 4); opt.newprop( 'subsize', 50); opt.newprop( 'calibfile', 'foo'); + + %% Subgradient + opt.newprop( 'Niter', 100); %% Random features options opt.newprop( 'randfeats', struct()); diff --git a/gurls/optimizers/rls_svmsubgradient.m b/gurls/optimizers/rls_svmsubgradient.m new file mode 100644 index 0000000..2ba0ede --- /dev/null +++ b/gurls/optimizers/rls_svmsubgradient.m @@ -0,0 +1,64 @@ +function [rls] = rls_svmsubgradient(X,y, opt) + +% rls_svmsubgradient(X, y, opt) +% computes the regression function for svm subgradient method. +% The regularization parameter (i.e. the number of iterations) is set to the one found in opt.paramsel. +% +% INPUTS: +% -OPT: struct of options with the following fields: +% fields that need to be set through previous gurls tasks: +% - paramsel.lambdas (set by the paramsel_* routines) +% fields with default values set through the defopt function: +% - singlelambda +% +% For more information on standard OPT fields +% see also defopt +% +% OUTPUT: struct with the following fields: +% -W: matrix of coefficient vectors of rls estimator for each class +% -C: empty matrix +% -X: empty matrix + +lambda = opt.singlelambda(opt.paramsel.lambdas); +Niter = opt.Niter; + +[n,T] = size(y); + +if isfield(opt.paramsel,'niter'); + niter = max(1,ceil(opt.paramsel.niter)); +else + niter = 1; +end + +if isfield(opt.paramsel,'f0') && niter <= Niter; + alpha = opt.paramsel.f0; +else + niter = 1; + alpha=zeros(n,T); +end + +iter = niter:(Niter); +gamma = 1./iter; + +for i = iter; + yhat = opt.kernel.K*alpha; + yxyhat = y.*yhat; + indic = (yxyhat <= 1); + alpha = alpha*(1-2*gamma(i)*lambda) + (gamma(i)/n)*(y.*indic); +end + +opt.paramsel.f0 = alpha; +opt.paramsel.niter = Niter; + +if strcmp(opt.kernel.type, 'linear') + rls.W = X'*alpha; + rls.C = []; + rls.X = []; +else + rls.W = []; + rls.C = alpha; + rls.X = X; +end + + + From e24a7c7c40b9f1365592bb6c6ece49614fec1d18 Mon Sep 17 00:00:00 2001 From: hanssusilo Date: Thu, 3 Mar 2016 20:34:48 -0500 Subject: [PATCH 2/7] added comments for clarity --- gurls/demo/demo_svmsubgradient.m | 50 +++++++++++++++------------ gurls/optimizers/rls_svmsubgradient.m | 5 +-- 2 files changed, 30 insertions(+), 25 deletions(-) diff --git a/gurls/demo/demo_svmsubgradient.m b/gurls/demo/demo_svmsubgradient.m index af3f77f..15c6cec 100644 --- a/gurls/demo/demo_svmsubgradient.m +++ b/gurls/demo/demo_svmsubgradient.m @@ -1,54 +1,57 @@ -clear all; -close all; +% DEMO OF THE SVM SUBGRADIENT METHOD COMPARED TO DUAL FORMULATION +% adapted from gurlsdemo.m -% dataset = 'breastcancer'; +% Clear and close everything +clear all; close all; + +% Use either the 'breastcancer' or 'yeast' datasets dataset = 'yeast'; if strcmp(dataset,'breastcancer') load(fullfile(gurls_root, 'demo/data/breastcancer_data.mat')); - ytr = ytr*2-1; yte = yte*2-1; % Need to change output to {-1,1} + ytr = ytr*2-1; yte = yte*2-1; % Convert output to {-1,1} elseif strcmp(dataset,'yeast') load(fullfile(gurls_root, 'demo/data/yeast_data.mat')); end -% filestr = {'linsvmsub','rbfsvmsub'}; -filestr = {'linsvmsub','rbfsvmsub','rbfho','rbfloo'}; +% List the models to use +models = {'linsvmsub','rbfsvmsub','rbfho','rbfloo'}; + +% Number of iterations n = 5; res_root = fullfile(gurls_root, 'demo/demodata'); % location where res files are stored for r = 1:n - strind = strmatch('linsvmsub',filestr); + strind = strmatch('linsvmsub',models); if ~isempty(strind) - % Gaussian kernel, SVM Subgradient, Hold Out cross validation to select lambda and the Kernel width sigma - name = [filestr{strind} '_' num2str(r)]; + % Gaussian kernel, SVM Subgradient, Hold Out cross validation to select lambda + name = [models{strind} '_' num2str(r)]; opt = defopt(name); opt.seq = {'split:ho', 'kernel:linear', 'paramsel:hodual', 'rls:svmsubgradient', 'pred:dual', 'perf:macroavg', 'perf:precrec'}; opt.process{1} = [2,2,2,2,0,0,0]; opt.process{2} = [3,3,3,3,2,2,2]; opt.epochs = 100; gurls(Xtr, ytr, opt, 1); - op = gurls(Xte, yte, opt, 2); - disp(op.perf.acc); + gurls(Xte, yte, opt, 2); end - strind = strmatch('rbfsvmsub',filestr); + strind = strmatch('rbfsvmsub',models); if ~isempty(strind) % Gaussian kernel, SVM Subgradient, Hold Out cross validation to select lambda and the Kernel width sigma - name = [filestr{strind} '_' num2str(r)]; + name = [models{strind} '_' num2str(r)]; opt = defopt(name); opt.seq = {'split:ho', 'paramsel:siglamho', 'kernel:rbf', 'rls:svmsubgradient', 'predkernel:traintest', 'pred:dual', 'perf:macroavg', 'perf:precrec'}; opt.process{1} = [2,2,2,2,0,0,0,0]; opt.process{2} = [3,3,3,3,2,2,2,2]; opt.epochs = 100; gurls(Xtr, ytr, opt, 1); - op = gurls(Xte, yte, opt, 2); - disp(op.perf.acc); + gurls(Xte, yte, opt, 2); end - strind = strmatch('rbfho',filestr); + strind = strmatch('rbfho',models); if ~isempty(strind) % Gaussian kernel, (dual formulation), Hold Out cross validation to select lambda and the Kernel width sigma - name = [filestr{strind} '_' num2str(r)]; + name = [models{strind} '_' num2str(r)]; opt = defopt(name); opt.seq = {'split:ho', 'paramsel:siglamho', 'kernel:rbf', 'rls:dual', 'predkernel:traintest', 'pred:dual', 'perf:macroavg', 'perf:precrec'}; opt.process{1} = [2,2,2,2,0,0,0,0]; @@ -57,10 +60,10 @@ gurls(Xte, yte, opt, 2); end - strind = strmatch('rbfloo',filestr); + strind = strmatch('rbfloo',models); if ~isempty(strind) % Gaussian kernel, (dual formulation), Leave One Out cross validation to select lambda and the Kernel width sigma - name = [filestr{strind} '_' num2str(r)]; + name = [models{strind} '_' num2str(r)]; opt = defopt(name); opt.seq = {'paramsel:siglam', 'kernel:rbf', 'rls:dual', 'predkernel:traintest', 'pred:dual', 'perf:macroavg', 'perf:precrec'}; opt.process{1} = [2,2,2,0,0,0,0]; @@ -76,10 +79,11 @@ % - fields: which fields of opt to display (as many plots as the elements of fields will be generated). % - plotopt: a structure containing various text labels for the plots. -nRuns = n*ones(1,length(filestr)); +nRuns = n*ones(1,length(models)); fields = {'perf.ap', 'perf.acc'}; plotopt.titles = {'Model Comparison - Accuracy', 'Model Comparison - Precision'}; +% Label based on dataset used if strcmp(dataset,'breastcancer') plotopt.class_names = {'Positive'}; elseif strcmp(dataset,'yeast') @@ -87,9 +91,9 @@ end % Generates "per-class" plots -summary_plot(filestr, fields, nRuns, plotopt, res_root) +summary_plot(models, fields, nRuns, plotopt, res_root) % Generates "global" plots -summary_overall_plot(filestr, fields, nRuns, plotopt, res_root) +summary_overall_plot(models, fields, nRuns, plotopt, res_root) % Plots times taken by each step of the pipeline for performance reference. -plot_times(filestr, nRuns, res_root) +plot_times(models, nRuns, res_root) diff --git a/gurls/optimizers/rls_svmsubgradient.m b/gurls/optimizers/rls_svmsubgradient.m index 2ba0ede..c2f655f 100644 --- a/gurls/optimizers/rls_svmsubgradient.m +++ b/gurls/optimizers/rls_svmsubgradient.m @@ -2,14 +2,15 @@ % rls_svmsubgradient(X, y, opt) % computes the regression function for svm subgradient method. -% The regularization parameter (i.e. the number of iterations) is set to the one found in opt.paramsel. -% +% The regularization parameter is set to the one found in opt.paramsel (set by the paramsel_* routines) + % INPUTS: % -OPT: struct of options with the following fields: % fields that need to be set through previous gurls tasks: % - paramsel.lambdas (set by the paramsel_* routines) % fields with default values set through the defopt function: % - singlelambda +% - Niter % % For more information on standard OPT fields % see also defopt From 9dd78e8adcb23af3cd8d55155e52ff8fc9138723 Mon Sep 17 00:00:00 2001 From: hanssusilo Date: Thu, 3 Mar 2016 21:07:17 -0500 Subject: [PATCH 3/7] added user function to produce gamma step sizes --- gurls/defopt.m | 1 + gurls/demo/demo_svmsubgradient.m | 3 --- gurls/gurls_defopt.m | 1 + gurls/optimizers/rls_svmsubgradient.m | 4 +++- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/gurls/defopt.m b/gurls/defopt.m index d8b8138..40b5828 100644 --- a/gurls/defopt.m +++ b/gurls/defopt.m @@ -70,6 +70,7 @@ %% Subgradient opt.Niter= 100; + opt.gammafunc = @(x) power(x,-1); %% Random features options opt.randfeats = struct(); diff --git a/gurls/demo/demo_svmsubgradient.m b/gurls/demo/demo_svmsubgradient.m index 15c6cec..8b123f1 100644 --- a/gurls/demo/demo_svmsubgradient.m +++ b/gurls/demo/demo_svmsubgradient.m @@ -1,9 +1,6 @@ % DEMO OF THE SVM SUBGRADIENT METHOD COMPARED TO DUAL FORMULATION % adapted from gurlsdemo.m -% Clear and close everything -clear all; close all; - % Use either the 'breastcancer' or 'yeast' datasets dataset = 'yeast'; if strcmp(dataset,'breastcancer') diff --git a/gurls/gurls_defopt.m b/gurls/gurls_defopt.m index e0b13a9..c0eab29 100644 --- a/gurls/gurls_defopt.m +++ b/gurls/gurls_defopt.m @@ -65,6 +65,7 @@ %% Subgradient opt.newprop( 'Niter', 100); + opt.newprop( 'gammafunc', @(x) power(x,-1)); %% Random features options opt.newprop( 'randfeats', struct()); diff --git a/gurls/optimizers/rls_svmsubgradient.m b/gurls/optimizers/rls_svmsubgradient.m index c2f655f..c7f777c 100644 --- a/gurls/optimizers/rls_svmsubgradient.m +++ b/gurls/optimizers/rls_svmsubgradient.m @@ -11,6 +11,8 @@ % fields with default values set through the defopt function: % - singlelambda % - Niter +% - gammafunc - the function that maps niter to step factor, gamma +% the default is 1/niter --> [1, 1/2, 1/3, ... 1/Niter] % % For more information on standard OPT fields % see also defopt @@ -39,7 +41,7 @@ end iter = niter:(Niter); -gamma = 1./iter; +gamma = opt.gammafunc(iter); for i = iter; yhat = opt.kernel.K*alpha; From cdfb1171250efc882f71cf83716a655a37c8fd95 Mon Sep 17 00:00:00 2001 From: hanssusilo Date: Sun, 6 Mar 2016 20:33:18 -0500 Subject: [PATCH 4/7] fixed bug and added line to show how to change gammafunc --- gurls/demo/demo_svmsubgradient.m | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/gurls/demo/demo_svmsubgradient.m b/gurls/demo/demo_svmsubgradient.m index 8b123f1..64933f0 100644 --- a/gurls/demo/demo_svmsubgradient.m +++ b/gurls/demo/demo_svmsubgradient.m @@ -10,10 +10,10 @@ load(fullfile(gurls_root, 'demo/data/yeast_data.mat')); end -% List the models to use +% List the methods to use models = {'linsvmsub','rbfsvmsub','rbfho','rbfloo'}; -% Number of iterations +% Number of trials to run each method n = 5; res_root = fullfile(gurls_root, 'demo/demodata'); % location where res files are stored @@ -27,7 +27,8 @@ opt.seq = {'split:ho', 'kernel:linear', 'paramsel:hodual', 'rls:svmsubgradient', 'pred:dual', 'perf:macroavg', 'perf:precrec'}; opt.process{1} = [2,2,2,2,0,0,0]; opt.process{2} = [3,3,3,3,2,2,2]; - opt.epochs = 100; + opt.Niter = 200; +% opt.gammafunc = @(x) power(x,-.5); gurls(Xtr, ytr, opt, 1); gurls(Xte, yte, opt, 2); end @@ -40,7 +41,8 @@ opt.seq = {'split:ho', 'paramsel:siglamho', 'kernel:rbf', 'rls:svmsubgradient', 'predkernel:traintest', 'pred:dual', 'perf:macroavg', 'perf:precrec'}; opt.process{1} = [2,2,2,2,0,0,0,0]; opt.process{2} = [3,3,3,3,2,2,2,2]; - opt.epochs = 100; + opt.Niter = 200; +% opt.gammafunc = @(x) power(x,-.5); gurls(Xtr, ytr, opt, 1); gurls(Xte, yte, opt, 2); end @@ -76,7 +78,7 @@ % - fields: which fields of opt to display (as many plots as the elements of fields will be generated). % - plotopt: a structure containing various text labels for the plots. -nRuns = n*ones(1,length(models)); +nRuns = n*ones(1,size(models,2)); fields = {'perf.ap', 'perf.acc'}; plotopt.titles = {'Model Comparison - Accuracy', 'Model Comparison - Precision'}; From c2004ad8c05cd76b4923f1904a6c6013a5f8668c Mon Sep 17 00:00:00 2001 From: hanssusilo Date: Sun, 6 Mar 2016 21:06:41 -0500 Subject: [PATCH 5/7] fixed more bugs - should be fully functioning --- gurls/demo/demo_svmsubgradient.m | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gurls/demo/demo_svmsubgradient.m b/gurls/demo/demo_svmsubgradient.m index 64933f0..41f7ff2 100644 --- a/gurls/demo/demo_svmsubgradient.m +++ b/gurls/demo/demo_svmsubgradient.m @@ -16,7 +16,7 @@ % Number of trials to run each method n = 5; -res_root = fullfile(gurls_root, 'demo/demodata'); % location where res files are stored +res_root = fullfile(gurls_root, 'demo'); % location where res files are stored for r = 1:n strind = strmatch('linsvmsub',models); From 2ce89610c69bf790a40c1fe80fd21ef70ed01ec1 Mon Sep 17 00:00:00 2001 From: hanssusilo Date: Sun, 6 Mar 2016 21:11:45 -0500 Subject: [PATCH 6/7] added example to change methods used --- gurls/demo/demo_svmsubgradient.m | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/gurls/demo/demo_svmsubgradient.m b/gurls/demo/demo_svmsubgradient.m index 41f7ff2..a78100a 100644 --- a/gurls/demo/demo_svmsubgradient.m +++ b/gurls/demo/demo_svmsubgradient.m @@ -11,7 +11,8 @@ end % List the methods to use -models = {'linsvmsub','rbfsvmsub','rbfho','rbfloo'}; +% models = {'linsvmsub','rbfsvmsub','rbfho','rbfloo'}; +models = {'linsvmsub','rbfsvmsub','rbfho'}; % Number of trials to run each method n = 5; From 50c92a52ead26d935606f52c4e899c2a5e01bcf2 Mon Sep 17 00:00:00 2001 From: hanssusilo Date: Mon, 7 Mar 2016 00:48:41 -0500 Subject: [PATCH 7/7] changed name of models to pipelines to avoid confusion --- gurls/demo/demo_svmsubgradient.m | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/gurls/demo/demo_svmsubgradient.m b/gurls/demo/demo_svmsubgradient.m index a78100a..bcae52a 100644 --- a/gurls/demo/demo_svmsubgradient.m +++ b/gurls/demo/demo_svmsubgradient.m @@ -11,8 +11,8 @@ end % List the methods to use -% models = {'linsvmsub','rbfsvmsub','rbfho','rbfloo'}; -models = {'linsvmsub','rbfsvmsub','rbfho'}; +% pipelines = {'linsvmsub','rbfsvmsub','rbfho','rbfloo'}; +pipelines = {'linsvmsub','rbfsvmsub','rbfho'}; % Number of trials to run each method n = 5; @@ -20,10 +20,10 @@ res_root = fullfile(gurls_root, 'demo'); % location where res files are stored for r = 1:n - strind = strmatch('linsvmsub',models); + strind = strmatch('linsvmsub',pipelines); if ~isempty(strind) % Gaussian kernel, SVM Subgradient, Hold Out cross validation to select lambda - name = [models{strind} '_' num2str(r)]; + name = [pipelines{strind} '_' num2str(r)]; opt = defopt(name); opt.seq = {'split:ho', 'kernel:linear', 'paramsel:hodual', 'rls:svmsubgradient', 'pred:dual', 'perf:macroavg', 'perf:precrec'}; opt.process{1} = [2,2,2,2,0,0,0]; @@ -34,10 +34,10 @@ gurls(Xte, yte, opt, 2); end - strind = strmatch('rbfsvmsub',models); + strind = strmatch('rbfsvmsub',pipelines); if ~isempty(strind) % Gaussian kernel, SVM Subgradient, Hold Out cross validation to select lambda and the Kernel width sigma - name = [models{strind} '_' num2str(r)]; + name = [pipelines{strind} '_' num2str(r)]; opt = defopt(name); opt.seq = {'split:ho', 'paramsel:siglamho', 'kernel:rbf', 'rls:svmsubgradient', 'predkernel:traintest', 'pred:dual', 'perf:macroavg', 'perf:precrec'}; opt.process{1} = [2,2,2,2,0,0,0,0]; @@ -48,10 +48,10 @@ gurls(Xte, yte, opt, 2); end - strind = strmatch('rbfho',models); + strind = strmatch('rbfho',pipelines); if ~isempty(strind) % Gaussian kernel, (dual formulation), Hold Out cross validation to select lambda and the Kernel width sigma - name = [models{strind} '_' num2str(r)]; + name = [pipelines{strind} '_' num2str(r)]; opt = defopt(name); opt.seq = {'split:ho', 'paramsel:siglamho', 'kernel:rbf', 'rls:dual', 'predkernel:traintest', 'pred:dual', 'perf:macroavg', 'perf:precrec'}; opt.process{1} = [2,2,2,2,0,0,0,0]; @@ -60,10 +60,10 @@ gurls(Xte, yte, opt, 2); end - strind = strmatch('rbfloo',models); + strind = strmatch('rbfloo',pipelines); if ~isempty(strind) % Gaussian kernel, (dual formulation), Leave One Out cross validation to select lambda and the Kernel width sigma - name = [models{strind} '_' num2str(r)]; + name = [pipelines{strind} '_' num2str(r)]; opt = defopt(name); opt.seq = {'paramsel:siglam', 'kernel:rbf', 'rls:dual', 'predkernel:traintest', 'pred:dual', 'perf:macroavg', 'perf:precrec'}; opt.process{1} = [2,2,2,0,0,0,0]; @@ -79,7 +79,7 @@ % - fields: which fields of opt to display (as many plots as the elements of fields will be generated). % - plotopt: a structure containing various text labels for the plots. -nRuns = n*ones(1,size(models,2)); +nRuns = n*ones(1,size(pipelines,2)); fields = {'perf.ap', 'perf.acc'}; plotopt.titles = {'Model Comparison - Accuracy', 'Model Comparison - Precision'}; @@ -91,9 +91,9 @@ end % Generates "per-class" plots -summary_plot(models, fields, nRuns, plotopt, res_root) +summary_plot(pipelines, fields, nRuns, plotopt, res_root) % Generates "global" plots -summary_overall_plot(models, fields, nRuns, plotopt, res_root) +summary_overall_plot(pipelines, fields, nRuns, plotopt, res_root) % Plots times taken by each step of the pipeline for performance reference. -plot_times(models, nRuns, res_root) +plot_times(pipelines, nRuns, res_root)