Hello, i am using matlab cvx for classification, the input data is a random data of positive and negative numbers as the samples and the labels are -1 for negative numbers and +1 for positive numbers, first i train cvx with some training randomly generated data and then i test it. in the test i require cvx to predict the labels but for some reason it always predicts all the labels to be -1. i did that with two different equations for classifications from the same paper i am reading which is “interaction between financial risk measures and machine learning methods” jun-ya gotoh.

plus when i increase the number of samples (s) over 1000 the training code doesnt work

here is the code

```
clc
close all
clear all
s=1000; %number of samples
%randomly generated samples
samplesneg1 = -1 +.07*rand(s,1);
samples1 = 1+.07*rand(s,1);
y = [ zeros(s/2,1) ; ones(s/2,1) ];
for i =1:length(y)
if(y(i)<1)
y(i)=-1;
end
end
trainneg1 = samplesneg1(1:s/2 , :);
train1 = samples1(1:s/2 , :);
x = [ trainneg1 ; train1 ];
m=length(y);
%generating test samples
xt= [ samplesneg1((s/2 +1):s, :) ; samples1((s/2 +1):s , :) ];
xt = xt (randperm (length (xt)));
n= size(x(1,:)); %size of one sample
cvx_begin
variables w(n)
minimize ( ((1/2)* norm(w,2)^2));
subject to
for i=1:m
( y(i)*((w*(x(i,:))') -1)) >= 0;
end
cvx_end
disp('after')
labelsT = [];
for i=1:length(xt)
if(xt(i)<0)
labelsT(i)=-1;
else if (xt(i)>0)
labelsT(i)=1;
end
end
end
w1=w;
u=length(xt);
cvx_begin
variables yf(s)
minimize ( ((1/2)* norm(w1,2)^2) );
subject to
for i=1:m
(yf(i)* ((w1*(xt(i,:))') -1 )) >= 0;
end
cvx_end
for i=1:length(yf)
if(yf(i)<=0)
yf(i)=-1;
else
yf(i)=1;
end
end
c=0;
L = labelsT;
for i=1:length(L)
if(L(i)~=yf(i))
c=c+1;
end
end
error = (c/length(L))*100
```