Skip to content

Instantly share code, notes, and snippets.

@wuyazi
Created April 7, 2014 10:24
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wuyazi/10017883 to your computer and use it in GitHub Desktop.
Save wuyazi/10017883 to your computer and use it in GitHub Desktop.
%% svm
H = eye(d+1);
H(d+1,d+1) = 0;
w = quadprog(H,zeros(d+1,1),A,c);
hold on;
x1 = -shift-2:0.1:shift+2*sigma;
y1 = (-w(3)-w(1)*x1)/w(2);
plot(x1,y1,'g-','LineWidth',2);
y1 = (-1-w(3)-w(1)*x1)/w(2);
plot(x1,y1,'g-','LineWidth',2);
y1 = (1-w(3)-w(1)*x1)/w(2);
plot(x1,y1,'g-','LineWidth',2);
legend('Positive samples','Negative samples','Linear programming','Linear SVM');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment