Help in implementing one class svm in CVX


#1

I am trying to implement one class svm as defined developed by Scholkopf http://rvlasveld.github.io/blog/2013/07/12/introduction-to-one-class-support-vector-machines/ I am implementing the dual problem. Can anyone check why it is not working properly? I am getting positive number for non-class data.
v=.1;
C=1/(v*m); % m is the number of training samples.
cvx_begin
variables alphaLagrange(m);
minimize (0.5.*quad_form(alphaLagrange,K));
subject to
ones(m,1)’*alphaLagrange==1;
alphaLagrange <= C;
alphaLagrange >= 0;
cvx_end
totalSum = 0;
for i=1:m
totalSum = totalSum + alphaLagrange(i)*input(i,:);
end

weights = totalSum;

The kernel ‘K’ is correct as I have used it other code and works perfectly. The value of ‘rho’ is defined as ‘paperRow’ as below.

paperRow=0;
for i=1:m
    paperRow = paperRow + sum(alpha.*kernel(input,Xdata(k,:),type));
end

% input is all data;
% Xdata(k, ) is a particular sample.

and finally I am using if the data is of the class or outlier by the function:

sign(someData(k,:)*weights’-paperRow);

But I get positive number for any kind of ‘someData’. Any sugesstion why?