Skip to content

Commit

Permalink
Supressed alternative optimizers. The property is keep for future opt…
Browse files Browse the repository at this point in the history
…imizers inclusion
  • Loading branch information
javism committed Jan 31, 2018
1 parent f184bb3 commit fe91667
Showing 1 changed file with 12 additions and 26 deletions.
38 changes: 12 additions & 26 deletions src/Algorithms/KDLOR.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
% available at http://www.gnu.org/licenses/gpl-3.0.html

properties
optimizationMethod = 'quadprog';
optimizationMethod = 'quadprog'; %TODO: more to add
parameters = struct('C', 0.1, 'k', 0.1, 'u', 0.01);
kernelType = 'rbf';
end
Expand All @@ -50,13 +50,23 @@
%SET.OPTIMIZATIONMETHOD verifies if the value for the variable
%optimizationMethod is correct. Returns value for the variable
%|optimizationMethod|.
if ~(strcmpi(value,'quadprog') || strcmpi(value,'qp') || strcmpi(value,'cvx'))
% TODO: look for free optimizer for matlab
%if ~(strcmpi(value,'quadprog') || strcmpi(value,'qp') || strcmpi(value,'cvx'))
if ~strcmpi(value,'quadprog')
error('Invalid value for optimizer');
else
obj.optimizationMethod = value;
end
end

function obj = set.kernelType(obj, value)
if ~(strcmpi(value,'rbf') || strcmpi(value,'sigmoid') || strcmpi(value,'linear'))
error('Invalid value for kernelType');
else
obj.kernelType = value;
end
end

function [model, projectedTrain, predictedTrain]= fit( obj, train, parameters)
%FIT trains the model for the KDLOR method with TRAIN data and
%vector of parameters PARAMETERS. Return the learned model.
Expand Down Expand Up @@ -151,30 +161,6 @@
if exist ('OCTAVE_VERSION', 'builtin') > 0
pkg unload optim;
end
case 'CVX'
% rmpath ../cvx/sets
% rmpath ../cvx/keywords
% addpath ../cvx
% addpath ../cvx/structures
% addpath ../cvx/lib
% addpath ../cvx/functions
% addpath ../cvx/commands
% addpath ../cvx/builtins

cvx_begin
cvx_quiet(true)
variables alpha(numClasses-1)
minimize( 0.5*alpha'*Q*alpha );
subject to
(ones(1,numClasses-1)*alpha) == d;
alpha >= 0;
cvx_end
case 'QP'
if exist ('OCTAVE_VERSION', 'builtin') > 0
alpha = qp(x0, Q, c, E, d, vlb, vub);
else
alpha = qp(Q, c, E, d, vlb, vub,x0,1,0);
end
otherwise
error('Invalid value for optimizer\n');
end
Expand Down

0 comments on commit fe91667

Please sign in to comment.