function [ weights bias ] = TannSchmidVectorMachineHardMarginUno( K, H, labels)
%Toggle details which kernel we use
[xm xn] = size(K);
[ym yn] = size(labels);
%check to make sure training & labels have same dimension and toggle is
%valid
if xm ~= ym
display('Sorry, this is an idiot proof function. Try feeding in valid parameters next time, doof!');
return;
end
%allocate space for different parts
f = -ones(xm, 1);
A = zeros(xm +2, xm);
bias = zeros(xm +2, 1);
%build constraints matrix
A(1,:) = labels';
A(2,:) = -labels';
for i = 1:xm
A(i+2, i) = -1;
end
[weights v] = quadprog(H, f, A, bias);
%find the bias
bias = getHardMarginBias(weights, K, labels);
save('recordedResults0', 'weights', 'bias', 'K');
Friday Night Open Thread: Motivation
2 hours ago
No comments:
Post a Comment