function [param] = train_svm(K,y);

C = 100; 

[n,n] = size(K);
K  = diag(y)*K*diag(y);

A = [eye(n);-eye(n);y';-y'];
b = [C*ones(n,1);zeros(n,1);0;0];
f = -ones(n,1);

a = qp(K,f,A,b);

eps = 0.001*max(a);
Iesv = find(a>=eps & a<=C-eps);
mar = K*a; 
wo = median(-y(Iesv).*(mar(Iesv)-1));

param = struct('a',a,'y',y,'wo',wo); 
